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 Candle trigger
VillainousPotato Offline
Member

Posts: 50
Threads: 13
Joined: Mar 2013
Reputation: 1
#1
Candle trigger

I'm looking for a script that calls a function when 2 specific candles are lit.But I need it to happen only after both of them are lit. I cant find it in any tutorial but maybe I'm just not looking for it in the right place.

08-10-2013, 03:04 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Candle trigger

You need to set a Local Variable Integer (SetLocalVarInt) then add it (AddLocalVarInt) then check it (If-Else code). The codes you need (it's not the full code. It's just the code to all three stuff) for all three.

Spoiler below!

For the Integer that adds up so that the checker can be done.
void OnStart()
{
SetLocalVarInt("Candles", 0);
//other codes....
}

For the Incrementer that adds the Integer values.
AddLocalVarInt("Candles", 1);

For the checker that checks the two candles.
if(GetLocalVarInt("Candles") == 2)
{
//function caller....
}

else
{
}


"Veni, vidi, vici."
"I came, I saw, I conquered."
08-10-2013, 11:17 AM
Find
VillainousPotato Offline
Member

Posts: 50
Threads: 13
Joined: Mar 2013
Reputation: 1
#3
RE: Candle trigger

(08-10-2013, 11:17 AM)JustAnotherPlayer Wrote: You need to set a Local Variable Integer (SetLocalVarInt) then add it (AddLocalVarInt) then check it (If-Else code). The codes you need (it's not the full code. It's just the code to all three stuff) for all three.

Spoiler below!

For the Integer that adds up so that the checker can be done.
void OnStart()
{
SetLocalVarInt("Candles", 0);
//other codes....
}

For the Incrementer that adds the Integer values.
AddLocalVarInt("Candles", 1);

For the checker that checks the two candles.
if(GetLocalVarInt("Candles") == 2)
{
//function caller....
}

else
{
}

so would i use an interaction callback to call the Adding function?

08-10-2013, 07:40 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#4
RE: Candle trigger

You'll actually need a general callback, something that's pretty versatile for triggering scripts. Here's an example from my script:

SetEntityCallbackFunc("torch_static01_2", "LightTorch");

void LightTorch(string &in asEntity, string &in OnIgnite)
{
AddTimer("", 0.5f, "SwitchTorch");
}

Make sure your function is labelled as "OnIgnite," as above. For other uses, you can put in OnPickup or Break, but I don't have a full list of functions. Smile

(This post was last modified: 08-10-2013, 10:55 PM by Damascus.)
08-10-2013, 10:55 PM
Find
VillainousPotato Offline
Member

Posts: 50
Threads: 13
Joined: Mar 2013
Reputation: 1
#5
RE: Candle trigger

(08-10-2013, 10:55 PM)Damascus Wrote: You'll actually need a general callback, something that's pretty versatile for triggering scripts. Here's an example from my script:

SetEntityCallbackFunc("torch_static01_2", "LightTorch");

void LightTorch(string &in asEntity, string &in OnIgnite)
{
AddTimer("", 0.5f, "SwitchTorch");
}

Make sure your function is labelled as "OnIgnite," as above. For other uses, you can put in OnPickup or Break, but I don't have a full list of functions. Smile
Awesome thanks! It works like a charm after about 100 tries. but i got it! victory is sweet.

08-11-2013, 09:11 AM
Find




Users browsing this thread: 1 Guest(s)