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
Simple shelf puzzle?
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Simple shelf puzzle?

Have an area cover the shelf.




When you touch the shelf you should call:




void TouchShelf(string &in asEntity)

{

if(GetLocalVarInt("MovableShelf") == 0)

{

SetMessage("Messages", "YourMessage", 0);

SetEntityInteractionDisabled(string& asName, true);

}




if(GetLocalVarInt("MovableShelf") == 1)

{

SetEntityInteractionDisabled(string& asName, false);

}

}







Now you make collide functions for the stuff in the shelf. It should look like this:

(You should have more than one. They should all call "CollideFunction", but you can change "Stuff" to what you want.)




AddEntityCollideCallback("AreaAroundBookshelf", "Stuff_1", "CollideFunction", false, 0);

AddEntityCollideCallback("AreaAroundBookshelf", "Stuff_2", "CollideFunction", false, 0);




voice CollideFunction(string &in asParent, string &in asChild, int alState)

{

if(asChild == "Stuff_1")

{

if(alState == 1)

{

AddLocalVarInt("StuffVar", -1)

}




if(alState == -1)

{

AddLocalVarInt("StuffVar", 1)

}

}




if(asChild == "Stuff_2")

{

if(alState == 1)

{

AddLocalVarInt("StuffVar", -1)

}




if(alState == -1)

{

AddLocalVarInt("StuffVar", 1)

}

}




//And in the end of the script:




if(GetLocalVarInt("StuffVar") == 0) //Desired number. This defines how many boxed there were taken off the shelf. If 0, then all boxes are off. If less than 0 (-1, -2, -3) Some boxes can remain.

{

SetLocalVarInt("MovableShelf", 1)

}




if(GetLocalVarInt("StuffVar") == -10) //Desired number of boxes on the shelf.

}
SetLocalVarInt("MovableShelf", 0)
}

Trying is the first step to success.
(This post was last modified: 11-29-2012, 07:54 AM by FlawlessHappiness.)
11-29-2012, 07:51 AM
Find


Messages In This Thread
Simple shelf puzzle? - by Potato - 11-29-2012, 07:13 AM
RE: Simple shelf puzzle? - by FlawlessHappiness - 11-29-2012, 07:51 AM
RE: Simple shelf puzzle? - by Potato - 11-29-2012, 08:16 AM
RE: Simple shelf puzzle? - by Damascus - 11-29-2012, 08:34 AM
RE: Simple shelf puzzle? - by Potato - 12-02-2012, 01:34 AM
RE: Simple shelf puzzle? - by The chaser - 12-02-2012, 01:56 AM
RE: Simple shelf puzzle? - by TheGreatCthulhu - 12-02-2012, 02:00 AM
RE: Simple shelf puzzle? - by Damascus - 12-02-2012, 03:27 AM
RE: Simple shelf puzzle? - by The chaser - 12-02-2012, 11:24 AM



Users browsing this thread: 1 Guest(s)