PDA

View Full Version : Quest help please :)


Osage
05-02-2017, 04:18 PM
The first mob that spawns stands up until the second mob spawns then mob 1 FD's however ONLY the first mob FD's and all subsequent mobs stay standing... any help?

sub EVENT_SPAWN {
my $random_race = quest::ChooseRandom(1,4,6,7,);
my $random_texture = quest::ChooseRandom(1,2);
my $random_weapon = quest::ChooseRandom(1,2,3,7,8,14);
my $random_gender = int(rand(2));

$npc->SetAppearance(3);
quest::npcgender($random_gender);
quest::npcrace($random_race);
quest::npctexture($random_texture);
quest::wearchange(7, $random_weapon);
quest::setanim(101140, 3);
}

sub EVENT_SIGNAL {
if($signal == 1) { #signal from boss to increase damage if players have not killed corpses
quest::signalwith(101109,2,int(rand(5)))
}
}

sub EVENT_DEATH {
quest::signalwith(101109,3,int(rand(5))) #were signaling back that this corpse has been killed and it will reduce boss damage
}

Edit: added the reduntant quest::setanim(101140, 3); to try and troubleshoot but still isnt working.

atomic
05-02-2017, 04:27 PM
i maybe wrong but isnt a NPC autostand when in combat? so sitting option would be in database but would autostand when its fighting.

Osage
05-02-2017, 04:34 PM
The mobs in question aren't meant to engage. While I was testing this all mobs were out of combat and simply spawned no further action was taken by or against the mobs.
That may very well have something to do with it just not sure how they would be put in combat without something in the script telling them to do so.

Thanks for the reply though appreciate all the help I can get!

joligario
05-02-2017, 06:19 PM
Put in a 1-3 second delay from spawn to set an appearance.

Osage
05-02-2017, 07:01 PM
Ok so I applied the changes you suggested joligario and am having the same issue just a little different. Will try and explain a little better this time.

https://ibb.co/g5vZAk

I am attempting to have King Gragnar in The Warrens spawn "a fallen adventurer" to draw power from as he is a Shadowknight. Here is what happens when I engage him:

Mob 1 spawns and is standing

Mob 2 spawns and causes Mob 1 to FD while Mob 2 remains standing

Mob 3 spawns and causes Mob 2 to FD while Mob 3 remains standing

Mob 4 spawns and causes Mob 3 to FD while Mob 4 remains standing

This is where it gets weird

Mob 5 spawns and DOES NOT cause Mob 4 to FD while Mob 5 remains standing.

Subsequent mobs do not cause the previous mob to FD and do not FD themselves.

Here is the code:
sub EVENT_SPAWN {
my $random_race = quest::ChooseRandom(1,4,6,7,);
my $random_texture = quest::ChooseRandom(1,2);
my $random_weapon = quest::ChooseRandom(1,2,3,7,8,14);
my $random_gender = int(rand(2));

quest::pause(3);
quest::npcgender($random_gender);
quest::npcrace($random_race);
quest::npctexture($random_texture);
quest::wearchange(7, $random_weapon);
quest::setanim(101140, 3);
}

sub EVENT_SIGNAL {
if($signal == 1) { #signal from boss to increase damage if players have not killed corpses
quest::signalwith(101109,2,int(rand(5)))
}
}

sub EVENT_DEATH {
quest::signalwith(101109,3,int(rand(5))) #were signaling back that this corpse has been killed and it will reduce boss damage
}

I am trying to have them FD upon spawn without the need for another mob to "trigger" them FD'ing. Pretty stumped here :/

Osage
05-02-2017, 07:14 PM
King Gragnar code:

sub EVENT_COMBAT {
if($combat_state == 1) {
quest::say("You won't be the first to desecrate the halls of my ancestors.");
quest::settimer("dostuff",int(rand(24)) + 1);
quest::settimer("spawncorpse",1);
}
elsif($combat_state == 0) {
$npc->SetHP($npc->GetMaxHP());
quest::depopall(101140);
quest::stoptimer("dostuff");
quest::stoptimer("spawncorpse");
}
}

sub EVENT_DEATH {
quest::stoptimer("dostuff");
quest::stoptimer("spawncorpse");
quest::depopall(101140);
quest::say("My ancestors will make you pay for this intrusion.");
}

