$customHeader
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

Organise game objects in to groups for easier iteration...

 

What are groups?

Groups are collections of Game objects. There are several benefits to using groups instead of custom arrays:

  • Objects will be removed from groups automatically if they are destroyed or moved to another group
  • Groups allow rapid access to the objects within them via enumGroup(), whereas custom arrays would require lots of function calls
  • Groups persist the save/load cycle, whereas custom arrays would prove problematic
  • Map-placed objects can be grouped and exposed to scripts via Labels (retrieve a Group Object using getObject()).

Note: Groups in the scripting environment are not the same as groups that a human player can set, they do not have shortcut keys, etc.

Which objects can be grouped?

Warzone 3.1

(tick) Droid object

(error) Feature object

(error) Structure object

(error) Other player's objects

(warning) In 3.1 RC3 and earlier, empty groups were automatically deleted (bug #3684).

Warzone 3.2+

(tick) Droid object

(tick) Feature object

(tick) Structure object

(tick) Other players objects

All versions

(info) Droid objects have a .group property stating which group they are in

(info) An object can only be in one of your groups at a time

(info) There are no reachable limits on the number of groups or the number of items in a group

How do I create groups?

There are four ways to create groups:

  • Use a map editor, like FlaME, to group objects (the groups are stored in labels.ini)
  • Define them manually in the labels.ini file associated with a map
  • Use the newGroup() function to create a group at runtime
  • Put an object in a group that doesn't exist yet (requires Warzone 3.2 or above)

Are they private to my scripts?

Groups created by your script are private and only your script can see them.

Groups defined by a map (in labels.ini) are available to all players.

It's not clear what will happen if a script tries to update a map-defined group.

Are they persistent?

As stated earlier, groups and the objects they contain will persist the save/load cycle.

When you start a new game, the original map-defined (in labels.ini) groups will be reinstated.

Availability 3.1+

Requires:

  • Warzone 3.1 or above
  • Lots of improvements in Warzone 3.2
Contents

Jump to:

Scripting: Groups

Related Objects:

 Create them:

  • newGroup() – create a new group
  • WZ 3.2+ – add to a group that doesn't exist yet
  • labels.ini – group map-placed objects

Add things to them:

Remove things from them:

  • Put them in some other group

Count objects in them:

List them:

Retrieve their objects:

Monitor them:

Remove them:

  • not currently possible

 

  • No labels