Home   Help Search Login Register  

Author Topic: What's the problem here?  (Read 1119 times)

0 Members and 1 Guest are viewing this topic.

klavan

  • Guest
What's the problem here?
« on: 29 Oct 2005, 12:45:30 »
Code: [Select]
#Next2
~5.5
player sidechat "I wonder what the hell....."
~3
playsound "GENB_Growl"
"gmer_civie_01" createunit [getmarkerpos "SkePos1",FakeRussi,"mon1=this",0.7,"Private"]
[mon1] join grpnull

@ {!alive _x} foreach [mon1]
~3
hint "done"
exit

I don't receive any error message, but the hint doesn't appears after  the created unit is killed. This script is under development and when finished, it will include about 20 created units (mon1 to mon20).
What do you think the problem is?
Thanks
Klavan
« Last Edit: 29 Oct 2005, 12:48:21 by klavan »

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:What's the problem here?
« Reply #1 on: 29 Oct 2005, 13:19:06 »
I think the problem is that forEach does not return anything, so you can't use it as a condition.

klavan

  • Guest
Re:What's the problem here?
« Reply #2 on: 29 Oct 2005, 13:44:25 »
OK, thank you Baddo.
Klavan

Offline Trapper

  • Honoured Contributor
  • ***
  • I'm a llama!
RE: What's the problem here?
« Reply #3 on: 29 Oct 2005, 14:19:25 »
try to use

Code: [Select]
#wait1
~0.5
{if (alive _x) then {goto "wait1"}} foreach [mon1]

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:What's the problem here?
« Reply #4 on: 29 Oct 2005, 14:27:56 »
alternatively...

Code: [Select]
#Next2
~5.5
player sidechat "I wonder what the hell....."
~3
playsound "GENB_Growl"
"gmer_civie_01" createunit [getmarkerpos "SkePos1",FakeRussi,"mon1=this",0.7,"Private"]
[mon1] join grpnull

@ (({alive _x} count [mon1]) == 0)
~3
hint "done"
exit

simply counts the number of units alive in the array containing mon1, and waits until it's 0.
« Last Edit: 29 Oct 2005, 14:28:28 by bedges »

klavan

  • Guest
Re:What's the problem here?
« Reply #5 on: 29 Oct 2005, 15:03:30 »
Problem solved!
I've adopted bedges's solution.
Sintax always drive me mad!   ;D
Thank to all you guys for your help.
Be prepared to be scared........ 8)
klavan