|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
Quests::Q&A This is the quest support section |

03-12-2011, 11:09 PM
|
Hill Giant
|
|
Join Date: May 2010
Posts: 125
|
|
Passing Variables, Saving Fight Status
Sorry to bother everyone, but I've run into a minor issue (again).
Trying to have an NPC (which we'll call Bob), spawn a small chain of npcs in waves.
Bob needs to send the target to his newly spawned friends.
Also, Bob's newly spawned friends refuse to attack. I'm conning threateningly, sitting at their feet, aggro radius is 50 and the aggro flag/trigger/etc is set to 1 (assuming 0 = off). I even tried setting a proximity in perl file to bust me in the face when I get too close...nadda.
-Hate
|

03-12-2011, 11:38 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
What part do you need help with? You could have your npc waves send signals to Bob when they die. If you think the zone may shut down or you want to resume a fight, you could always use qglobals.
As for the "refuse to attack" - GM flag on?
|

03-12-2011, 11:49 PM
|
Hill Giant
|
|
Join Date: May 2010
Posts: 125
|
|
Specifically how does one send variables between NPCs? Can some of the prebuilt events be used? Are globals known to cause issues?
I don't need anything particularly strong, just something that can tally up random point scores at the end of each wave. Rewarding the players every 5 defeated waves.
(and of course, some way to get Bob to instruct the wave leader to attack the quest starter)
(thank you for the reply!)
-Hate
|

03-13-2011, 12:02 AM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
You don't really send variables between NPCs, but you can use signals. You can signal a specific number and it can be like sending a variable...
NPC1 - Bob (10001)
Code:
sub EVENT_SAY {
if ($text=~/go/i) {
quest::say("Sending signal to Nancy.");
quest::signalwith(10002,1,0);
}
}
sub EVENT_SIGNAL {
if ($signal == 99) {
quest::say("Nancy replied back with 99.");
}
}
NPC2 - Nancy (10002)
Code:
sub EVENT_SIGNAL {
if ($signal == 1) {
quest::shout("Yes, Bob!");
quest::signalwith(10001,99,0);
}
}
As for qglobals, just as long as you understand the implementation, there shouldn't be anything wrong with using those. However, that would be more for something that you would need to store for a longer period of time rather than immediately.
|

03-13-2011, 03:18 PM
|
Hill Giant
|
|
Join Date: May 2010
Posts: 125
|
|
Made note of signals, but the information passed back and forth would primarily be a target(s).
For example: Joe(player) says "I am ready" to Bob(npc). Bob(npc) spawns Nancy(npc) and the 7 Angry Nuns.
How would I get Bob(npc) to tell Nancy(npc) and her Nuns to attack Joe(player)?
As far as I am aware, mobs cannot be spawned with a target preset.
I have rough idea of how to build small variable list for targets, not how to pass them. Basically would like to build list of the player that say "ready", the ids of his group, and then mark any of those in group as "priorities" if class = clr/dru/shm. Then Nancy(npc) could randomly tell the nuns to focus fire on one of the priority targets (chosen at random via the quest::chooserandom(id1,id2,etc) option).
And again, joligario, thank you for your time.
-Hate
|

03-13-2011, 07:42 PM
|
Dragon
|
|
Join Date: May 2009
Location: Milky Way
Posts: 539
|
|
Get the ID of the target you want passed and pass that as the signal number.
|

03-13-2011, 09:19 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
Exactly. Also, if your NPC is going to be up all the time, you could control everything with him. Check out the scripts in qinimi on the peq site for the BiC quest.
|

03-15-2011, 04:18 PM
|
Sarnak
|
|
Join Date: May 2010
Posts: 39
|
|
http://www.eqemulator.org/forums/showthread.php?t=32774
Here's another example of a NPC selecting a random target from a hate list from Trevius. It's a bit more complicated but works very well. There's a modified version of it over at PEQ in ikkinz.
|

03-17-2011, 11:49 AM
|
Hill Giant
|
|
Join Date: May 2010
Posts: 125
|
|
Alright, thank you. I now have a general direction.
All I have to do now is fine tune it, get the non-standard zone models to work (ex: Spectre, Gnolls, Plague Rats, etc in West Freeport), and then some cookies.
Almost there, thank you again all.
-Hate
|
 |
|
 |

03-25-2011, 05:22 PM
|
Hill Giant
|
|
Join Date: May 2010
Posts: 125
|
|
I am almost completely stuck. I cannot get this bugger to do anything other than stand there like a goon. I am clueless as to where this is failing as it produces no output.
Occasionally it will get an error involving "$i->AddToHateList($attackerID,100)" but I found a post leading me to believe that AddToHateList used entityID instead.
Code:
$calledIt = 0;
$markPlayer = 0;
sub EVENT_SPAWN
{
}
sub EVENT_DEATH
{
quest::signalwith(999147,999148,0);
quest::emote("yelps in pain.");
undef $calledIt;
undef $markPlayer;
}
sub EVENT_ATTACK
{
# my @NPCLIST = $entity_list->GetNPCList();
# my @victimList = $npc->GetHateList();
# my $victimCount = scalar (@victimList);
# quest::shout("DEBUG: $victimCount");
if($calledIt == 0)
{
$calledIt = 1;
charge(0, $client);
}
}
sub EVENT_AGGRO
{
if($calledIt == 0)
{
$calledIt = 1;
charge(0, $client);
}
}
sub EVENT_SIGNAL
{
if($calledIt == 0)
{
$calledIt = 1;
$markPlayer = $signal;
charge($markPlayer, 0);
}
if($signal eq "tmHT")
{
castHT();
quest::stoptimer("tmHT");
quest::settimer("tmHT", 15);
}
}
sub charge
{
my $var1 = $_[0]; ## character id storage
my $var2 = $_[1]; ## client id storage
if($var1 == 0)
{
$attacker = $var2->GetName();
$attackerID = $var2->CharacterID();
}
else
{
$var2 = $entity_list->GetClientByCharID($var1);
$attacker = $var2->GetName();
$attackerID = $var1;
}
# warn players
quest::shout("Blackburrrroooooow!");
quest::attack($attacker);
# call up lists of gnolls
my @NPCLIST = $entity_list->GetNPCList();
#my @fippy = $entity_list->GetMobByNpcTypeID(999150);
#my @tranixx = $entity_list->GetMobByNpcTypeID(999149);
my $fippy = 999150;
my $tranixx = 999149;
my $tempScalar = 0;
foreach $i (@NPCLIST){
if($i->GetNPCTypeID() == ($fippy || $tranixx)) {
$i->AddToHateList($attackerID, 1000);
}
}
# if gnoll(s) exist, set them on player
# $tempScalar = scalar (@fippy);
# quest::say("DEBUG: Fippy $tempScalar");
# if($tempScalar > 0)
# {
# foreach $i(@fippy)
# {
# $i->AddToHateList($attackerID,100);
# }
# }
#
# $tempScalar = scalar (@tranixx);
# quest::say("DEBUG: Tranixx $tempScalar");
# if($tempScalar > 0)
# {
# foreach $i(@tranixx)
# {
# $i->AddToHateList($attackerID,100);
# }
# }
quest::settimer("tmHT", 15);
}
sub castHT
{
my $victim = $mob->GetHateRandom();
quest::say("$victim");
}
The castHT also completely fails for no given reason that I can figure out. Any insight/pointers would be greatly useful!
-Hate
|
 |
|
 |
 |
|
 |

03-25-2011, 09:09 PM
|
Dragon
|
|
Join Date: May 2009
Location: Milky Way
Posts: 539
|
|
I'm not sure what your coding process is but if it involves writing the entire script and then seeing if it works, its probably not a good idea until you are more confident with the code and syntax.
I see many problems with this, such as:
Code:
if($i->GetNPCTypeID() == ($fippy || $tranixx)) {
Is not valid syntax.
Code:
quest::settimer("tmHT", 15);
Yet you have no timer event.
You also pass a string in the signal event and Im not sure if that works(Im too lazy to look) but since you are not using that to pass anything useful(like say the charID so you wouldnt need a charge event), just have it pass a number.
There is probably more but I just skimmed it. I've also had problems with scripts not running if I only use a single # to comment things.
The proper way to debug this script is to back it up and delete everything except one event, then add another, then another, etc. For large events, add them in small pieces until you are sure its going to work.
|
 |
|
 |
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 01:43 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |