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
Global Var Problem
TheGilgameshZocker Offline
Junior Member

Posts: 13
Threads: 11
Joined: Mar 2012
Reputation: 0
#1
Global Var Problem

Hi guys! I've got a problem with global vars. I have a map where you have to activate a lever, then the global var ("VarEle") should switch to 1 (activate an elevator). The script of the map (where the lever is):


void OnEnter()
{
SetEntityConnectionStateChangeCallback("lever1", "func_piston");
}


void func_piston(string &in asEntity, int alState)
{
if (alState == 1)
{
AddGlobalVarInt("VarEle", 1);
SetMoveObjectStateExt("Entity_Piston", 0.6, 0.6, 8, 0, false);
PlaySoundAtEntity("", "move_gate.snt", "Entity_Piston", 0, false);
return;
}
}

So, the var should effect an elevator to switch the map (fade out and change map). The script of the other map (where the elevator is):

void OnEnter()

{
CreateParticleSystemAtEntity("FountainPourBlood", "ps_childsnake_blood_stream.ps", "ScriptArea_1", true);
CreateParticleSystemAtEntity("FountainPourBlood", "ps_childsnake_blood_stream.ps", "ScriptArea_2", true);
PlayMusic("02_amb_safe.ogg", true, 5.0f, 0.7f, 10, true);
if (GetGlobalVarInt("VarEle")== 1)
{
SetEntityConnectionStateChangeCallback("elevator_lever_2", "activate_attic");
}
}

void activate_attic(string &in asEntity, int alState)
{
if (alState == 1)
{
FadeOut(3);
ChangeMap("attic.map", "PlayerStartArea_1", "", "");
}
}

void OnLeave()
{
StopMusic(0,0);
}

The main problem is that if I pull the lever down, nothing happens. Please correct me, if you know a way to solve this problem Wink
07-05-2012, 05:36 PM
Find


Messages In This Thread
Global Var Problem - by TheGilgameshZocker - 07-05-2012, 05:36 PM
RE: Global Var Problem - by Cruzore - 07-05-2012, 06:25 PM



Users browsing this thread: 1 Guest(s)