Home   Help Search Login Register  

Author Topic: Make a unit appear when another has been destroyed ????  (Read 831 times)

0 Members and 1 Guest are viewing this topic.

merby1

  • Guest
How do I make a second group of units appear when 'SOLDIER2' has been killed so i dont have to slow the computer with 30 units on screen at once.

I tried putting the following into the 'Condition of presence' box under 'Edit unit' "not (alive SOLDER2)" am I close?

Please tell me what to do while makeing it as simple as posible as I havent learnt a great deal of scripting yet. I dont mind what meth
od you use.



Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Make a unit appear when another has been destroyed ????
« Reply #1 on: 26 Feb 2004, 10:56:19 »
I think 'conditition of presence' is checked for each unit when the mission is being loaded. So you can't have it check for a condition during the game.

You'd need to use setpos instead.

Have a trigger detect if the soldier is alive or not

Trigger:
radius: 0x0
condition: !alive soldier2
on activation: "marker1" setmarkerpos getpos soldier2; "_x setpos getmarkerpos {marker1}" foreach units group1


Place a new marker on the map

Marker:
name: marker1
type: empty


Place a group of soldiers on the map and in the leaders init field type
group1 = group this



This won't look pretty, because all the units in the group will be setpossed on the same spot.. you'll have to tweak it, which can be done easy with a small script. Actually a script would make the entire thing a bit more clear and give it a better handling.

//edit

btw you made two posts about this.. The other one had also a question about deleting units.

Deleting units can be done with the deletevehicle command. The syntax is
deletevehicle unitname
« Last Edit: 26 Feb 2004, 10:58:42 by Artak »
Not all is lost.

Offline IceShade

  • Members
  • *
Re:Make a unit appear when another has been destroyed ????
« Reply #2 on: 26 Feb 2004, 14:46:57 »
Say, for the "alive" checker.. Can't you also use

getdammage unitname == 1.0     ?

That will activate the trigger when the unit has been killed/destroyed. Or is it different?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Make a unit appear when another has been destroyed ????
« Reply #3 on: 26 Feb 2004, 15:13:43 »
Well, yes you can, but it's usually a bad idea to make anything happen with a ==.     Tiny rounding errors can creep in.     What happens if the damage is 0.99999999999999999?    It's possible that that may count as "not alive", but it wouldn't fire a getdammage == 1 trigger.

As a good rule of thumb, test what you actually want to test.    Here, you want to test whether the unit is alive or not.  There is acommand for that, so that is the best way of testing it.

getDammage triggers are much more useful for something like

Condition:  getDammage tank1 > 0.9
On Activation:     tank1 setDammage 1
Plenty of reviewed ArmA missions for you to play

Offline IceShade

  • Members
  • *
Re:Make a unit appear when another has been destroyed ????
« Reply #4 on: 26 Feb 2004, 15:41:55 »
Not to hi-jack this thread, but thanks for the info.

I tried 3 kill detectors myself (!alive, not (alive unitname), getdammage unitname == 1.0) and !alive seemed to be the perfect one.
I used the getdammage one before and I had to shoot another bullet in the enemy's body to make sure the trigger actually got activated ;)

I agree, the getdammage is more useful if you use it for, let's say, damaged units. I use the command to make units scream for medics..

repeating trigger (unit might heal!)
getdammage unitname > .2  (around that area, .3 could be fine too)
unitname sidechat "ouchie."

The possibilities :P

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Make a unit appear when another has been destroyed ????
« Reply #5 on: 26 Feb 2004, 16:28:34 »
You're not hijacking a thread as long as you keep it relevant to the original question.

!alive and not alive should be the same.   What was the difference?

You are exactly right in your appreciation of the kind of thing that getDammage can be used for.

For vehicles, !alive isn't very good.   Sometimes the vehicle looks destroyed but is not.   A better way, certainly for armour, is:-

(not (canMove BMP1)) and (not (canFire BMP1))

Sometimes, though not always, it's approriate to add !alive terms for the crew.

