Jump to content
Sign in to follow this  
EACC

quick help with script (Addaction)

Recommended Posts

Hey i need help with a script to drag out dead players and Ai from vehicles.

the problem is that i give the action to players vehicle since adding to the player give some problems.

so how can i find the player in (vehicle player) that the script is assigned to?

Thanks!

// EACC

#Theaction

?vehicle _player != _player : _Act = vehicle _player addaction ["Pull out Player from vehicle", "Pullout.sqs"]

Pullout.sqs

_Player = _this select 0

_Aliveplayer = _this select 1

_id = _this select 2

#Pullout

_Player removeAction _id

_Aliveplayer playmove "Medic"

~4

>>>>>> _player setpos (position _aliveplayer) <<<<<<<

exit

Edited by EACC

Share this post


Link to post
Share on other sites

not sure if what you want can be done...

the problem is that you assign the action to the unit's vehicle NOT the unit itself

_Act = [color="Blue"]vehicle _player addaction [/color]["Pull out Player from vehicle", "Pullout.sqs"]

and so

_Player = _this select 0

will not return the unit inside the vehicle, but the vehicle the unit is riding in

there is a possibility to exploit a bug in OFP that retains the action assigned to a unit even if the unit is inside a vehicle, but that's not 100% certain...

Share this post


Link to post
Share on other sites

Okay, well that sucks lol!

I guess ill have to find a workaround then and use the addaction to the player.

it will look a bit silly though :)

Thanks!

//EACC

Share this post


Link to post
Share on other sites

hi,

Hey i need help with a script to drag out dead players and Ai from vehicles.

the problem is that i give the action to players vehicle since adding to the player give some problems.

so how can i find the player in (vehicle player) that the script is assigned to?

Thanks!

// EACC

#Theaction

?vehicle _player != _player : _Act = vehicle _player addaction ["Pull out Player from vehicle", "Pullout.sqs"]

Pullout.sqs

_Player = _this select 0

_Aliveplayer = _this select 1

_id = _this select 2

#Pullout

_Player removeAction _id

_Aliveplayer playmove "Medic"

~4

>>>>>> _player setpos (position _aliveplayer) <<<<<<<

exit

Here's solution for your addAction problem.

init.sqs

{[_x] exec "action_pull.sqs"} forEach [p1,p2]

exit

action_pull.sqs

;*************************************************
;Pull Out Script by Nikiller v0.9b
;Add action to pull out dead units inside vehicles
;contact: [email]nikillerofp@hotmail.fr[/email]
;[unitName] exec "action_pull.sqs"
;*************************************************

_u = _this select 0

#check
~5
if (alive _u) then {goto "check"}
~1
if (!(alive _u) && !(_u==vehicle _u)) then {ac_pull=_u addAction ["Pull out Player from vehicle", "pull_out.sqs"]}

exit

pull_out.sqs

;*************************************************
;Pull Out Script by Nikiller v0.9b
;Add action to pull out dead units inside vehicles
;contact: nikillerofp@hotmail.fr
;[target,caller] exec "pull_out.sqs"
;*************************************************

_t = _this select 0
_c = _this select 1

_t removeAction ac_pull
~0.1
_t action ["EJECT",vehicle _t]
~2
_xa = 0
_ya = -2.5
_za = 0
_t setPos [(getPos _c select 0)-((((_xa^2)+(_ya^2))^0.5)*sin (getDir _c)), (getPos _c select 1) -((((_xa^2)+(_ya^2))^0.5)*cos (getDir _c)), (getPos _c select 2)+_za]
~1
_c playMove "Medic"

exit

demo link: http://www.multiupload.com/6S23FYEBFW

In the demo there's 2 units and a jeep. Order your AI to get in the jeep, kill him when he is inside and use the action who appears on this body.

interesting read about addAction command:

http://community.bistudio.com/wiki/addAction

http://www.ofpec.com/ed_depot/index.php?action=details&id=545&game=OFP

Hope it helps.

cya.

Nikiller.

Edited by Nikiller

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
Sign in to follow this  

×