Home   Help Search Login Register  

Author Topic: ending mission with script help  (Read 484 times)

0 Members and 1 Guest are viewing this topic.

leonpoi

  • Guest
ending mission with script help
« on: 03 Jun 2005, 12:33:49 »
I've searched around but can't find an exact answer to my problem. I can end a mission using a trigger but how can I end the mission using a script that makes that trigger activate?  Is there an activateTrigger "name" command or anyhing like that?

Also I have a group of men and I want an objective to update when they all die. I can put a huge radius trigger and group them to it and put the objStatus on the on activate and it works, but I can't get the same trigger to work with a condition.  I'll explain:

condition:
count units grp1 == 2
seems to do what I expect. When the group has been reduced to 2 men the trigger fires.
count units grp1 == 0 doesn't work - the script doesn't fire. I can however print the value of "count units grp1" usinf TitleText and format and it does give me a value of 0.
I thought it might have been that the array was destroyed when it has no members but I think it still exists.
Cheers in advance.



Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:ending mission with script help
« Reply #1 on: 03 Jun 2005, 12:49:48 »
1.   Use a variable to make the trigger fire.  

Script
fireTrig1=true

Trigger
Condition:   fireTrig1


2.   Almost never use ==.   Certainly not with numbers - it's not reliable.   Some screwup could cause the number to be 2.00001 as far as the computer is concerned.    Also, when counting the units in a group, you can get long (several minute) delays before the trigger fires.   Use an alive command to make the group leader (and therefore the game) aware of the number of loons in the group.   You want

"alive _x" count units grp1 < 1

You must put in place a mechanism to cope with last few loons in the group fleeing to the far side of the island and becoming unfindable and therefore unkillable.

Oh, and

Welcome to the forum!
« Last Edit: 03 Jun 2005, 12:50:34 by macguba »
Plenty of reviewed ArmA missions for you to play

leonpoi

  • Guest
Re:ending mission with script help
« Reply #2 on: 03 Jun 2005, 12:57:53 »
Thanks for that. I'll look at the command reference manual when I get home but there is some kind of "isFleeing" command isn't there so that will sort out the fleeing issue.

One last thing,
fireTrig1=true
is automatically global (public) isn't it or do I have to write
public ["fireTrig1"]
fireTrig1 = true
or an equivalent.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:ending mission with script help
« Reply #3 on: 03 Jun 2005, 13:02:52 »
If this is an MP mission then I have no idea:   the mysteries of publicvariable are, well, a mystery to me.

If it's SP it's easy.      It is a global variable and you don't have to do anything else:  simply defining it as true in the script is sufficient.    Technically, you should initalise it first but in this case it won't matter.     (The important thing to appreciate that if the game finds an uninitialised variable in an expression (for example the condition line of this trigger) then it treats the whole expression - not just the variable - as false.)

There is more on variables in the comref somewhere.

There is indeed a fleeing (and allowFleeing) command.   There are lots of reasonably straightforward ways you can solve this problem.
« Last Edit: 03 Jun 2005, 13:03:50 by macguba »
Plenty of reviewed ArmA missions for you to play