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


Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Scripting Question
Author Message
Kyle Offline
Posting Freak

Posts: 911
Joined: Sep 2010
Reputation: 7
Post: #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 all posts by this user Quote this message in a reply
laser50 Offline
Member

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

What is the error?
04-23-2011 10:22 AM
Find all posts by this user Quote this message in a reply
Pandemoneus Offline
Senior Member

Posts: 328
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Kyle Offline
Posting Freak

Posts: 911
Joined: Sep 2010
Reputation: 7
Post: #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 all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)