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
If the lamp is lit, monster deactivates ?
Nice Offline
Posting Freak

Posts: 3,812
Threads: 37
Joined: Jan 2012
Reputation: 153
#1
If the lamp is lit, monster deactivates ?

Hey all, so i've run into a little problem..

what would the script look like if i wanted to make it that when the player lits a candle, it deactivates a monster ?

i dont think SetEntityPlayerInteractCallback would work, because then the player would deactivate the monster just by clicking on the candle without setting it lit (no tinderboxes)

i'm preety basic with scripting so... i have no idea how to make it work.

edit: so i tried messing around with the "if statement" to see if i could use it but all i got was a bunch of errors xD this is what i tried

void warning(string &in asTimer) //candle off in opozorilo
{
PlaySoundAtEntity("", "guardian_activated.snt", "Player", 0, false);
SetLampLit("candlestick01_1", false, true);
StartScreenShake(0.1f, 0.1f, 1.0f, 1.0f);
if(SetLampLit("candlestick01_1") == false)
{
SetMessage("DONTKNOWIFWORKS", 10);
}
else
{
SetEntityActive("closetgrunt", true);
ShowEnemyPlayerPosition("closetgrunt");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("closetgrunt1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_9", 0, "");
AddTimer("", 10, "open");
}
}

so yeah, here i wanted to test i know how to use "if statement".. what i wanted to achieve was that if the candle was NOT lit i get the message "DONTKNOWIFWORKS" otherwise.. well you can see the rest Smile


Sorry but we cannot change your avatar as the new avatar you specified is too big. The maximum dimensions are 80x80 (width x height)
(This post was last modified: 03-02-2013, 12:35 PM by Nice.)
03-02-2013, 12:01 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: If the lamp is lit, monster deactivates ?

I don't even know what is wrong. Btw, why did you use show player position? This WILL make the patrol nodes useless.
EDIT:
Btw, how do i make multiple lamps lit/unlit?

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 03-02-2013, 12:41 PM by PutraenusAlivius.)
03-02-2013, 12:40 PM
Find
No Author Offline
Posting Freak

Posts: 962
Threads: 10
Joined: Jun 2012
Reputation: 13
#3
RE: If the lamp is lit, monster deactivates ?

Can you show the full script for the lamp ?

(03-02-2013, 12:40 PM)JustAnotherPlayer Wrote: I don't even know what is wrong. Btw, why did you use show player position? This WILL make the patrol nodes useless.
EDIT:
Btw, how do i make multiple lamps lit/unlit?
Here :
PHP Code: (Select All)
SetLampLit("///NAME////"falsetrue); 
To turn off lamp.
PHP Code: (Select All)
SetLampLit("///NAME///"truetrue); 
To turn on lamp.

[Image: the-cabin-in-the-woods-masked-people.jpg]
(This post was last modified: 03-02-2013, 12:44 PM by No Author.)
03-02-2013, 12:42 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: If the lamp is lit, monster deactivates ?

I suppose this is only going to happen once?
That sounds pretty easy. What you need is a function for when the monster spawns (Which you already has) and a function for despawning it.

Good. So spawn the monster and unlit the candle when you want to in the script.
Then, create a callback function called: SetEntityCallbackFunc.
This function is pretty cool.

Good so in your script you make it like this:

void CALLBACKFUNC(string &in asEntity, string &in asType)
{
if(asType == OnIgnite)
{
//Despawn monster
}
}

Trying is the first step to success.
(This post was last modified: 03-02-2013, 01:02 PM by FlawlessHappiness.)
03-02-2013, 01:01 PM
Find




Users browsing this thread: 1 Guest(s)