Jump to content
Sign in to follow this  
colligpip

all friendly unless weapon

Recommended Posts

can anybody help. I want a script that makes all units friendly to everybody unless they have a weapon, but i don't want to have to use names in an array.

this is prob very simple i just dont know how to

Share this post


Link to post
Share on other sites

The direction I'd try is to create a trigger, covering all your units, set to "Anybody Present". In the "On Activation" line, put some code like this (you may need to modify it some, I've not tested it:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{if (count weapons _x < 1) then {_x setCaptive true}} forEach thislist;

If you want it to update, you will have to set it up slightly differently, w/ a named trigger and something else that checks it. And that will still make them "hostile" if they have "Throw" or "Put", iirc.

Share this post


Link to post
Share on other sites

thanks that got everything friendly

now i need to work out how to get units to only fire on other units that have weapons, ill try to fiddle with the triggers.

Share this post


Link to post
Share on other sites

I suggest counting the weapons array returned by the "weapons" command:

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

If zero, unarmed. If > zero, armed.

It may be more complicated than this though, if NVGs and Binoculars are considered weapons. You might have to add a little code to ignore those items when counting (or first remove them from the array via a "-" before counting the array).

If you solve this with a little script, post it, so the community can use it.

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  

×