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
Script Help My one scripting weakness
Bennick Offline
Member

Posts: 77
Threads: 27
Joined: Apr 2011
Reputation: 0
#1
My one scripting weakness

I don't understand how to set a delay or something or a timed function. How would I create a repeating function that, on every repeat of the function, it adds 1 to a local variable, for example? could somebody just type that out so I could look at it?

Fratricide (title not finalized): 2/7 maps. :D
10-16-2012, 05:46 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: My one scripting weakness

void OnStart()
{
AddTimer("Repeat", 5, "RepeatTimer") //This creates a timer that calls after 5 seconds
}

void RepeatTimer(string &in asTimer) //The timer
{
if(asTimer == "Repeat")
{
AddLocalVarInt("Repeat", 1); //This adds 1 to the LocalVarInt "Repeat".
AddTimer("Repeat", 5, "RepeatTimer") //This creates a timer that calls after 5 seconds

}

if(GetLocalVarInt("Repeat") == 5) //If the timer has repeated 5 times...
{
Function(); //The stuff you want to do
}
}

Trying is the first step to success.
10-16-2012, 06:26 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#3
RE: My one scripting weakness

I suppose you are talking about timers. When a time passes, something happens, really?
If it's that way, maybe this is useful for you:


http://wiki.frictionalgames.com/hpl2/tut...iferorange
And at the final scare. She uses timers.
Scare 4 - Kill The Lights

Edit: Ninja'd by beecake another time XD

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
(This post was last modified: 10-16-2012, 06:27 PM by The chaser.)
10-16-2012, 06:27 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: My one scripting weakness

(10-16-2012, 06:27 PM)The chaser Wrote: I suppose you are talking about timers. When a time passes, something happens, really?
If it's that way, maybe this is useful for you:


http://wiki.frictionalgames.com/hpl2/tut...iferorange
And at the final scare. She uses timers.
Scare 4 - Kill The Lights

Edit: Ninja'd by beecake another time XD
Sorreeeeeh!...

Trying is the first step to success.
10-16-2012, 08:35 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#5
RE: My one scripting weakness

Off-topic: Doesn't matter. But, ninja me another time, beecake, and I will send you waspsauce.

Worst joke ever XD (not agressive intentions wanted to be shown)

On-Topic: Did you succed, Bennick?

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-16-2012, 08:48 PM
Find




Users browsing this thread: 1 Guest(s)