Jump to content
Sign in to follow this  
j-man

Human shield?

Recommended Posts

I know it possible but I dont know how to do it rock.gif .

But is there a way to simulate using a human shield smile_o.gif . Like when the player came within a certain distance from behind another soldier it could start a script that placed the victim 2 meters infront of the player. And is it possible to make it so that the victim would always face the same direction as the player?

I tried putting in a script with something like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_hostage = _this select 0

#loop

_hostage setpos [(getpos player select 0),  2,(getpos player select 1)]

goto "loop"

But hte victim ended up on the other side of the island insted of 2 meters infront of the player.

Any suggestion rock.gif ?

Share this post


Link to post
Share on other sites

try something like this

_unit = _this select 0

_obj = nearestObject _unit

?("man" countType [_obj] > 0 AND _obj != player AND _obj distance player < 5 AND alive _obj): player AddAction ["Grab","Hostage.sqs"]

then for your "grabbing script -

_pos = _this

_dir = getdir player

_hostage = nearestobject _pos

#loop

_hostage setdir _dir

_hostage setpos [(getpos player select 0) + 2,(getpos player select 1), ,(getpos player select 2)]

?!(alive _hostage):Exit

goto "loop"

syntax may be off but you get the idea.

Share this post


Link to post
Share on other sites

Actually, if you constantly want it in front of you, use this line of script.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0

_unit2 = _this select 1

#loop

_dir = getdir _unit

_sin = sin (_dir) *1

_cos = cos (_dir) *1

_posX = (getpos _unit select 0)

_posY = (getpos _unit select 1)

;the rest of the script WILL work just get the + thing to work!

_Xpos = (_posX)+(_sin)

_Ypos = (_posY)+(_cos)

;the rest of the script WILL work just get the + thing to work!

_unit2 setpos [_Xpos,_Ypos,0]

_unit2 setdir getdir _unit

~0.005

goto "loop"

That will put _unit2 1 metre in front of _unit1

So exec the script with

[evilman,hostage] exec "script.sqs"

Share this post


Link to post
Share on other sites

Yep that'll work but hell also be stuck in front of you without an option to drop him. Be pretty funny having a corpse in front of you the whole game.

Share this post


Link to post
Share on other sites

Could always add a function like..

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(getdammage _unit2) == 1 : exit

Right underneath loop, so that he would drop when dead, as for the action..

Hmm..

Share this post


Link to post
Share on other sites

Also need an option to release him if wanted. Thus the nearestobject and "man".

?("man" countType [_unit2] > 0 AND _unit2 != player AND _unit2 distance player < 2 AND alive _unit2): player AddAction ["Release","howeveryouwantitdone"]

and use the

?!(alive _unit2):exit

Share this post


Link to post
Share on other sites

Thnx all great scripts biggrin_o.gif

Now my mission is gona kick some a** biggrin_o.gif

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  

×