PDA

View Full Version : Script to modify HP crashes Zquest?



C-Dawg
12-29-2006, 09:09 PM
In one room, I have the player direct warp to a boss room. In that room, there is a Ghoma and an FFC running this script. The player hits the warp, the boss music (set on the boss screen) starts to play, but then the screen goes black (before the Ghoma or his screen is visible) and the game crashes.




// ================================================== ====
// BOSS_BOOSTER = This FFC increases the hit points of the
// first NPC so it can be used as a boss.
// D0 = New hit points.
// ================================================== ===


ffc script boss_booster{

void run(int hitpoint_boost)

npc current_enemy = Screen->LoadNPC(1);
current_enemy->HP = hitpoint_boost;

} // end of void run

} // end of script


Any ideas?

C-Dawg
12-30-2006, 11:03 PM
Problem fixed, with Jman's help. The key is this:

ENEMIES ARE NOT PLACED IN A ROOM UNTIL (about) TWO TICS AFTER THE ROOM LOADS.

This means the script I posted only works if you stick three or four Waitframe() BEFORE it loads up an NPC. If you don't use the Waiframe()s, you will crash Zquest at runtime.

Saffith
01-01-2007, 02:55 PM
You can use while(Screen->NumNPCs()<1) Waitframe(); to get the exact frame it appears, I think.