PDA

View Full Version : modifynpcstat?


Esildor
03-21-2014, 01:48 PM
Greetings,

Was trying to add a


quest::modifynpcstat("runspeed","1");


to one of my scripts, has some adds and I don't like him being permarooted (aggro is a pain for the tank, trying to tank adds and remain close enough to boss so they're top on aggro).

Is there a reason this modifynpcstat doesn't work? Does it matter what sub EVENT it's under? I'm trying to add it under the sub EVENT_TIMER portion of my quest.

Thanks!

NatedogEZ
03-21-2014, 09:59 PM
Doesn't capitalization matter on the quest functions?

If so.. inside the source its written like this...

quest::ModifyNPCStat("runspeed", 1);

Esildor
03-22-2014, 01:09 AM
Doesn't capitalization matter on the quest functions?

If so.. inside the source its written like this...

quest::ModifyNPCStat("runspeed", 1);

Not it, I have other parts in the same script that are:

quest::modifynpcstat("special_attacks","ABHGZ");

I tried it with capitalization and it still doesn't work.

NatedogEZ
03-22-2014, 01:23 AM
figured it out... if an NPC starts with 0 runspeed in database... no matter how many times you try to edit it with ... ModifyNPCStat it will never change!

So set the NPCs runspeed to 1 or somtehing... and on spawn modifynpcstat it to 0 ... then use whatever timer you need to edit it.

Not sure why it works like this.. but meh



sub EVENT_SPAWN {
$npc->ModifyNPCStat("runspeed", 0);
quest::settimer("ass", 5);
}

sub EVENT_TIMER {
if($timer eq "ass")
{
quest::shout("I am awesome!");
$npc->ModifyNPCStat("runspeed", 10);
}
}



Decided to look it up... and inside mob there is this....

mob.cpp

float Mob::_GetMovementSpeed(int mod) const {
// List of movement speed modifiers, including AAs & spells:
// http://everquest.allakhazam.com/db/item.html?item=1721;page=1;howmany=50#m10822246245 352
if (IsRooted())
return 0.0f;




inside mob.cpp it seems to also add a flag called "permarooted" if an NPC has 0 runspeed in database (means it cant be altered unless there is another function that I do not know about to remove this flag?)

mob.cpp

permarooted = (runspeed > 0) ? false : true;


mob.h

inline const bool IsRooted() const { return rooted || permarooted; }



So.. the IsRooted() is called and puts runspeed back to 0 since it has that permarooted flag :(

So ghetto way to do it works at least... start npc with 1 runspeed.. then set to 0 upon spawn.. then later in the script you can edit the NPCs runspeed..

Esildor
03-22-2014, 01:54 AM
Nate,

Currently my script is this:


#Ghaud

sub EVENT_SPAWN {
quest::setnexthpevent(76);

sub EVENT_HP {
if($hpevent == 76) {
quest::settimer(1,120);
quest::spawn2(9980002,0,0,580,-784.5,-35.6,190);
quest::spawn2(9980002,0,0,580,-844.5,-27.3,190);
quest::spawn2(9980002,0,0,520,-784.5,-35.4,190);
quest::spawn2(9980002,0,0,520,-844.5,-39.7,190);
quest::modifynpcstat("special_attacks","ABHGZ");
quest::emote("ports away and releases his minions!");
quest::shout("Ha, lets see how you do against my minions!");
$npc->GMMove(472.4,-684.9,-28.5,130.5);
$npc->TempName("Ghaud (Invulnerable)");
}
if($hpevent == 51) {
quest::settimer(2,120);
quest::spawn2(9980002,0,0,580,-784.5,-35.6,190);
quest::spawn2(9980002,0,0,580,-844.5,-27.3,190);
quest::spawn2(9980002,0,0,520,-784.5,-35.4,190);
quest::spawn2(9980002,0,0,520,-844.5,-39.7,190);
quest::modifynpcstat("special_attacks","ABHG");
quest::emote("ports away and releases his minions!");
quest::shout("Argh, help me my minions!");
$npc->GMMove(472.4,-684.9,-28.5,130.5);
$npc->TempName("Ghaud (Invulnerable)");
}
if($hpevent == 26) {
quest::settimer(3,120);
quest::spawn2(9980002,0,0,580,-784.5,-35.6,190);
quest::spawn2(9980002,0,0,580,-844.5,-27.3,190);
quest::spawn2(9980002,0,0,520,-784.5,-35.4,190);
quest::spawn2(9980002,0,0,520,-844.5,-39.7,190);
quest::modifynpcstat("special_attacks","ABHG");
quest::emote("ports away and releases his minions!");
quest::shout("Minions, this is our last stand!");
$npc->GMMove(472.4,-684.9,-28.5,130.5);
$npc->TempName("Ghaud (Invulnerable)");
}
}
sub EVENT_TIMER {
if($timer == 1) {
quest::stoptimer(1);
$npc->GMMove(540,-814.4,-39.5,192);
quest::modifynpcstat("special_attacks","ST");
quest::setnexthpevent(51);
quest::emote("returns to battle.");
$npc->TempName("Ghaud");
}
if($timer == 2) {
quest::stoptimer(2);
$npc->GMMove(540,-814.4,-39.5,192);
quest::modifynpcstat("special_attacks","ST");
quest::setnexthpevent(26);
quest::emote("returns to battle.");
$npc->TempName("Ghaud");
}
if($timer == 3) {
quest::stoptimer(3);
$npc->GMMove(540,-814.4,-39.5,192);
quest::modifynpcstat("special_attacks","ST");
quest::emote("returns to battle.");
$npc->TempName("Ghaud");
}
}
sub EVENT_DEATH {
quest::depopall(9980002);
quest::emote("minions disappear.");
}
}


Would you just change the NPCs run speed to 1 in the DB, and then in the very beginning make:


sub EVENT_SPAWN {
quest::setnexthpevent(76);
quest::modifynpcstat("runspeed", 0);


Then I will just add a runspeed modify line to every portion of him moving throughout the script to make sure he's either moving or not moving when I want him to be?

NatedogEZ
03-22-2014, 01:56 AM
Yes that is correct... set runspeed to 1 in database and change runspeed to 0 when it spawns

Esildor
03-22-2014, 02:03 AM
Yes that is correct... set runspeed to 1 in database and change runspeed to 0 when it spawns

So I actually don't want his speed to be 0 when he spawns, so, that's fine.

I changed it to 1 in the database, basically what the boss does is ports away at 76, 51, 26 and adds spawn .. he's supposed to remain "invulnerable" and perma rooted where he gets moved to and not be part of the fight until after the timer goes down. I THINK it's modifying his run speed when it moves him away to 0, but then he's like warping back on top of me .. weird

Edit: Yeah. I don't think you can play with runspeed from 0 to 1 or 1 to 0. With having him start at 0(in DB) you can't add runspeed(as you figured out) and it seems when you have it start at runspeed of 1(in DB) and then try to make his runspeed 0 via modifynpcstat it's making it warp onto me.