Home   Help Search Login Register  

Author Topic: Take from one array into new?  (Read 495 times)

0 Members and 1 Guest are viewing this topic.

Dane

  • Guest
Take from one array into new?
« on: 28 Mar 2005, 02:59:27 »
Can i take a dead guy from this array: _guards = [g1,g2,g3,g4,g5] and put him in this array _deadguys =[]?
And if so, how do i do that?

Offline Blanco

  • Former Staff
  • ****
Re:Take from one array into new?
« Reply #1 on: 28 Mar 2005, 03:03:26 »
Not tested.

Code: [Select]
{if (!alive _x) then {_deadguys = _deadguys + [_x]}} forEach _guards
edit : removed a curled bracket
« Last Edit: 28 Mar 2005, 03:24:56 by Blanco »
Search or search or search before you ask.

Dane

  • Guest
Re:Take from one array into new?
« Reply #2 on: 28 Mar 2005, 03:10:56 »
ahh thanks, i'll try it out.

Dane

  • Guest
Re:Take from one array into new?
« Reply #3 on: 28 Mar 2005, 12:51:32 »
I think this works but i'm having a little trouble with my script,.
How do i select a unit from the _guards array and select another dude from the _deadguys array, and then check if the _guard knowsAbout _deadguy?

The script should check if any of the _guards knowsAbout _deadguys since the _guards aren't grouped.
« Last Edit: 28 Mar 2005, 12:57:10 by Dane »

Offline Blanco

  • Former Staff
  • ****
Re:Take from one array into new?
« Reply #4 on: 28 Mar 2005, 18:29:07 »
Can be done, but I can't help you now, I'm not at home

Maybe you run a loop to check the knowsabout value between every guard and every deadguy and put these values in a new array _known =[]

There is a script in the editor depot, it works perfect but it's not easy to use.

http://www.ofpec.com/editors/resource_view.php?id=241

*edit*
Strange , I"m sure I have another version from that script...It checks if there aren't any objects on the map that could hide the body or block the guards view...and that was not easy to determine.




 
« Last Edit: 28 Mar 2005, 18:36:09 by Blanco »
Search or search or search before you ask.

Dane

  • Guest
Re:Take from one array into new?
« Reply #5 on: 29 Mar 2005, 19:12:10 »
Thanks, i'll have have a peek at that.
I have been peeking at Keycat's grouplink script and and found something interesting with the knowsabout but i'm still a newbie scripter so i haven't figured it out yet. ;)