Jump to content
johnnyboy

tree/building climbing script (no mod)

Recommended Posts

I would love to have a climbing script that does not require a mod.  Simply going up/down using the ladder climbing animations is good enough for me.  This video from @killzone_kid would be perfect.  KK, was that a script?  Can you share it?  I've been trying to use hidden ladders, but when climbing higher than a single ladder height, you have to switch the unit from one ladder to the next, and its not working so good...   Probably there is a way combining ladder animations and setVelocity, but I haven't figured it out yet.

 

I know the Urban Climbing/Rappelling script looks awesome, but that is not what I'm looking for.

  • Like 4

Share this post


Link to post
Share on other sites

Reminds me ....'I want to be a girlie, just like my dear papa!'

 

 

  • Like 3

Share this post


Link to post
Share on other sites

Essentially you need to check if the cursorObject is a tree and then, if it is a tree, spawn a ladder object at the cursorObject and then changing the ladder's vectorUp and direction to match.

I searched the configFile for ladders by using:

_search = "ladder";
copyToClipboard str (("true" configClasses (configfile >> "CfgVehicles") apply {configName _x}) select {toLower _x find _search > -1});



You'd need to fiddle about with the exact positions but execute this in the debug console and try it out:

isTreeNearby = {
	private _obj = cursorObject;
	private _return = false;
	
	if (!isNull _obj) then {
		private _model = getModelInfo _obj;

		_return = [
			toLower (_model select 1) find "\tree\" > -1, 
			false
		] select (_model isEqualTo []);
	};

	_return
};
player addAction ['Create Ladder', {
		private _obj = cursorObject;
		if (!isNull _obj) then {
			private _pos = getPosASLVisual _obj;
			_ladder = createVehicle ["Land_Warehouse_01_ladder_F", getPosATLVisual _obj, [], 0, "CAN_COLLIDE"];
			_ladder setDir ((getDirVisual _obj));
			_ladder setPosASL _pos;
			_ladder setVectorUp (vectorUp _obj);
			
			player setPosASL _pos;
			player action ["ladderOnUp", _ladder, 0, 0];
			_ladder hideObjectGlobal false;
		}
	}, nil, 10, true, true, '', '((player distance2D cursorObject) < 5) && {[] call isTreeNearby}',
	5, false
];

 

  • Like 3

Share this post


Link to post
Share on other sites
5 hours ago, HallyG said:

Essentially you need to check if the cursorObject is a tree and then, if it is a tree, spawn a ladder object at the cursorObject and then changing the ladder's vectorUp and direction to match.

I searched the configFile for ladders by using:


_search = "ladder";
copyToClipboard str (("true" configClasses (configfile >> "CfgVehicles") apply {configName _x}) select {toLower _x find _search > -1});



You'd need to fiddle about with the exact positions but execute this in the debug console and try it out:


isTreeNearby = {
	private _obj = cursorObject;
	private _return = false;
	
	if (!isNull _obj) then {
		private _model = getModelInfo _obj;

		_return = [
			toLower (_model select 1) find "\tree\" > -1, 
			false
		] select (_model isEqualTo []);
	};

	_return
};
player addAction ['Create Ladder', {
		private _obj = cursorObject;
		if (!isNull _obj) then {
			private _pos = getPosASLVisual _obj;
			_ladder = createVehicle ["Land_Warehouse_01_ladder_F", getPosATLVisual _obj, [], 0, "CAN_COLLIDE"];
			_ladder setDir ((getDirVisual _obj));
			_ladder setPosASL _pos;
			_ladder setVectorUp (vectorUp _obj);
			
			player setPosASL _pos;
			player action ["ladderOnUp", _ladder, 0, 0];
			_ladder hideObjectGlobal false;
		}
	}, nil, 10, true, true, '', '((player distance2D cursorObject) < 5) && {[] call isTreeNearby}',
	5, false
];

 

Thanks HallyG, that is nearly exactly what I was doing.  My problem is the tree I'm after is 6 ladders tall.  So I created 6 ladders vertically overlapping a little, and climb to the top of first ladder.  I then do action "LadderOnUp" to get to next ladder and it won't automatically pop me off the first ladder and on to the next.  So I put in an action "LadderOff" immediately followed by action "LadderOnUp" and there is some lag between the 2, and player falls.

Share this post


Link to post
Share on other sites
22 minutes ago, johnnyboy said:

_search = "ladder"; copyToClipboard str (("true" configClasses (configfile >> "CfgVehicles") apply {configName _x}) select {toLower _x find _search > -1});

This is super helpful also, thanks alot. I had no idea their were other ladders available besides the pier one in the editor.  The warehouse ladders are taller, and I think will get me close to what I need. Plus the they have the safety barrier at the top so falling less likely, so if I add a second ladder the transition is more likely to to work without falling.

 

Thanks much HallyG!

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, johnnyboy said:

I would love to have a climbing script that does not require a mod.  Simply going up/down using the ladder climbing animations is good enough for me.  This video from @killzone_kid would be perfect.  KK, was that a script?  Can you share it?  I've been trying to use hidden ladders, but when climbing higher than a single ladder height, you have to switch the unit from one ladder to the next, and its not working so good...   Probably there is a way combining ladder animations and setVelocity, but I haven't figured it out yet.

 

I know the Urban Climbing/Rappelling script looks awesome, but that is not what I'm looking for.


This one just uses hidden ladder. What you need is Example 2 https://community.bistudio.com/wiki/setVelocityTransformation

  • Like 1

Share this post


Link to post
Share on other sites

Hey @johnnyboy I am new to Arma 3 Eden. Could you please show me how to make AI climb ladders using the ladderUp script?  I did what bistudio wiki says but the AI only steps out and doesn't climb upwards. So what should I do if the building is right in front of the AI? I don't really know what object id is. Is it the name of the object? Where can I get it? What is laddernumber? I searched and tried for 7 hours today but still can't make my AI climb ladders. Can you please teach me? I really wanna know how you can do it with the simple ladderup scripts. I will be deeply appreciated. 

Share this post


Link to post
Share on other sites

Hi @Heartyzee, welcome to the wonderful, time-consuming, frustrating world of ARMA editing.  :)

 

I'm not an expert on the problem you want to solve.  In this thread I got help on how to create a hidden ladder on a tree to simulate climbing a tree.  In your case you are trying to get AI to climb exsiting ladders on buildings.  I don't have time to experiment with this, but I would break your problem down to these steps:

 

1. Find building nearest to AI unit.

 

 nearestObjects [myAIdude, ["House", "Building"], 50] select 0;

 

2. Find ladder position on building.

 

Not sure how to do that.  Maybe selectionPosition or some config command.  Maybe the same command that finds doors can find ladders?  Google finding doors on building.

 

3. Move unit to position in front of ladder

 

Use moveTo, commandMove, Move, or doMove to send uint to ladder position.

 

4. Climb up or down.

 

Does AI get an action added when near ladder like a player does?  I think so.  If yes, then maybe you use Action commands on the AI

https://community.bistudio.com/wiki/Arma_3_Actions#LadderUp

There is LadderUP, LadderDown, and LadderOff

Before trying to script this I would put a player with an AI in his group to command and preview the mission.  Order the AI to move to position at bottom of a ladder.  Then order the AI to perform an action.  Does "Climb Ladder" appear in the AI's action list and you can order him to climb it?  If so, then then these Action commands should work for you in a script.

 

I would experiment with this and give you a better answer, but I have no time for  it sadly.   Good luck to you!

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×