Home   Help Search Login Register  

Author Topic: Listing Objects not vehicles  (Read 624 times)

0 Members and 1 Guest are viewing this topic.

Critical_Bill

  • Guest
Listing Objects not vehicles
« on: 26 May 2005, 16:24:32 »
Hello

I know you can return an list of units with a trigger set to Anybody (called 'everything' for example) and a bit of script like:
Code: [Select]
_list = list everything
But is there a way of getting a list of certain Objects? Say you wanted every ammo crate in the list or something? Can this be done?

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Listing Objects not vehicles
« Reply #1 on: 26 May 2005, 17:33:29 »
try playing with this.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Listing Objects not vehicles
« Reply #2 on: 26 May 2005, 21:34:27 »
There is no way of automatically doing it. Sorry, you will have to do it by hand. :) Meaning, you have to manually construct an array with all of the ammocrates in it.

So, lets say you have 3 ammo crates, named a1, a2, and a3. Then, in your init.sqs, you would just need to place a line like this:

ammo_crates = [a1, a2, a3]

Now the global variable "ammo_crates" will contain all 3 of your crates. Simple, eh? But what if you have lots of crates, and you don't want to name them all? Well, you could make a simple script to be run from each crate's init field, which adds them to the variable. So in each crate's init field, you would put this:

this exec "addtovar.sqs"

addtovar.sqs:
Code: [Select]
~0.1 + random 0.1
ammo_crates = ammo_crates + [_this]
exit
And finally, in your init.sqs:

ammo_crates = []

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!

Critical_Bill

  • Guest
Re:Listing Objects not vehicles
« Reply #3 on: 26 May 2005, 22:15:01 »
gah! thanks baron.