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/ | Type | Mandatory | Description | Game version |
|---|---|---|---|---|
<Label> | String | 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 | 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");
}