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
[Help] Envy the Dead Developemt & Scripting Questions
plutomaniac Offline
Super Moderator

Posts: 6,368
Threads: 45
Joined: May 2011
Reputation: 183
#30
RE: [Help] Envy the Dead Developemt & Scripting Questions

Is there a way to add 1 to a global variable? I tried many things and this is the best I have though to do so far:

PHP Code: (Select All)
int tempvar 0;

void OnStart()
{  
    
AddGlobalVarInt("globalvar"0);
    
tempvar GetGlobalVarInt("globalvar");

    
SetEntityCallbackFunc("paper01""Something");
}

void Something(string &in entitystring &in type)
{
    if(
entity == "paper01")
    {
        
SetGlobalVarInt("globalvar"tempvar++);
    }


EDIT: Go it! This works instead:

PHP Code: (Select All)
void Something(string &in entitystring &in type)
{
    if(
entity == "paper01")
    {
        
tempvar++;
        
SetGlobalVarInt("globalvar"tempvar);
    }

(This post was last modified: 03-21-2013, 08:08 PM by plutomaniac.)
03-21-2013, 08:03 PM
Find


Messages In This Thread
RE: [Help] Envy the Dead Developemt & Scripting Questions - by plutomaniac - 03-21-2013, 08:03 PM



Users browsing this thread: 3 Guest(s)