Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

[ZScript] NPCs ignoring int Y?

1 replies · 1,067 views · Started 10 October 2008

import "std.zh"
//bot = enemy id used for bottle
//botx,boty = initial location of bottle
//dm = next dmap
//sc = next screen
//sfx = boss hit sound
ffc script LV2_Boss_Phase_2
{
void run(int bot, int botx, int boty, int dm, int sc, int sfx)
{
npc bottle = Screen->CreateNPC(bot);
bottle->X=botx;
bottle->Y=boty;
bottle->Extend=1;
lweapon hammer;
int currentweaps=Screen->NumLWeapons(); //keeps track of ALL lweapons on the screen (ie bombs, arrows, etc.)
while(true)
{
while(Screen->NumLWeapons()==currentweaps) Waitframe(); //wait until new weapon appears on screen
if(Screen->NumLWeapons()<currentweaps) currentweaps=Screen->NumLWeapons(); //handles other lweapons that disappear
else
{
hammer=Screen->LoadLWeapon(Screen->NumLWeapons()); //load new lweapon
currentweaps=Screen->NumLWeapons(); //update tracking variable
if(hammer->ID==LW_HAMMER) //if lweapon is a hammer
{
Waitframes(15);
while(hammer->isValid())
{
if(Abs(hammer->X-bottle->X)<8 && Abs(hammer->Y-bottle->Y)<8) //if hammer is near enemy
{
Game->PlaySound(sfx);
Waitframes(60);
Link->PitWarp(dm, sc);
}
Waitframe();
}
}
}
}
}
}

Ok, so I tried this script in a blank, default quest file, and it worked flawlessly. I took the same exact script, and put it in my main project, and it still works perfectly, however, the script seems to ignore "bottle->Y=boty;". I've gone back and checked the script dozens of times, and I can't find any error. 😞 So is this a bug, or am I missing something really important?

Edit: Here's the quest file, by the way.
Edit 2: Oh yeah, forgot to mention, in that quest file, the script is active only on screens 9-72 and 9-47.
Edit 3: After a bit of testing, it looks like the only NPCs that do this are jumping enemies, like Tektites and Vires.
Edit 4: It seems there are seperate problems for Vires and Tektites. For Tektites, the problem was that I had the "Enemies can fly/jump through Z-axis" Quest Rule checked. I haven't found the problem with Vires yet.

You're right... the "Enemies Z Axis" rule does cause Tektites/Vires/Pols to overwrite ZScript alterations to Y.

Fixed.