DoOnce region help

Started by Construed, Tue 21/01/2014 00:54:58

Previous topic - Next topic

Construed

I tried adding the display() function to Game.DoOnceOnly() and could not figure out how its supposed to be done.
Anyone know by chance?

Code: ags

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
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

NickyNyce

#1
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.

Code: AGS
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)

Construed

Thanks my friend, That does the trick!
God bless!

-Jared
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Khris

Why did you leave the { } block empty...? And why is this in Advanced...?

Snarky


SMF spam blocked by CleanTalk