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
Do something when wheel is on its limit
Neo Away
Junior Member

Posts: 10
Threads: 3
Joined: Nov 2013
Reputation: 0
#1
Do something when wheel is on its limit

Hey there Smile

I've got a problem with the wheels again Confused I found out how to execute code when the player interacts with a valve or so, but then you just need to click on it one time, and I want to do something when you spin the wheel to the limit. Is it possible? :/ I haven't found a function for this yet...

It would be very kind if someone could help me Smile
(This post was last modified: 11-30-2013, 08:57 PM by Neo.)
11-30-2013, 03:46 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#2
RE: Do something when wheel is on its limit

(11-30-2013, 03:46 PM)Neo Wrote: Hey there Smile

I've got a problem with the wheels again Confused I found out how to execute code when the player interacts with a valve or so, but then you just need to click on it one time, and I want to do something when you spin the wheel to the limit. Is it possible? :/ I haven't found a function for this yet...

It would be very kind if someone could help me Smile

here is an example you can copy paste:

///////OpenHeavyDoor///////
void OpenheavyDoor(string &in asEntity, int alState)
{
if(alState == 1) //Meaning wheel is "toutching" MAX
{
SetWheelStuckState("YOURWHEELNAME", 1, true); //Sets the wheel STUCK so you can't spin it anymore.
//STUFF YOU WANT TO HAPPEN IF WHEEL goes to MAX, can be empty if you only want something happen on MINUMUM.
}
if(alState == -1) //Meaning wheel is "toutching" MINIMUM
{
//STUFF YOU WANT TO HAPPEN IF WHEEL goes to MIMIMUM, can be empty if you only want something happen on MAX.
}
}

-----
void OpenheavyDoor(string &in asEntity, int alState)
The OpenheavyDoor copy paste this into your EDITOR -> YOURWHEEL -> ENTITIY-tab -> CONNECTCHANGESTATECALLBACK.

EXTRA EDIT:
// <-- If you remove those 2 slashes, that specific line will work, // is only for giving you an idea. so remove it if you want to use the function.
-
Have fun, if it didnt work, be free to ask here.
(This post was last modified: 11-30-2013, 07:27 PM by DnALANGE.)
11-30-2013, 07:18 PM
Find
Neo Away
Junior Member

Posts: 10
Threads: 3
Joined: Nov 2013
Reputation: 0
#3
RE: Do something when wheel is on its limit

Ahh, it works! Thank you very much! I just needed to find out how to execute code when the wheel is at maximum

My code:

Spoiler below!

//////////////////WATER PIPES AND PUMPS
//BEGIN
//////////////////If this won't work so well use the if and else statement

void Valve_01(string &in asEntity, int alState)
{

if(alState == 1)
{
SetWheelStuckState("water_valve01", 1, true);
PlaySoundAtEntity("", "Stream_pipe", "water_valve01", 0, false);
SetMessage("Message", "Sound_Water", 5);
SetEntityActive("red", false);
SetEntityActive("green", true);
SetEntityActive("high", true);
SetEntityActive("low", false);
}

}

void Watervalve01(string &in asEntity)
{

if (GetGlobalVarString("Pipe01") == "PumpActivated")
{
SetWheelStuckState("water_valve01", 0, true);
}
else
{
SetMessage("Message", "Pipe", 3);
}
}

void Waterpump01(string &in asEntity)
{
PlaySoundAtEntity("", "Steam_pipe", "water_pump01", 0, false);
SetGlobalVarString("Pipe01", "PumpActivated");
SetEntityInteractionDisabled("water_pump01", true);
SetWheelInteractionDisablesStuck("water_valve01", true);
}

//////////////////WATER PIPES AND PUMPS
//END
//////////////////



I created a string variable. When you touch the wheel before the pump was activated, it displays a message and does nothing else. If you activate the pump the variable changes. Now the wheel isn't stuck anymore and you can spin it.

Thanks!
11-30-2013, 08:57 PM
Find




Users browsing this thread: 2 Guest(s)