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
ladder script help
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#1
ladder script help

hey guys. sorry for asking for help all the time but i am to confused on where to start with this. What i want to do is when a player turns a crank, i want it to release a ladder that falls through a ceiling hatch. you might have seen this in amnesia Justine (the part where you pull the lever which kills a guy but releases a ladder down through a hatch.) Any ideas on how to script this? Help would be appreciated! thanks.
07-11-2012, 03:22 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: ladder script help

One of the ladders in Justine is a MoveObject. MoveObjects can be attached to wheel entities (e.g. cranks) with InteractConnectPropWithMoveObject. Therefore rotating the crank can move the ladder up or down. However, as far as i know, you can't move ladder areas, so you'll have to use SetEntityConnectionStateChangeCallback to (de-)activate the ladder area.

Tutorials: From Noob to Pro
07-11-2012, 07:25 AM
Website Find
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#3
RE: ladder script help

(07-11-2012, 07:25 AM)Your Computer Wrote: One of the ladders in Justine is a MoveObject. MoveObjects can be attached to wheel entities (e.g. cranks) with InteractConnectPropWithMoveObject. Therefore rotating the crank can move the ladder up or down. However, as far as i know, you can't move ladder areas, so you'll have to use SetEntityConnectionStateChangeCallback to (de-)activate the ladder area.
thanks but i dont know how to deactivate the ladder area. which script code do you use?

(07-11-2012, 07:25 AM)Your Computer Wrote: One of the ladders in Justine is a MoveObject. MoveObjects can be attached to wheel entities (e.g. cranks) with InteractConnectPropWithMoveObject. Therefore rotating the crank can move the ladder up or down. However, as far as i know, you can't move ladder areas, so you'll have to use SetEntityConnectionStateChangeCallback to (de-)activate the ladder area.
and another question. i got the crank to work with the ladder, but is there a way to have the ladder first start of in the air so the player has to turn the crank in order for the ladder to come down. unfortunately, mine is reversed, which means that its starts off on the ground and goes up into the air when the crank is turned.
(This post was last modified: 07-11-2012, 08:41 AM by HoyChampoy.)
07-11-2012, 08:22 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: ladder script help

SetMoveObjectState
SetEntityActive

Tutorials: From Noob to Pro
07-11-2012, 11:33 AM
Website Find
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#5
RE: ladder script help

(07-11-2012, 11:33 AM)Your Computer Wrote: SetMoveObjectState
SetEntityActive
would i put these in the void onstart? is there another code i need? because how will the setmoveobject state know how to make the area active?

SetMoveObjectState(string& asName, float afState);

SetEntityActive(string& asName, bool abActive);
07-11-2012, 09:22 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: ladder script help

(07-11-2012, 09:22 PM)HoyChampoy Wrote: would i put these in the void onstart? is there another code i need? because how will the setmoveobject state know how to make the area active?

SetMoveObjectState(string& asName, float afState);

SetEntityActive(string& asName, bool abActive);

You said you wanted to know how to set the ladder (MoveObject) in the opposite state; i provided you with the function required. You said you wanted to know what function to use to deactivate an area; i provided you with the function required (though deactivating the area can be done in the level editor, too). Neither of these functions "know" when to make the ladder area active or not. I've already provided you with a function to set a callback for informing your script of state changes.

Tutorials: From Noob to Pro
07-11-2012, 09:56 PM
Website Find
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#7
RE: ladder script help

(07-11-2012, 09:56 PM)Your Computer Wrote:
(07-11-2012, 09:22 PM)HoyChampoy Wrote: would i put these in the void onstart? is there another code i need? because how will the setmoveobject state know how to make the area active?

SetMoveObjectState(string& asName, float afState);

SetEntityActive(string& asName, bool abActive);

You said you wanted to know how to set the ladder (MoveObject) in the opposite state; i provided you with the function required. You said you wanted to know what function to use to deactivate an area; i provided you with the function required (though deactivating the area can be done in the level editor, too). Neither of these functions "know" when to make the ladder area active or not. I've already provided you with a function to set a callback for informing your script of state changes.
my mistake Undecided . What i wanted was, if the ladder was high in the air, i wanted the ladder area unactive (so the player couldn't climb it yet. but when the player turned the crank which causes the ladder to come down, i want the ladder area to be active. I already know how to simply deactivate an area, i just want to know how to deactivate it when the crank is at a specific state.
07-11-2012, 10:16 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: ladder script help

(07-11-2012, 10:16 PM)HoyChampoy Wrote: my mistake Undecided . What i wanted was, if the ladder was high in the air, i wanted the ladder area unactive (so the player couldn't climb it yet. but when the player turned the crank which causes the ladder to come down, i want the ladder area to be active. I already know how to simply deactivate an area, i just want to know how to deactivate it when the crank is at a specific state.

That's what SetEntityConnectionStateChangeCallback is for.

Tutorials: From Noob to Pro
07-11-2012, 11:13 PM
Website Find
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#9
RE: ladder script help

I know that already, its just i don't know how to use it or how it works. the code looks like this
SetEntityConnectionStateChangeCallback(string& asName, string& asCallback);

For the string asName do I put the name of the ladder or the name of the valve? and lets say for the asCallback, if i named it activateladderarea, would i put SetEntityActive in there? like this:

SetEntityConnectionStateChangeCallback(string &in asName, string &in asCallback);

void activateladderarea(string &in asEntity, int alState)
{
SetEntityActive("LadderArea_1", true);
}
(This post was last modified: 07-12-2012, 12:20 AM by HoyChampoy.)
07-12-2012, 12:14 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#10
RE: ladder script help

(07-12-2012, 12:14 AM)HoyChampoy Wrote: For the string asName do I put the name of the ladder or the name of the valve?

Name of the valve.

(07-12-2012, 12:14 AM)HoyChampoy Wrote: and lets say for the asCallback, if i named it activateladderarea, would i put SetEntityActive in there?

Yes.

(07-12-2012, 12:14 AM)HoyChampoy Wrote: like this:

You need to make use of alState if you want to make the ladder area active only when the valve is fully turned towards a certain direction.

Tutorials: From Noob to Pro
07-12-2012, 01:17 AM
Website Find




Users browsing this thread: 1 Guest(s)