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

Script to modify HP crashes Zquest?

2 replies · 1,596 views · Started 30 December 2006

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?

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.

You can use [font="Courier New"]while(Screen->NumNPCs()<1) Waitframe();[/font] to get the exact frame it appears, I think.