Home   Help Search Login Register  

Author Topic: Last loon problem (again) :)  (Read 1125 times)

0 Members and 2 Guests are viewing this topic.

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Last loon problem (again) :)
« on: 15 Jun 2006, 09:18:35 »
I know, the 'last loon' problem is ethernal, but I made a not too good, not too bad solution. This is the kamikaze script.
But I'm not sure in the first part of this script (getting parameters). I tested it in sample mission and I tested it real missions and it works. Only one mission I get an error message: divided by zero for the first parameter getting line.

Code: [Select]
;two last enemy attack (no hideing, no fleeing)
;use in trigger (enemy presence) activation field: thislist exec "kamikaze.sqs"
;condition field: count thislist < 3

_last1 = thislist select 0
_last2 = thislist select 1

_last1 allowFleeing 0
_last1 setUnitPos "up"
_last1 doMove getPos player

_last2 allowFleeing 0
_last2 setUnitPos "up"
_last2 doMove getPos player

#loop
~6

_last1 doMove getPos player
_last2 doMove getPos player

?((alive _last1) or (alive _last2)) : goto "loop"

exit

I'm not sure but I think this is the problem:
_last1 = thislist select 0
_last2 = thislist select 1

Is it OK, if I'll change it to this?
_last1 = _this select 0
_last2 = _this select 1
Fix bayonet!

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Last loon problem (again) :)
« Reply #1 on: 15 Jun 2006, 10:02:05 »
i suspect the reason you get the error may be that there's only one loon left.

i would change the trigger's condition field to read

Code: [Select]
{alive _x} count thislist <3
on activation field to read

Code: [Select]
last_enemy = thislist; [] exec "kamikaze.sqs"
then your kamikaze script would read

Code: [Select]
{_x allowFleeing 0; _x  setUnitPos "up"; _x  doMove getPos player} foreach last_enemy

#loop
~3
{_x  doMove getPos player} foreach last_enemy
?not ({alive _x} count last_enemy==0):goto "loop"

exit