Jump to content
Sign in to follow this  
hobson_matt

Creating invincible units

Recommended Posts

I am creatiing an ambush mission where 3 5t trucks are moving along a road when they become under attack from both sides. The trucks keep dying (not exploding, just crushing) and all the men inside die. I want the truck to stay alive, but allow the men inside to be shot, any ideas? CAnnot get any of the previous ones to work

Share this post


Link to post
Share on other sites

I think that command was removed. Was it

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">allowdammage 0.01<span id='postcolor'>

or something similar?

[Gareth Gates must die]

Share this post


Link to post
Share on other sites

yea,

allowdammage false

used to work, but it was removed, need an alternative!!

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_truck = _this select 0

#start

@ (getdamage _truck) > 0.5

_truck setdamage 0

goto "start" <span id='postcolor'>

Just name your trucks, stick

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> [truckname] exec "supertruck.sqs" <span id='postcolor'>

in each one's init-line, and there you go. smile.gif

Share this post


Link to post
Share on other sites

Clever bastard. biggrin.gif

[Gareth Gates must die]

Share this post


Link to post
Share on other sites

Sorry Im curious. Does that just set the damage of the truck to a constant 0.5? I could use that actually in Courage Under Fire, hmm gonna have to release a version 2 of that dont even know if it works in resistance.

Share this post


Link to post
Share on other sites

What the script does is when the damage is more than half, then it sets it back to zero.

Share this post


Link to post
Share on other sites
Guest jacobaby

If you use a HIT eventhandler in the trucks, you can reverse the damage done by each hit, so that in effect allowdammage is working again.

This works on player units too.

I guess if first hit damage was ==1, then a new anim would need to be switched to.....

TJ

Share this post


Link to post
Share on other sites

Is getdamage supposed to be getdammage?

I get errors both ways,

with one m i get "unknown operator _Truck2"

with 2 m's i get "Error select: Type object, expected array "

Damn if only i was better at scripting!!

Any ideas?

Share this post


Link to post
Share on other sites

Make sure you exec the script with [truckname] (including the []) It is getdammage.

RED

Share this post


Link to post
Share on other sites

Still have an error, here is the situation:

Truck named "Truck2"  init field:

[Truck2] exec "supertruck.sqs"

Code called supertruck.sqs:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_Truck2 = _this select 0

#start

@ (getdammage _Truck2) > 0.5

_Truck2 setdammage 0

goto "start"

<span id='postcolor'>

Error:

'_Truck2 = _this select 0|#|': Error Select: Type Object, Expected Array

Share this post


Link to post
Share on other sites

Use a trigger to activate it not the init field. Or you could change:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Truck2 = _this select 0<span id='postcolor'>

To:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Truck2 = _this<span id='postcolor'>

RED

Share this post


Link to post
Share on other sites

Still get same error if i put it in a trigger, the error changes if i delete "select 0"

Share this post


Link to post
Share on other sites

Btw, what version of OFP you running, Hobson? I'm running 1.91 and this (slightly) corrected script works fine on my PC..

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

#start

@ (damage _truck) > 0.5

_truck setdamage 0

hint "can't kill me!"

goto "start" <span id='postcolor'>

Yes, you're right, it was getdamMage rather than getdamage (I could have sworn they fixed that when they fixed setdamMage). I've changed it to just <damage> now though, as I despise typos (even if they are required by the coding)..

Tested in the editor myself and it works when called from the init-field, so I have no idea what's up.

Share this post


Link to post
Share on other sites

Actually, I think the first line should be written as:

_Truck2 = this select 0

I'm not positive, but I don't recall using _this in my last script. It would also make sense because "this" refers to arguments passed to the script through the init field or activation field, while "_this" would refer to a value stored into the variable _this within the script.

I hope this helps.

UberKreb

Share this post


Link to post
Share on other sites

Brilliance, sheer brilliance, thanks guys! works a treat, anyone with Winter Everon + winter units can try the mission so far if they like, either pm or email me,

Cheers!

biggrin.gifbiggrin.gifbiggrin.gifbiggrin.gifbiggrin.gifbiggrin.gifbiggrin.gif

Share this post


Link to post
Share on other sites

This method works in most cases. It does not work well in quick catastrophic death though (IE: Law hits a soldier). - That's not to say any death is non-catasrophic  crazy_o.gif

I find if I use the method above:

1) The guy still dies - but only for a second. His dammage is set back to zero but not fast enough to avoid the server seeing a respawn condition.

2) A new guy is respawned (if respawn is asctivated) and you now have 2 dudes. - this is NOT a ?!(local Server) issue. It happens when running alone in edit mode.

Just wondering - I know some values take a new meaning when set to  -1000. Will this work --> this setdammage -1000?

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  

×