sub EVENT_TIMER {
if($timer == "dostuff") {
quest::stoptimer("dostuff");
quest::emote("begins to draw power from his deceased victims.");
quest::signalwith(101140,1,0); #signal 1 to adventurercorpse for damage increase.. if alive they signal back signal 2
quest::settimer("dostuff",int(rand(24)) + 1);
}
if($timer == "spawncorpse") {
quest::stoptimer("spawncorpse");
quest::spawn2(101140,0,0,$x + int(rand(35)),$y + int(rand(35)),$z,0);
quest::settimer("spawncorpse",int(rand(24)) + 1);
}
}


sub EVENT_SIGNAL {
if($signal == 2) { #Players didn't kill corpses.. increase min/max damage by 10/25 respectively
quest::modifynpcstat("min_hit", $npc->GetMinDMG() + 10);
quest::modifynpcstat("max_hit", $npc->GetMaxDMG() + 25);
}
if($signal == 3) { #Player killed corpse reducing damage
quest::modifynpcstat("min_hit", $npc->GetMinDMG() - 10);
quest::modifynpcstat("max_hit", $npc->GetMaxDMG() - 25);
quest::emote("has lost a portion of his stolen power.");
}
}

Kingly_Krab
05-02-2017, 08:08 PM
You can actually do #npcedit setanimation 3 so they spawn feigned. Also, you were missing semi-colons and had an extra comma within your array at the top.

Here's your feigned NPC: sub EVENT_SPAWN {
quest::npcgender(int(rand(2)));
quest::npcrace(quest::ChooseRandom(1, 4, 6, 7));
quest::npctexture(quest::ChooseRandom(1, 2));
quest::wearchange(7, quest::ChooseRandom(1. .3, 7, 8, 14));
}

sub EVENT_SIGNAL {
if ($signal == 1) {
quest::signalwith(101109, 2, int(rand(5)));
}
}

sub EVENT_DEATH {
quest::signalwith(101109, 3, int(rand(5)));
}Here's your boss: sub EVENT_COMBAT {
if ($combat_state == 1) {
quest::say("You won't be the first to desecrate the halls of my ancestors.");
quest::settimer("dostuff", int(rand(24)) + 1);
quest::settimer("spawncorpse", 1);
} else {
$npc->SetHP($npc->GetMaxHP());
quest::depopall(101140);
quest::stoptimer($_) for ("dostuff", "spawncorpse");
}
}

sub EVENT_DEATH {
quest::stoptimer("dostuff");
quest::stoptimer("spawncorpse");
quest::depopall(101140);
quest::say("My ancestors will make you pay for this intrusion.");
}

sub EVENT_TIMER {
if ($timer eq "dostuff") {
quest::stoptimer("dostuff");
quest::emote("begins to draw power from his deceased victims.");
quest::signalwith(101140, 1, 0);#
signal 1 to adventurercorpse
for damage increase..if alive they signal back signal 2
quest::settimer("dostuff", int(rand(24)) + 1);
} elsif($timer eq "spawncorpse") {
quest::stoptimer("spawncorpse");
quest::spawn2(101140, 0, 0, ($x + int(rand(35))), ($y + int(rand(35))), $z, 0);
quest::settimer("spawncorpse", int(rand(24)) + 1);
}
}

sub EVENT_SIGNAL {
if ($signal == 2) {
quest::modifynpcstat("min_hit", $npc->GetMinDMG() + 10);
quest::modifynpcstat("max_hit", $npc->GetMaxDMG() + 25);
} elsif($signal == 3) {
quest::modifynpcstat("min_hit", $npc->GetMinDMG() - 10);
quest::modifynpcstat("max_hit", $npc->GetMaxDMG() - 25);
quest::emote("has lost a portion of his stolen power.");
}
}These are completely untested, but give them a try and let me know.


Post-note: You don't have to define a variable for quest::ChooseRandom(), the return type is automatic so you can use it within methods.
Also, "==" is the numeric equality operator, "eq" is the string equality operator. Not that it really matters, but once you get in to more advanced code this may cause some issues (trust me).

Osage
05-02-2017, 08:31 PM
Ok so the script you provided works just as the other did and is much cleaner so thank you for that!

However, when I did a #npcedit setanimation 3 on my feigned mobs I get the message "NPCID 101140 now has the animation set to 3 on spawn with spawngroup 0".

When I type the command Mob 1 falls down but when I spawn another Mob 2 is still standing... Do I need to assign a spawngroup for these mobs for it to work?

https://ibb.co/h8ybO5

