The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
Question about using global variables
ggstarfoxxie Offline
Junior Member

Posts: 36
Threads: 9
Joined: Aug 2011
Reputation: 2
#1
Question  Question about using global variables

I'm having trouble with a function in one map that needs to check if a player has a key from another map, then execute a scary event only when the player has the key. I've tried the script below as a workaround, but it doesn't behave like I want it to. The "keytrigger" function will still happen, even when I don't have Catleena's key.

void OnEnter()
{
    PlayMusic("25_amb.ogg", true, 1.0f, 10.0f, 1, true);
    AddEntityCollideCallback("Player", "keycheck", "keytrigger", false, 1);
}
void keytrigger(string &in asParent, string &in asChild, int alState)
{
        if(HasItem("catleenakey")=true){
            SetEntityActive("tablechair_*", true);
            SetEntityActive("chairattable_*", false);
        }
}

I've read you have to use global variables, but I don't know how to use them properly. The wiki doesn't explain how to utilize them, just lists the functions. If someone could explain how to use globals for checking items/completed puzzles, or know of a better workaround, I'd appreciate it. Smile

(This post was last modified: 10-14-2011, 01:45 AM by ggstarfoxxie.)
10-14-2011, 12:33 AM
Find


Messages In This Thread
Question about using global variables - by ggstarfoxxie - 10-14-2011, 12:33 AM



Users browsing this thread: 1 Guest(s)