443.
This test code:
import "std.zh"ffc script enemy{
void run()
{
npc my_enemy = Screen->CreateNPC(NPC_DARKNUT1);
my_enemy->X = 32;
my_enemy->Y = 32;
while(true)
{
if(Link->InputA)
{
my_enemy->Rate = 0;
}
Waitframe();
}
}
}
should set the darknut's walk rate to 0 when Link swings his sword. I find that the darknut does not change walk speed at all, even if I set the Rate to 8 or 32, etc.
http://filer.case.edu/dpf4/npcrate.qst
Here's a test quest. Barring any user error, I think npc->Rate is broke.
Try using Screen->LoadNPC() each frame. I think I read somewhere that the pointers to stuff change each frame.
Using what index??
I'm able to use other npc variables in place of npc->Rate, such as npc->X and npc->Y.
pkmnfrk wrote:Try using Screen->LoadNPC() each frame. I think I read somewhere that the pointers to stuff change each frame.
Yes. This is a long-standing ZScript bug which was previously unfixable due to sprites not having unique IDs; they do now, so I will eventually be changing the item and enemy points to be permanent between frames.
This bug with rates is, however, something entirely different.
Cool. This will help my magnetic glove script. (Stupid enemies are trying to walk while floating. :tongue: )
Were you looking into the Rate bug or putting it on hold? I was a little confused what you meant by "item and enemy points." Pointers?
I will fix it, but it might take me a bit - as you can see there is a backlog of ~3 pages of bugs.
Update: It seems that npc->CSet suffers the same fate. I can't set it after creating an npc with the above method.
Edit: npc->Damage is also broken, although npc->WeaponDamage seems to be OK.
npc->Damage and npc->CSet are fixed.
The documentation is completely wrong about npc->Rate; what you want to use is npc->Step, which I've added.