merby1, Artak is right.   The condition of presence field only operates at the start of the mission.
« Last Edit: 26 Feb 2004, 16:29:37 by macguba »
Plenty of reviewed ArmA missions for you to play

Offline IceShade

  • Members
  • *
Re:Make a unit appear when another has been destroyed ????
« Reply #6 on: 26 Feb 2004, 17:47:11 »
Alas, it should be the same. Perhaps it is. I tried both before (quite some time back I guess) and not (alive) didn't seem to work out as good as !alive did... e.g. the trigger didn't work when I used not (alive).

Hmpf. Saying it was quite some time back, I assume I did something wrong. Oh, and this might be a strange coincidence but merby1 stated in his (duplicate, already locked) post that 'not (alive Soldier2)' did not work and '!alive soldier2' should work.

I'll shut up now  ;D

merby1

  • Guest
Re:Make a unit appear when another has been destroyed ????
« Reply #7 on: 28 Feb 2004, 15:33:07 »
SOLDIER2 really doesn't want to respawn :(

I have the !alive detector working fine but that
""marker1" setmarkerpos getpos soldier2; "_x setpos getmarkerpos {marker1}""  script has some errors when i paste it in.  Sorry I really cant work it out for myself. The "{marker1}" comes up with invalid number in expression and the "_x" comes up with "local variable in global space"

Thanks,
           Very confused mission editor

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Make a unit appear when another has been destroyed ????
« Reply #8 on: 28 Feb 2004, 17:32:19 »
If you're using _x then you need a forEach or count command somewhere.
Plenty of reviewed ArmA missions for you to play

merby1

  • Guest
Re:Make a unit appear when another has been destroyed ????
« Reply #9 on: 29 Feb 2004, 09:29:49 »
Even when I put: "marker1 setmarkerpos getpos soldier2; soldier2 setpos getmarkerpos {marker1}"
it still doesnt what to work. This problem has beaten me. Can some one maybe make an example mission. I need to work this out before Flashpoint 2015 comes out :(

merby1

  • Guest
Re:Make a unit appear when another has been destroyed ????
« Reply #10 on: 17 Mar 2004, 04:14:11 »
Hrmm, still getting errors  ???

Something to do with getpos and getmarkerpos, its says:
"_x setpos getmarkerpos
  • {marker1}" : Invalid Expression


Can some1 plz look at my test mission and see if you can fix it up or tell me how to as I dont have a good understanding of getpos commands.

Also, how should I make the unit initially not present?

Thanks,

Merby


Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Make a unit appear when another has been destroyed ????
« Reply #11 on: 17 Mar 2004, 11:40:35 »
I've just tried that little mission and it all seemed to work fine.  No error messages.   The trigger doesn't teleport any of the three units from their starting positions because they are already at the right place:   I put one on "none" rather than "in formation" and it worked fine.

At this point I don't know what the problem is.   You seem to understand getpos setpos just fine.

If you want a unit to be not present, just set his probability of presence to zero and he won't appear in the mission.
Plenty of reviewed ArmA missions for you to play

merby1

  • Guest
Re:Make a unit appear when another has been destroyed ????
« Reply #12 on: 17 Mar 2004, 14:16:06 »
Maybe this script is for a newer version than mine.

Basically what I'm trying to do is have a unit absent at the start of the game, and when some thing happens (eg. activate the trigger by walking out of the area) the unit appears. If that worked for you then it must be my version.

Plleaaaassseee make it work  :-\


Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Make a unit appear when another has been destroyed ????
« Reply #13 on: 17 Mar 2004, 15:45:14 »
Ah well in that case you need a createUnit command.    There are examples in the online command ref in the Ed Depot.
Plenty of reviewed ArmA missions for you to play

merby1

  • Guest
Re:Make a unit appear when another has been destroyed ????
« Reply #14 on: 19 Mar 2004, 17:13:17 »
ahhhh i see, thanks very much :).

But is it possible to give the unit waypoints or script if they dont have a name and dont appear on the mission editor screen.

I think i might make the unit dead to start with and then come alive (setdammage -1) when they are needed. Will this use any cpu if the unit is not alive?