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 Scripting Question
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#1
Question  A Scripting Question

I'm trying to make a local variable integer to check to see if the player picked something up and if they didn't, to display a message once they enter an area.

Eh, here's the code:

void OnStart()
{
AddLocalVarInt("LeverTouchCheck", 0);
SetEntityPlayerInteractCallback("lever_small_lever_1", "LeverCheck", true);
AddEntityCollideCallback("Player", "ScriptArea_4", "MissingLever", true, 1);
}

void MissingLever(string &in asParent, string &in asChild, int alState)
{
If (GetLocalVarInt("LeverTouchCheck") == 0)
{
SetMessage("Message", "Hint04", 4);
}
}

void LeverCheck(string &in asEntity)
{
    SetLocalVarInt("LeverTouchCheck", 1);
}

The error report is confusing... I could have sworn it changed a few times in awkward ways. I hope you can help. :/

04-23-2011, 05:27 AM
Find
laser50 Offline
Member

Posts: 242
Threads: 22
Joined: Apr 2011
Reputation: 0
#2
RE: A Scripting Question

What is the error?
04-23-2011, 10:22 AM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#3
RE: A Scripting Question

You do not use AddLocalVarInt("blabla", 0);
Add means addition (like 1 + 1).
Use SetLocalVarInt("blabla", 0); in your OnStart().

(This post was last modified: 04-23-2011, 12:19 PM by Pandemoneus.)
04-23-2011, 12:19 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#4
RE: A Scripting Question

Well um, thanks for your help. It still didn't work so I just used my own work-around. I never used variables before like this, I'm only used to making them like: "int x = 0;" and then setting it to "x = 1;"

04-23-2011, 03:10 PM
Find




Users browsing this thread: 1 Guest(s)