Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A little understanding needed...
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#3
RE: A little understanding needed...

RandInt + Var's seems like the easiest thing:


void OnStart()
{
SetLocalVarInt("RandomEvent", 0);
///add whatever other callback to set the timers, etc
}

/*
Assuming you have a basic timer set up and it is called, you can do something like this:
*/

void timer_name(string &in asTimer)
{
AddLocalVarInt("RandomEvent", RandInt(1,4));

if(GetLocalVarInt("RandomEvent") == 1)
{
event1();
}
if(GetLocalVarInt("RandomEvent") == 2)
{
event2();
}
if(GetLocalVarInt("RandomEvent") == 3)
{
event3();
}
if(GetLocalVarInt("RandomEvent") == 4)
{
event4();
}
}

void event1()
{
///do event 1 stuff
}

void event2()
{
///do event 2 stuff
}

void event3()
{
///do event 3 stuff
}

void event4()
{
///do event 4 stuff
}


Hope that helped! Also, instead of calling each function like "void event4()", you could put the event stuff inside the if statement to avoid clutter. I just add the extra step to help organize.

I rate it 3 memes.
09-10-2012, 08:11 AM
Find


Messages In This Thread
A little understanding needed... - by KingWolf - 09-10-2012, 08:03 AM
RE: A little understanding needed... - by Robby - 09-10-2012, 08:10 AM
RE: A little understanding needed... - by Adny - 09-10-2012, 08:11 AM
RE: A little understanding needed... - by Robby - 09-10-2012, 08:16 AM
RE: A little understanding needed... - by Robby - 09-10-2012, 08:25 AM
RE: A little understanding needed... - by Robby - 09-10-2012, 08:43 AM



Users browsing this thread: 1 Guest(s)