Atdm:target postscriptevent: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Tels (talk | contribs)
Add an example and default values
add note about target_postscriptevent not working as expected and offering workaround
 
(One intermediate revision by one other user not shown)
Line 51: Line 51:


On the right is a screenshot with a trigger, that when triggered, will use the shown atdm:target_postscriptevent entity to delete the linked torch after 1 second delay:
On the right is a screenshot with a trigger, that when triggered, will use the shown atdm:target_postscriptevent entity to delete the linked torch after 1 second delay:
'''NOTE:''' This doesn't seem to work and results in the error: "'''IDEvent::Alloc: Wrong number of args for 'remove' event'''".  You can accomplish the same goal in a similar fashion by using a '''func_remove''' entity instead.


{{clear}}
{{clear}}
== See also ==
[[atdm:target_callobjectfunction]]


{{editing}}
{{editing}}

Latest revision as of 18:57, 13 March 2024

Introduction

The entity atdm::target_postscriptevent is a useful entity to call one script function (aka "post the script event to the entity") on multiple entities.

The entity is used for instance by atdm:teleport to teleport one or more entities.

Spawnargs

The following spawnargs can be used on this entity:

event

The event spawnarg gives the name of the script event. Examples of events with pass_self false ("0"):

  • "Off", "On" (for lights)
  • "remove" (deletes that entity)
  • "activate" (activate that entity)
  • "activateTargets"

Examples of events with pass_self true ("1"):

  • "teleportTo"

and so on. A full list of available events can be found in the files script/doom_events.script and script/tdm_events.script.

delay (float, default: 0)

The delay spawnarg specifies an initial delay in seconds, before the first event will be fired.

wait (float, default: 0)

The wait spawnarg specifies the delay in seconds between each subsequent event (e.g. between one and the next target).

pass_self (bool, default: false)

For certain events that require as parameter an entity, you can set pass_self to true. The event will then get the trigger entity passed along as first parameter. Useful and mandatory for instance for teleportTo.

propagate_to_team (bool, default: false)

If propagate_to_team is set to true ("1"), then the event will also be posted to any bound children of the targeted entities. This is important if you target combined light entities, like a candle holder. Instead of sending Off() to the holder, you want it to arrive at the flame, but cannot target the flame in your map because it does not exist yet.

Events that are not suited for one type of entity (like Off() for non-lights) will be safely filtered out, so you can target them without worry at the base entity.

Note: Turning of lights on combined entities does not yet work, I am working on it.

Examples

How to delete entities

On the right is a screenshot with a trigger, that when triggered, will use the shown atdm:target_postscriptevent entity to delete the linked torch after 1 second delay:

NOTE: This doesn't seem to work and results in the error: "IDEvent::Alloc: Wrong number of args for 'remove' event". You can accomplish the same goal in a similar fashion by using a func_remove entity instead.

See also

atdm:target_callobjectfunction