Home   Help Search Login Register  

Author Topic: Activate at height only once  (Read 3963 times)

0 Members and 1 Guest are viewing this topic.

Offline eegore

  • Members
  • *
Activate at height only once
« on: 23 Oct 2011, 00:53:16 »
  Ok so the idea is to teleport a UH-1 wreck "object" to where a live one crashes.  Or is about to crash.

  Problems:

1. Crashes in a different location each time.  (Not a big deal because randomness is good)
2. Once setdamage 1 is selected the unit is "gone" so nothing can teleport to it. Must teleport wreck before the helo dies.
3. I don't know the current height command to set off an event once the helo is at 5m above ground.
4. This helo takes off from the ground so the setdamage command will blow it up before it takes off.  I need a way for it to only activate the trigger if its in hostile territory, not at the FOB.  
 
  Also with this setup I'd like to be able to run it in reverse, as in once a helo lands, loads up units and takes off it blows up about 15m above the ground.  The " crew count command wont work because if someone dies the helo never blows up because the count isnt high enough.  Any ideas?

  Thanks.

  
« Last Edit: 23 Oct 2011, 01:32:21 by eegore »

Offline Loyalguard

  • Former Staff
  • ****
Re: Activate at height only once
« Reply #1 on: 23 Oct 2011, 03:16:53 »
So I assume you are using setDamage 1 to make it crash, is that correct?  What is the "cause" of the crash for the purposes of your scenario?.  Damaged by incoming rounds, "bomb", mechanical failure, etc.?  The reason I ask is that we may be able to use something simple like a killed or dammaged, or HandleDamage event handler to make the wreck teleport, but we may have to change how you are making the helo crash (at least the method but with the same effect)

You say that it is "gone" so nothing can teleport to it.  How are you checking it?  Have you used allDead  or vehicles to see if you can access it?

Offline eegore

  • Members
  • *
Re: Activate at height only once
« Reply #2 on: 23 Oct 2011, 11:23:01 »
  I use setdamage .9 to make the tail rotor fail, for the visual effect.  Then I teleport it off to the edge of the map after about 30 seconds before it actually lands or crashes.  This is because I want the static object wreck for the player to find.  

  The problem I have is that a timed trigger wont always be activated when the damaged helo is low to the ground so I get a floating wreck instead of one on the ground.  All I need is a way to activate a wreck object when a helo is 5m above the ground inside of a certain area.

  Instead of 5m above the ground anywhere on the map.  

  I check it by watching the event happen and seeing the wreck just floating in the air.  Or if the helo crashes before the trigger timer is up then the wreck object never appears. 

  I don't know what allDead or vehicles are.
« Last Edit: 23 Oct 2011, 11:24:53 by eegore »

Offline Loyalguard

  • Former Staff
  • ****
Re: Activate at height only once
« Reply #3 on: 23 Oct 2011, 14:54:48 »
Try this in a trigger condition field:

Code: [Select]
this && (getPosATL (helo select 2) < 5)
This will only activate the trigger when the helo (name it what you want) is less than 5m above the terrain.

Offline F2kSel

  • Members
  • *
Re: Activate at height only once
« Reply #4 on: 23 Oct 2011, 15:23:36 »
You will need to place the wreck on the ground at the right height. A crashed chopper may not actually be at the right height, it could be hung up on a building or wall ect.

This will place the wreck on the ground
Code: [Select]
wreckname setposATL (getposATL helo select 0, getposATL helo select 1,0]

also don't bother moving the old chopper just delete it and the crew.
Code: [Select]
{deleteVehicle _x} forEach crew helo + [helo];

To get it to blow up when the cargo units mount the chopper you can use this in a trigger. You need to name the leader of the second group in this case he's called red.

Code: [Select]
getpos helo select 2 >15 and {_x in helo} count units red == count units red
« Last Edit: 23 Oct 2011, 15:35:33 by F2kSel »

Offline eegore

  • Members
  • *
Re: Activate at height only once
« Reply #5 on: 24 Oct 2011, 06:05:41 »
  Great this information has been helpful. 

  this && (getPosATL (helo select 2) < 5)   says "Type array, expected number"
 
  I never realized that  " this && commands " would make it happen only inside the trigger.  


  Also I realized a major gap in my request.  What is happening is I end up having some civilians join my group then get in an evac helo that flies off without me.  They are supposed to ungroup with me once they are more than 200m away.  (Im working on making that happen, I havent gotten a distance trig to work yet)  

  So the code I was given requires that I be in that helo because I am the group leader.  If they fly off without me the helo survives which is not intended.

  My solution however was to use the invisible H-pad I was teleporting so the damn pilot AI wouldnt get all crazy and put the provided height information in the trigger:

" this and getpos helo select 2 >15 "

  Now the helo is fine until it lands to load the civilians becuse the trig is grouped to an ivis H-pad, then blows when the helo lifts off.
« Last Edit: 24 Oct 2011, 11:32:17 by eegore »

Offline F2kSel

  • Members
  • *
Re: Activate at height only once
« Reply #6 on: 24 Oct 2011, 12:57:13 »
this should work when the rest of the group is in the chopper but not the player.

Code: [Select]
getpos helo select 2 >15 and !(player in helo) and {_x in helo} count units red == (count units red)-1
as for the distance

condition
Code: [Select]
helo distance player > 200on act
Code: [Select]
{[_x]  join grpnull} foreach units red
You will need to add more parameters to the condition or it will ungroup  your units whenever helo is more than 200 meters away.
« Last Edit: 24 Oct 2011, 13:00:27 by F2kSel »

Offline eegore

  • Members
  • *
Re: Activate at height only once
« Reply #7 on: 24 Oct 2011, 15:57:27 »

  Is there a way to put all of the civilians in an arraythat will identify if any of them are less than 200m away?

Con:  [civ1, civ2, civ3] distance player > 200

Activ: [civ1, civ2, civ3] join grpnull 

  This wont work.  Somethings wrong with the condition.

Offline F2kSel

  • Members
  • *
Re: Activate at height only once
« Reply #8 on: 24 Oct 2011, 17:05:51 »
Easy just create the array first.

in a units init or game logic put
Code: [Select]
civunits = [civ1,civ2,civ3]
cond
Code: [Select]
( ({_x distance player > 200} count civunits) != 0 )

or just
cond
Code: [Select]
( ({_x distance player > 200} count [civ1,civ2,civ3]) != 0 )

The first option is better if your going to use the array several times, it saves typing and is easier to adjust.


This will work if you want it to only activate when all the civs are more than 200 meters away.
Code: [Select]
( ({_x distance player > 200} count civunits) == count civunits )

Just a thought though if one civ gets killed you'll need to remove him from the total.
This will check if all the alive civ units are greater than 200meters away from the player
Code: [Select]
( ({_x distance player > 200 and (alive _x)} count civunits) == { alive _x}  count civunits)
« Last Edit: 24 Oct 2011, 17:26:11 by F2kSel »

Offline eegore

  • Members
  • *
Re: Activate at height only once
« Reply #9 on: 25 Oct 2011, 11:29:16 »

  All this is good stuff. 

  Ive always used workarounds but its nice to be more efficient in the execution of commands. 

  I appreciate all the help.