Home   Help Search Login Register  

Author Topic: The effecientist way to....  (Read 657 times)

0 Members and 1 Guest are viewing this topic.

Dubieman

  • Guest
The effecientist way to....
« on: 07 Jan 2005, 23:04:37 »
Hello,

Just need some advice, I have a counterattack of say 5 groups.

Each group has its own name, cnva1, cnva2, etc....
And I need a better way than a big arse not present trigger.
I tried
 ? "alive _x" count units grp == 0

but OFP doesn't like the ?, its #? "alive _x" count units grp == 0 invalid something or other. :P

So I just need a way to find out when all 5 groups are wiped out, so the obj can be triggered.

thanks :)


Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:The effecientist way to....
« Reply #1 on: 07 Jan 2005, 23:15:30 »
I don't suppose using IF instead of ? makes any difference?


Planck
I know a little about a lot, and a lot about a little.

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:The effecientist way to....
« Reply #2 on: 07 Jan 2005, 23:42:46 »
Try this:

? ({alive _x} count units grp) == 0

I had a similar problem not long ago.  When I get home form work I will look up the exact sytax I used and post that.

« Last Edit: 07 Jan 2005, 23:44:32 by Raptorsaurus »

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:The effecientist way to....
« Reply #3 on: 07 Jan 2005, 23:52:27 »
if this is in a trigger, then you shouldn't have the ?

if its in a script, you could aslo try @
i don't see any problems with it though

Dubieman

  • Guest
Re:The effecientist way to....
« Reply #4 on: 08 Jan 2005, 00:03:50 »
Well, I'll get around to it, not on OFP right now. I'll try If, then Raptorsaurus's code, and what do you mean TriggerHappy? What code needs a "?"...?

And just out of curiosity, how many times can you use the and or && syntax? :-\

like not alive bb && not alive bbb && not alive bbbb....
Is there a limit? I'm not gonna use that method, scares me with all the typing.  :P :o

thanks

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:The effecientist way to....
« Reply #5 on: 08 Jan 2005, 00:27:54 »
For that I'd use a line like this:

In the condition line of a trigger:
Quote
"alive _x" count (units grp1 + units grp2 + units grp3 + units grp4 + units grp5) == 0

In a script:
Quote
? "alive _x" count (units grp1 + units grp2 + units grp3 + units grp4 + units grp5) == 0

However... I often prefer to use a 'morale broken' sort of condition.
What I mean is that rather forcing the player to hunt down and kill all enemy units, you can detect when the last few are running away.
Often they'll run far away and the player will have a hard time finding all the cowardly sods ;D

I lean towards using something like this:
Quote
("((east countside units _x) <= (""fleeing _x"" count units _x))" count [ grp1, grp2, grp3, grp4, grp5 ]) == 5)

Looks nasty, but what that does is compare the number of living units1 to the number of units running away2. If the number of units fleeing is equal (or greater... just incase) than the units alive, the condition trips.

Here I've got it working on 5 groups, but you can use it on as many as you need by adding them into the array at the end and changing the last number. ;)

1 (east countside units _x)  --> same as "alive _x" count... etc.
2 (""fleeing _x"" count units _x)

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:The effecientist way to....
« Reply #6 on: 08 Jan 2005, 00:45:15 »
@GRK
Quote
I tried
? "alive _x" count units grp == 0
that is if it's in a script
in a trigger it would be:
"alive _x" count units grp == 0

just like sui said he would do it

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:The effecientist way to....
« Reply #7 on: 08 Jan 2005, 04:36:15 »
I have a similar trigger that is working for me.  It is:

Code: [Select]
{alive _x} count (units group p1 + units group p2 + units group p3) == 0
I generally like to use {} for these types of conditionals and use "" only for string variables because it makes a visible distinction between the two that your eye catches easily (especially when you have to debug syntax errors.

And yes, in a trigger or waypoint condition field you never should put the "?" or "if" in front of booleans.  The condition field in triggers and waypoints already has the "if" built into it.

Now that I have seen Sui's method I am going to change mine!  It is true that you sometimes have that elusive "deserter" that you just can't find and so the trigger never trips and he mission never ends!!
« Last Edit: 08 Jan 2005, 04:44:12 by Raptorsaurus »

Offline AirCav

  • Members
  • *
  • I'm a llama!
Re:The effecientist way to....
« Reply #8 on: 08 Jan 2005, 05:13:16 »
Quote
alive _x" count (units grp1 + units grp2 + units grp3 + units grp4 + units grp5) == 0

I put this line in the condition field, but can't get a response.  At what point is the trigger supposed to check if all the units are alie or not?  Should it be linked to a waypoint?

-Air

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:The effecientist way to....
« Reply #9 on: 08 Jan 2005, 05:17:46 »
you're missing a "
at the beginning there  ;)
it constantly checks....what exactly do you mean?
also, did you define grp1-5 as a group of someone? (noob thing to do but you could have...) :P

Dubieman

  • Guest
Re:The effecientist way to....
« Reply #10 on: 08 Jan 2005, 17:30:36 »
How stupid of me, no ? needed. :P

I'll prolly use Sui's method, but firstly, I have get those wave assualts to actually attack first then my airstrike.... >:( :P :)

BTW, I dunno if I'm gonna use the fleeing bit, these are those crazy little NVA, and these ones are very partial to their wave assualts.  ::)

Oh well, more playtesting and scripting, 1 american squad vs 5 NVA ones.... ::)