DelayCommand isn't working when set to 60.0
Tonden
Member Posts: 224
Hi all I have a script here that if I set the following line to 2.0 it works with no problem I have tested it over and over, However I can't get it to work at 10.0 and I want it set at 60.0
DelayCommand(60.0, AllOut(oARENA, oAREA));
It there something wrong with NWN-EE when it comes to setting scripts on a larger Delay?
Here is the script which this line is from
void AllOut(object oARENA, object oAREA)
{
object oEXIT = GetObjectByTag("Arena_Door");
DeleteLocalInt(oARENA, "MOBS_COUNT");
object oPC = GetFirstPC();
while (oPC != OBJECT_INVALID)
{
if (GetArea(oPC) == oAREA)
{
if (GetLocalInt(oPC, "GLADIATOR") == TRUE) AssignCommand(oPC, JumpToObject(oEXIT));
DeleteLocalInt(oPC, "GLADIATOR");
}
oPC = GetNextPC();
}
}
void main()
{
object oARENA = GetWaypointByTag("arena_fight");
object oAREA = GetArea(oARENA);
int nMOBS = GetLocalInt(oARENA, "MOBS_COUNT");
if (nMOBS > 1) SetLocalInt(oARENA, "MOBS_COUNT", nMOBS - 1);
else
{
string sTXT = "They did it! A round of applause for our champions! Contestants have 1 minute to leave the arena.";
object oPC = GetFirstPC();
while (oPC != OBJECT_INVALID)
{
if (GetArea(oPC) == oAREA) FloatingTextStringOnCreature(sTXT, oPC, FALSE);
oPC = GetNextPC();
}
DelayCommand(60.0, AllOut(oARENA, oAREA));
}
}
Thanks for your time.
DelayCommand(60.0, AllOut(oARENA, oAREA));
It there something wrong with NWN-EE when it comes to setting scripts on a larger Delay?
Here is the script which this line is from
void AllOut(object oARENA, object oAREA)
{
object oEXIT = GetObjectByTag("Arena_Door");
DeleteLocalInt(oARENA, "MOBS_COUNT");
object oPC = GetFirstPC();
while (oPC != OBJECT_INVALID)
{
if (GetArea(oPC) == oAREA)
{
if (GetLocalInt(oPC, "GLADIATOR") == TRUE) AssignCommand(oPC, JumpToObject(oEXIT));
DeleteLocalInt(oPC, "GLADIATOR");
}
oPC = GetNextPC();
}
}
void main()
{
object oARENA = GetWaypointByTag("arena_fight");
object oAREA = GetArea(oARENA);
int nMOBS = GetLocalInt(oARENA, "MOBS_COUNT");
if (nMOBS > 1) SetLocalInt(oARENA, "MOBS_COUNT", nMOBS - 1);
else
{
string sTXT = "They did it! A round of applause for our champions! Contestants have 1 minute to leave the arena.";
object oPC = GetFirstPC();
while (oPC != OBJECT_INVALID)
{
if (GetArea(oPC) == oAREA) FloatingTextStringOnCreature(sTXT, oPC, FALSE);
oPC = GetNextPC();
}
DelayCommand(60.0, AllOut(oARENA, oAREA));
}
}
Thanks for your time.
0
Comments
void SpawnMonsters(object oARENA, int nHD, int nPARTY)
{
object oSPAWN = GetWaypointByTag("arena_spawn");
location lMOB = GetLocation(oSPAWN);
string sMOB = "NW_RAT001";
object oMOB;
int nMOB;
while (nMOB < nPARTY)
{
oMOB = CreateObject(OBJECT_TYPE_CREATURE, sMOB, lMOB);
SetEventScript(oMOB, EVENT_SCRIPT_CREATURE_ON_DEATH, "arena_death");
nMOB = nMOB + 1;
}
SetLocalInt(oARENA, "MOBS_COUNT", nMOB);
}
void main()
{
object oPC = GetPCSpeaker();
object oARENA = GetWaypointByTag("arena_fight");
if (GetLocalInt(oARENA, "MOBS_COUNT") > 0)
{
FloatingTextStringOnCreature("There's a fight going on at the arena. Wait until the current gladiators are done.", oPC, FALSE);
return;
}
object oITEM = GetItemPossessedBy(oPC, "arenapass");
if ( oITEM == OBJECT_INVALID)
{
FloatingTextStringOnCreature("You need a special pass to enter the arena.", oPC, FALSE);
return;
}
int nHD;
int nPARTY;
object oPARTY = GetFirstFactionMember(oPC);
while (oPARTY != OBJECT_INVALID)
{
nPARTY = nPARTY + 1;
nHD = nHD + GetHitDice(oPARTY);
SetLocalInt(oPARTY, "GLADIATOR", TRUE);
AssignCommand(oPARTY, JumpToObject(oARENA));
oPARTY = GetNextFactionMember(oPC);
}
DestroyObject(oITEM);
DelayCommand(0.0f, SpawnMonsters(oARENA, nHD, nPARTY));
}
Ultimately you probably want to move the delaycommand and related processing out of ondeath and into say a userdefined event on an 'arenacontroller' object. Your creature ondeath code can then just call signalevent to notify the controller of a creature death and the controller can run the delaycommand as appropriate.
Others may have different/better approaches :-)