Frictional Games Forum (read-only)
Do something when wheel is on its limit - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Do something when wheel is on its limit (/thread-23988.html)



Do something when wheel is on its limit - Neo - 11-30-2013

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


RE: Do something when wheel is on its limit - DnALANGE - 11-30-2013

(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.


RE: Do something when wheel is on its limit - Neo - 11-30-2013

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!