Skip to content

DelayCommand isn't working when set to 60.0

TondenTonden Member Posts: 224
edited August 2018 in Builders - Scripting
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.





Comments

  • PhantasmaPhantasma Member Posts: 79
    What is running that script and does it still exist after 10 seconds? e.g. an OnDeath script probably wouldnt be a safe place to run it
  • TondenTonden Member Posts: 224
    /This is the subroutine that spawns monsters in quantity and strength according to the level and number of gladiators.
    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));
    }
  • PhantasmaPhantasma Member Posts: 79
    So it looks like - and i cant be sure because im ar work on my phone :-) - like you are running that delaycommand from a creatures ondeath script which probably wont work because the creagure you want to run the delaycommand has disappeared from the game after a few seconds. You could prove this by setting the creatures 'corpse decay time' to 90 seconds and the 60 second delay will probably work.

    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 :-)
Sign In or Register to comment.