Thread: modifynpcstat?
View Single Post
  #4  
Old 03-22-2014, 01:23 AM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

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


Code:
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
Code:
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#m10822246245352
	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
Code:
permarooted = (runspeed > 0) ? false : true;
mob.h
Code:
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..
Reply With Quote