Home   Help Search Login Register  

Author Topic: Condition of Presence - Not Alive  (Read 1430 times)

0 Members and 1 Guest are viewing this topic.

Offline XCess

  • Former Staff
  • ****
Condition of Presence - Not Alive
« on: 18 Aug 2006, 02:27:19 »
I'm trying to build a randomised mission which contains two seperate convoys on different routes and different layouts.
I only want one convoy to display in each play of the mission. So I set the probability of presence of the first convoy leader to 50% and the rest of the vehicles condition of presence to (alive leadConvoy).
THen I did the same for the second convoy, but instead of 50% probability, I used !(alive leadConvoy) in probability of presence, so if the other convoy wasn't around the second one would appear. However, this doesn't work.

Is there any other way to make a unit appear if another doesn't? Or am I just doing something wrong?

I'm trying to keep scripts to a minimum as this is designed for a multiplayer coop, and I have no experience whatsoever in scripting for multiplayer, although sp scripting isn't a problem.
« Last Edit: 18 Aug 2006, 02:28:53 by XCess »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: Condition of Presence - Not Alive
« Reply #1 on: 18 Aug 2006, 08:58:24 »
I too struggled with this.  The problem is as follows: if the unit1 does not exist then any boolean expression using unit1 will return false, even not (alive unit1) will be false!

This is a general point any undefined variable used in a boolean expression will always make the expression return false.

Without spending a lot of time experimenting for you all I can suggest is to create both convoys and  have a script that deletes one of them.  This could probably be done without a script by putting something like this in the init field of one of your convoy leaders.  I have no real experience of MP so others would need to help.

if (random 100 > 50) then {{deleteVehicle _x} forEach units group this} else {{deleteVehicle _x} forEach units othergroup}

You would need to experiment with this but it gives you the idea

« Last Edit: 18 Aug 2006, 13:52:06 by THobson »

Offline XCess

  • Former Staff
  • ****
Re: Condition of Presence - Not Alive
« Reply #2 on: 18 Aug 2006, 12:13:39 »
Thanks THobson, I'll go givt hat a try.

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re: Condition of Presence - Not Alive
« Reply #3 on: 18 Aug 2006, 12:44:58 »
Thobson's suggested method will work in MP as long as the script that defines the random variable runs only on the server. The deletevehicle command will be executed on all machines, even if it's run locally. I have used the suggested method myself with good results several times.
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline XCess

  • Former Staff
  • ****
Re: Condition of Presence - Not Alive
« Reply #4 on: 18 Aug 2006, 12:52:39 »
I'm encountering a problem..
if (random 50 > 100) then {{deleteVehicle _x} forEach units group this}#} else {{deleteVehicle _x} forEach units othergroup}
Error, Unknown operator.

So I moved it out of yhr init and into a script, but had the same problm (ofcourse I'm replacing this and othergroup with group unitName.

Also, shouldn't it be random 100 > 50?
« Last Edit: 18 Aug 2006, 12:55:51 by XCess »

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re: Condition of Presence - Not Alive
« Reply #5 on: 18 Aug 2006, 13:04:06 »
I interpreted Thobsons code as a suggestion, not a correct syntax. Here's a working example you can put directly in init.sqs of any mission (MP or SP):

Code: [Select]
? !(local server): exit

_nomin_random = random 1

? _nomin_random <= 0.5: {deleteVehicle _x} forEach units nomin_convoy1; deletevehicle nomin_convoyTruck1
? _nomin_random > 0.5: {deleteVehicle _x} forEach units nomin_convoy2; ; deletevehicle nomin_convoyTruck2

exit

nomin_convoy1 and 2 are group names and refers to all the units in the group. nomin_convoyTruck1 and 2 are the names of the vehicles themselves. You have to name and delete the vehicles too, otherwise the empty trucks will be standing there when the mission starts. Obviously the ? !(local server): exit will only work in an MP game, where there's a game logic named server on the map.
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re: Condition of Presence - Not Alive
« Reply #6 on: 18 Aug 2006, 13:05:05 »
Code: [Select]
if (random 50 > 100) then {{deleteVehicle _x} forEach units group this} else {{deleteVehicle _x} forEach units othergroup}
There was an extra }

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: Condition of Presence - Not Alive
« Reply #7 on: 18 Aug 2006, 13:51:21 »
Baddo, thank you.  There was indeed an extra } :-[

Also yes I typed it the wrong way round it should be
random 100 > 50  :-[

I have fixed the original post

EDIT:

Also on reflection - putting something like this in the init field is not a good idea because it requires the init field of othergroup to be executed first, otherwise the name of that group would not be defined.
« Last Edit: 18 Aug 2006, 14:19:16 by THobson »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re: Condition of Presence - Not Alive
« Reply #8 on: 18 Aug 2006, 15:23:13 »
Chuck it in a trigger with Condition: True.    Triggers are executed after init fields, so you know the units will have been created.     
Plenty of reviewed ArmA missions for you to play

Offline XCess

  • Former Staff
  • ****
Re: Condition of Presence - Not Alive
« Reply #9 on: 18 Aug 2006, 15:26:18 »
Thank you all for your help :)
I'm gonna go test in a little while and report back soon on whether it's working yet or not.

*edit*
worked perfectly, thankyou all :)
« Last Edit: 18 Aug 2006, 19:02:42 by XCess »