Lance MDR Rocket
Green Marine

Posts: 49
Registered: 03-06 |
I'm having a little trouble with the Small scripting engine. Basically I want to set up a monster that will exit my map when killed. I've tried to set it up so that it will measure the creature's health every couple of seconds and exit the level when it reaches zero.
However, the compiler whinges at me when I attempt to set up an integer using the _ThingGetProperty command (so:
static bosshealth = (_ThingGetProperty(69, _THING_HEALTH))) and setting it to a value of 1 or something similar doesn't work properly either (a low value means it exits too soon, a high one makes it not work at all). An attempt to work around the second problem by rechecking the health value every time the script is called hasn't helped either. Can anyone help?
This is the full script in it's final form (ie. before I gave up and went to bed):
public OnInit()
{
//_SectorColormap ("BLDMAP", "_cmap_bottom", 7); Incidently, I'm also having trouble with this. I've tried changing the punctuation, capitalisation etc. etc. around but it refuses to work for me (hence why its commented out). Help?
_SetCallback("StartupTXT", _SWAIT_DELAY, 35);
_SetCallback("Script69", _SWAIT_DELAY, 35);
}
public Script10()
//The Soulsphere Script
{
static bool:spherei = false;
if(!spherei)
{
_Printf(_MSG_CENTER, "Placeholder script here\a");
spherei = true;
}
}
public Script69()
//The exit script (or at least part of it)
{
//_Printf(_MSG_CENTER, "Placeholder script here\a");
static bosshealth = (_ThingGetProperty(69, _THING_HEALTH));
if (bosshealth < 1)
{
_SetCallback("EndGame", _SWAIT_DELAY, 350);
}
bosshealth = (_ThingGetProperty(69, _THING_HEALTH));
_SetCallback("Script69", _SWAIT_DELAY, 35);
}
public StartupTXT()
{
_Printf(_MSG_CENTER, "Welcome to \133The Wicked Shall Perish,\n\139 by Lance MDR Rocket.\a");
}
public EndGame()
{
_ExitLevel();
}
Thanks in advance, and I'm sorry if this is a fairly noob-like question. I'm afraid my grasp on maths and the maths-like disciplines is fairly shaky.
Finally, as a suggestion, would it be possible to update the small_funcref file in the docs .zip to include working examples of each script? I'd really appreciate it.
|