I tried adding the display() function to Game.DoOnceOnly() and could not figure out how its supposed to be done.
Anyone know by chance?
function room_Load()
{
//Guards
object[2].SetView(94, 0);
object[3].SetView(25, 0);
}
function region1_WalksOnto()
{
if (Game.DoOnceOnly("Be careful sir, Most do not return from the harsh desert ahead!")) {
}
//Display("Be careful sir, Most do not return from the harsh desert ahead!");
object[2].Animate(0, 5, eOnce, eNoBlock);
object[3].Animate(0, 5, eOnce, eNoBlock);
}
This is for two guards who guard a door and they move their spears aside when you walk upon the region.
Thanks a mill in advance!
-Jared
Here's an example of how I have used it. ReallySlug is the key word that AGS checks for, if it has not been used it will run the condition under it, otherwise if it has been used once already, it will run the else further below. Use any name you want, just make sure you never use the same one twice.
I'm no super scripter, but this should help.
function hControls_Interact()
{
if(Game.DoOnceOnly("ReallySlug"))
{
cMoss.Walk(331, 303, eBlock, eWalkableAreas);
cMoss.FaceLocation(331, 0, eBlock);
cSlug.FaceLocation(1340, 303, eBlock);
cSlug.Say("Really? ");
}
else
{
cSlug.Say("I better leave it alone.");
}
}
It's been a while since I played around with AGS and for some reason I'm having an issue placing this as code. (Fixed -Snarky)
Thanks my friend, That does the trick!
God bless!
-Jared
Why did you leave the { } block empty...? And why is this in Advanced...?
Good point. Moved.