Home   Help Search Login Register  

Author Topic: All Units  (Read 763 times)

0 Members and 1 Guest are viewing this topic.

Dingmatt

  • Guest
All Units
« on: 19 Feb 2005, 14:21:26 »
I need to find a way to effect every unit on the map with a command "setfuel 0", anyone have any ideas?

Dingmatt

Offline Infierie Blou

  • Members
  • *
  • Keep your friends close but your enemies closer
Re:All Units
« Reply #1 on: 19 Feb 2005, 14:28:11 »
how many units?
« Last Edit: 19 Feb 2005, 14:36:06 by inblow »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:All Units
« Reply #2 on: 19 Feb 2005, 14:36:04 »
Trigger:-

Area:  whole map
Condition:  as you like
On Activation:   "_x setFuel 0" forEach thislist

Not guaranteed.  
Plenty of reviewed ArmA missions for you to play

Dingmatt

  • Guest
Re:All Units
« Reply #3 on: 19 Feb 2005, 15:30:27 »
No triggers.... i can't use triggers this is a drop and play unit. as for how many? random, maybe 1 maybe 2000.

Dingmatt

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:All Units
« Reply #4 on: 19 Feb 2005, 16:31:43 »
No idea what you are talking about.   What is "drop and play"?     Don't understand why you can't use triggers.    Don't understand why you didn't mention you couldn't use triggers.    Don't understand why, when I gave a most excellent answer to the question you asked, you didn't either thank me or apologise for not being clearer in what you wanted.

In this particular case it doesn't matter if you can't use a trigger.   All you need is an array of the units and there are several ways of getting it other than using a trigger.
Plenty of reviewed ArmA missions for you to play

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:All Units
« Reply #5 on: 19 Feb 2005, 16:36:28 »
I've never heard of a unit that you can't use triggers with.

Perhaps you can enlighten us further.


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

Dingmatt

  • Guest
Re:All Units
« Reply #6 on: 19 Feb 2005, 18:53:07 »
i cannot use triggers because  the script is part of a addon, independant from any missions. I can't have it needing any setting up on a map. just placed down or "built" then ready to go. you can't createvehicle triggers (as far as i know).

Dingmatt

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:All Units
« Reply #7 on: 19 Feb 2005, 21:04:47 »
IIRC you can theoretically create triggers, but you can't control most of the fields so they aren't really much use.

Since this is an addon question it should probably be on an addon board.

The question is really "How do I grab an array of all the vehicles on the map from inside an addon?".     The setFuel bit is straightfoward once you have the array.
 
« Last Edit: 19 Feb 2005, 21:06:33 by macguba »
Plenty of reviewed ArmA missions for you to play

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:All Units
« Reply #8 on: 19 Feb 2005, 23:22:08 »
All you need to do is to configure an "init" eventhandler in your addon's config. From that EH, you then add the unit to an array. Keep in mind that an error in init EH's makes the eventhandler fire again whenever the unit gets into/out of a vehicle, so you need to make sure you only add the unit to the array once. If you need more info on how to config EHs, I'd post in the addon editing board, as suggested.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Deepsmeg

  • Guest
Re:All Units
« Reply #9 on: 20 Feb 2005, 18:36:09 »
Wouldn't that only add the units that are the addon to the array if it is that unit's EH?

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:All Units
« Reply #10 on: 21 Feb 2005, 03:20:01 »
Quote
Wouldn't that only add the units that are the addon to the array if it is that unit's EH?
Correct. However, I assume that if you are creating this addon, then you can edit the addon's config, and therefore its eventhandlers.

If you want to add units to this array that are NOT from your addon, then you need to either (a) use the suggestions already posted here (i.e. use triggers), or (b) modify the game's core config and change the init EH for the class that these other units are inheriting from.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Deepsmeg

  • Guest
Re:All Units
« Reply #11 on: 21 Feb 2005, 19:52:18 »
The thing is, we need this unit to affect all the other units.

We're getting round it at the moment by detecting everything by doing a NearestObject from a moving thing.

This is obviously not optimal.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:All Units
« Reply #12 on: 22 Feb 2005, 07:13:41 »
Yeah, that is going to be the only way to do it, unless you use a trigger or some other form of input from the mission editor.

So, my suggestion would be to simply put a note into your addon's readme, and hope that the mission editor who uses this addon is smart enough to actually read it, which I would think they would be. :)
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Deepsmeg

  • Guest
Re:All Units
« Reply #13 on: 23 Feb 2005, 02:11:31 »
Users?
Intelligent?

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:All Units
« Reply #14 on: 23 Feb 2005, 04:31:07 »
Tee hee heee  :P :o ::)