Kingly_Krab
05-02-2017, 08:42 PM
Ah shit, my bad. I forgot the animation was spawngroup specific. You could simply have the boss script enable the spawn groups for these NPCs if you wanted. Or you could return to your old method of signalling them.

Osage
05-02-2017, 08:56 PM
Forgive my noobishness on this one and correct me if I am wrong but would a spawngroup work for what the script is trying to do, i.e spawn a mob at a random point near the boss? Would the boss script option support a random spawn point I dont want to eliminate the randomness of the mobs as the fight can last an unknown amount of time therefore an unknown amount of mobs can spawn?

Also I attempted to revert to my old method of enabling the animation in the script but it is back to its old tricks where the spawned mob waits for another mob to spawn before actually FD'ing and it seems only the first mob spawned is FD'ing while the others are still standing regardless of how many spawn.

Kingly_Krab
05-02-2017, 09:00 PM
Spawngroups can have variable X/Y axes, meaning you can just enable the spawn groups as you see fit and they'll spawn between a random X and Y.

http://wiki.eqemulator.org/p?Spawngroup for reference.

Osage
05-02-2017, 09:32 PM
Ok so I am trying to figure this out and for the life of me I cannot find my custom NPC's in my DB in regard to their Spawngroupid. I am using #npcspawn create 1 to assign a spawngroup and it has worked fine doing it in game but now since I already have the feigned npc created it will not let me use that command I get the error "duplicate entry for key name a_fallen_adventurer".

So I try to manually create it in the DB and low and behold I cant even find the spawngroups I have been creating for my other custom NPC's, I searched in spawn2, spawngroup, spawnentry, and cannot find the custom spawngroups I have already made. When I use the command #npcspawn create 1 where do they go?

I can just delete the NPC and do it my old way for now but I would like to know where these spawngroups go in the DB for future reference.

And one last thing if I am fortunate enough to have your ear again Kingly is quest::enable_spawn2(spawn2_id) the correct function to use in my script and what are the values I am supposed to use in the spawngroup for variable X/Y's? I looked at the reference you supplied but it just gives default values.

Once again sorry for the noobishness but I am trying to teach myself and struggling at the moment if you couldn't tell :D

Osage
05-02-2017, 10:06 PM
Ok I figured out how to find the spawngroup in the spawngroup table sorry if anyone hurt their forehead slapping it while looking at my previous post lol. My results were limited to 100,000 so they weren't showing up a simple filter solved that problem.

sub EVENT_COMBAT {
if ($combat_state == 1) {
quest::say("You won't be the first to desecrate the halls of my ancestors.");
quest::settimer("dostuff", int(rand(24)) + 1);
quest::settimer("spawncorpse", 1);
} else {
$npc->SetHP($npc->GetMaxHP());
quest::depopall(101140);
quest::stoptimer($_) for ("dostuff", "spawncorpse");
}
}

sub EVENT_DEATH {
quest::stoptimer("dostuff");
quest::stoptimer("spawncorpse");
quest::depopall(101140);
quest::say("My ancestors will make you pay for this intrusion.");
}

sub EVENT_TIMER {
if ($timer eq "dostuff") {
quest::stoptimer("dostuff");
quest::emote("begins to draw power from his deceased victims.");
quest::signalwith(101140, 1, 0);# signal 1 to adventurercorpse for damage increase..if alive they signal back signal 2
quest::settimer("dostuff", int(rand(24)) + 1);
} elsif($timer eq "spawncorpse") {
quest::stoptimer("spawncorpse");
quest::enable_spawn2(275122); # Enables this spawn group to start spawning again once the respawn timer is up for it.
quest::settimer("spawncorpse", int(rand(24)) + 1);
}
}

sub EVENT_SIGNAL {
if ($signal == 2) {
quest::modifynpcstat("min_hit", $npc->GetMinDMG() + 10);
quest::modifynpcstat("max_hit", $npc->GetMaxDMG() + 25);
} elsif($signal == 3) {
quest::modifynpcstat("min_hit", $npc->GetMinDMG() - 10);
quest::modifynpcstat("max_hit", $npc->GetMaxDMG() - 25);
quest::emote("has lost a portion of his stolen power.");
}
}

So I implemented the spawngroup function and created a spawngroup for my feigned NPC's. I cant figure out however how to get the NPC's to spawn at random... Am I going to have to create multiple spawn locations for this spawngroup and if so how do I get the script to choose just 1 at random intervals in the fight?