Hello! Is It possible to use Game.DoOnceOnly more than once in Repeatedly Execute? I could not figure out what I was doing wrong with the script below, there was a (Global) variable check and when it was correct, nothing happened. So eventually I removed the latter DoOnceOnly and made a variable for it instead and now everything works.
But I'm not certain that was the root of what fixed it. To elaborate, when testing it, if I set the game up to execute the first command (the first DoOnceOnly below), first- then everything worked. However if I approached the game play to where the game executes the second instance of DoOnceOnly first, then it would not work, the character wouldn't speak etc.
To summarize if my problem is not related to DoOnceOnly, I am a bit lost. I've tried a few things like making the second command an If statement instead of Else If, playing around with variations of the same basic command for checking inventory, making a variable for when the player takes the inventory item I need to check and checking the variable both with and instead of the inventory item and finally I can't use Room First Load because this needs to take place after the first visit.
Anyway I had said up top I found a work around for this, and I did however I have swappable player characters and sometimes they split up so I'm going to need figure out why this isn't working for the near future
thank you for any advice!
Room Script
Code: ags
But I'm not certain that was the root of what fixed it. To elaborate, when testing it, if I set the game up to execute the first command (the first DoOnceOnly below), first- then everything worked. However if I approached the game play to where the game executes the second instance of DoOnceOnly first, then it would not work, the character wouldn't speak etc.
To summarize if my problem is not related to DoOnceOnly, I am a bit lost. I've tried a few things like making the second command an If statement instead of Else If, playing around with variations of the same basic command for checking inventory, making a variable for when the player takes the inventory item I need to check and checking the variable both with and instead of the inventory item and finally I can't use Room First Load because this needs to take place after the first visit.
Anyway I had said up top I found a work around for this, and I did however I have swappable player characters and sometimes they split up so I'm going to need figure out why this isn't working for the near future

Room Script
function room_RepExec()
{
if (player == cEgo1 && Game.DoOnceOnly("Split Up"))
{
Wait(20);
cEgo2.Say("Words.");
cEgo1.SetAsPlayer();
cEgo2.ChangeRoom(20, 90, 150, eDirectionLeft);
}
else if (player == cEgo2 && Game.DoOnceOnly("Gave Hat") && player.HasInventory(iHatGlow) == true)
{
cEgo2.Say("Words.");
cEgo1.SetAsPlayer();
Hathandoff = true;
}
}