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
How to activate a 'Puzzle completed' script
Tripication Offline
Member

Posts: 172
Threads: 19
Joined: Dec 2011
Reputation: 6
#7
RE: How to activate a 'Puzzle completed' script

Ok, i've done it.


void OnStart()
{
AddEntityCollideCallback("Player", "bookarea_1", "book1", true, 1);
AddEntityCollideCallback("book_02", "bookarea_1", "book2", true, 1);
SetLocalVarInt("Var01", 0); //THIS MAKES A COUNTER
}


void book1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("book_01", false);
SetEntityActive("book_001", true);
PlayGuiSound("impact_book_med1.ogg",10.0f);
AddLocalVarInt("Var01", 1); //THIS ADDS 1 TO THE COUNTER
if (GetLocalVarInt("Var01") == 2) //THIS CHECKS IF THE COUNTER =2
{
[CODE IN HERE]
}
}

void book2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("book_02", false);
SetEntityActive("book_002", true);
PlayGuiSound("impact_book_med2.ogg",10.0f);
AddLocalVarInt("Var01", 1); //THIS ADDS 1 TO THE COUNTER
if (GetLocalVarInt("Var01") == 2)//THIS CHECKS IF THE COUNTER =2
{
[SAME CODE IN HERE]
}
}

Probably not the most efficient way, but it works.

When the "Counter" = 2, it will call whatever you have in the CODE IN HERE or SAME CODE IN HERE space.
NOTE: WHAT EVER GOES IN THE FIRST CODE SECTION, ALSO GOES IN THE OTHER, WORD FOR WORD OR IT PROBABLY WILL NOT WORK!

Also, http://wiki.frictionalgames.com/hpl2/tut...lvariables (tells you how to use variables)

[Image: speedart__2___yoshimitsu_by_kamofudge-d4yo6kk.png]
(This post was last modified: 01-20-2012, 09:54 AM by Tripication.)
01-20-2012, 09:42 AM
Find


Messages In This Thread
RE: How to activate a 'Puzzle completed' script - by Tripication - 01-20-2012, 09:42 AM



Users browsing this thread: 1 Guest(s)