(info) Other great resources: Official JS API docs, Scripting Forum

eventArea<Label>()

An event that's triggered when a droid enters a labelled Area object...

 

Syntax

// see important notes about event name and usage below!
function eventArea<Label>(droid) {
  // do stuff
}

Parameters & References

Parameter/
Reference
TypeMandatoryDescriptionGame version
<Label>

String

(tick)

The name of the label associated with the Area object is part of the event name.

For example, if there is an Area object with label "Foo", the event will be called "eventAreaFoo()".

3.2
droid

Droid object

(tick)

The droid that entered the area.

3.2

Return value

Warzone does not process the event handler's return value.

Notes

The event only triggers once when a droid first enters it. If you want the event to trigger again in the future, you'll need to reset the area trigger using the resetArea() function (see example below).

You can define labelled Area objects at runtime and use them to trigger this event. For more information and example code, see: addLabel().

Example

Work out who our main aggressors are
// assuming we've labelled an area Foo
function eventAreaFoo(droid) {
	// let's reset the area so it triggers again in future
	resetArea("Foo");
}
Availability 3.2+

Requires:

  • Warzone 3.2

See forum topic for more information.

Contents

Jump to:

Scripting: Labels

Related Objects:

 Create them:

List them:

  • getLabel() – get first label associated with a specific object
  • enumLabels() – get a list of all labels

Retrieve their objects:

  • getObject() – get object associated with a label
  • label() – use this instead on WZ 3.1

Monitor them:

Remove them:

Â