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
[SOLVED]Variables & if
Omenapuu Offline
Junior Member

Posts: 31
Threads: 8
Joined: Oct 2013
Reputation: 1
#8
RE: Variables & if

(01-01-2015, 02:44 PM)Daemian Wrote:
(01-01-2015, 06:05 AM)Mudbill Wrote: I believe an undeclared variable is automatically set to 0 when used. At least that's the case with AddLocalVarInt. Unsure about the Getter, but either way, if it is undeclared or 0 it will still pass the if statement because it only asks if it ISN'T 1, which is true. I see nowhere that sets this value to 1, making the if statement quite useless.
I thought an undeclared variable -using GetLocalVarInt- blocked the code without raising error.
Just try, put SetLocalVarInt("var1", 2); in your OnStart() function. Then try to trigger that scare1, see if it works.

Yeah, it worked. So the problem is in changing the variable. I'll try to figure them out, but if you can help then here's the code:
PHP Code: (Select All)
AddEntityCollideCallback("Player""ScriptArea_3""var1"true1);
void var1(string &in asParentstring &in asChildint alState)
{
    
SetLocalVarInt("VARIABLE"3);


Here's the area: [Image: 4ce59ce01b6db826a47ddbcb4c0328eb.png]

The one in front of the empty door, down left, is the ScriptArea_3.
(This post was last modified: 01-01-2015, 04:53 PM by Omenapuu.)
01-01-2015, 04:50 PM
Find


Messages In This Thread
[SOLVED]Variables & if - by Omenapuu - 12-31-2014, 02:38 PM
RE: Variables & if - by DnALANGE - 12-31-2014, 03:04 PM
RE: Variables & if - by Omenapuu - 12-31-2014, 10:07 PM
RE: Variables & if - by Daemian - 01-01-2015, 05:23 AM
RE: Variables & if - by Mudbill - 01-01-2015, 06:05 AM
RE: Variables & if - by Omenapuu - 01-01-2015, 12:21 PM
RE: Variables & if - by Daemian - 01-01-2015, 02:44 PM
RE: Variables & if - by Omenapuu - 01-01-2015, 04:50 PM
RE: Variables & if - by Omenapuu - 01-01-2015, 06:11 PM
RE: [SOLVED]Variables & if - by Mudbill - 01-01-2015, 07:54 PM



Users browsing this thread: 3 Guest(s)