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
Levers in different levels
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#5
RE: Levers in different levels

(09-18-2013, 11:13 AM)LankySpankey103 Wrote: How come when you hover the mouse over the "full game save" property, it says that I should use as few of them as possible?
Every entity you enable full game save on is in the save file forever - so if you did this for loads of entities each map the save file will grow pretty big. It's fine to use for a select few props which you need to remember the state of between maps.

Regarding your code, it looks like it should work provided you visit map 1 first and are pulling the levers in the right direction. Changing the code to the following will allow us to test where stuff is going wrong.

First map:
void OnStart()
{
  /*GetGlobalVarInt('<stuff>') returns 0 if SetGlobalVarInt hasn't been called yet, so we don't need to init this to 0*/
}

void OnEnter()
{

  //Print some debug messages so we can see the lever states
  AddDebugMessage("Map1 OnEnter()",false);
  AddDebugMessage("lever_grave state: " + GetGlobalVarInt("lever_grave_pulled"),false);
  AddDebugMessage("lever_torture state: " + GetGlobalVarInt("lever_torture_pulled"),false);

  //Unlock the level door if both levers have been pulled
  if(GetGlobalVarInt("lever_grave_pulled") + GetGlobalVarInt("lever_torture_pulled") == 2)
  {
    AddDebugMessage("Opening level door!",false);
    SetLevelDoorLocked("level_wood_double_1", false);
  }
}

Second map:
void OnStart()
{
SetEntityConnectionStateChangeCallback("lever_grave", "lever_exit_1");    
}

void lever_exit_1(string &in asEntity, int alState)
{
  //This helps us know if this event has triggered
  AddDebugMessage(asEntity + " is in state: " + alState,false);
  
  if (alState == 1)
  {  
     SetGlobalVarInt("lever_grave_pulled", 1);
     SetLeverStuckState("lever_grave", 1, true);
  }
}

Third Map
void OnStart()
{    
SetEntityConnectionStateChangeCallback("lever_torture", "lever_exit_2");
}

void lever_exit_2(string &in asEntity, int alState)
{
  //This helps us know if this event has triggered
  AddDebugMessage(asEntity + " is in state: " + alState,false);
  
  if (alState == 1)
  {  
     SetGlobalVarInt("lever_torture_pulled", 1);
     SetLeverStuckState("lever_torture", 1, true);
  }
}
(This post was last modified: 09-18-2013, 11:02 PM by Apjjm.)
09-18-2013, 11:02 PM
Find


Messages In This Thread
Levers in different levels - by LankySpankey103 - 09-17-2013, 10:43 PM
RE: Levers in different levels - by Apjjm - 09-17-2013, 11:39 PM
RE: Levers in different levels - by Apjjm - 09-18-2013, 11:02 PM



Users browsing this thread: 1 Guest(s)