The launch event is for the emitter, not the emitted object. If you want there to be a sound effect when the creature is created. If not, just ignore it. (This wasn't part of the original script, it just seemed like a fun addition.)
So after wrestling with GitHub for half an hour, I got this weeks builds uploaded.
Code:
/**
* Script: FireShadowEcology
* Inherits: BaseScript
* Messages: TweqComplete
* Links: ControlDevice, Firer
* Properties: Tweq\Flicker
*
* Respawn a creature after it dies. A ``Tweq\Flicker`` fires to test if the
* creature needs to be spawned. The tweq flags can be set to only fire when
* the player is not looking at the spawn point. That way the creature will
* only appear offscreen. The creature archetype to spawn is linked to with
* ``ControlDevice``. When spawned, a ``Firer`` link is set from the creature
* to the spawn point. A new creature is spawned only when there is no ``Firer``
* link to this object.
*/
/**
* Script: FireShadowFlee
* Inherits: BaseScript
* Messages: Slain
* Links: CorpsePart
* Properties: Creature\TimeWarp
* Metaproperties: M-FireShadowFlee
*
* A creature that flees when killed. On ``Slain``, the creature drops its
* ``CorpsePart`` linked objects and gets the ``M-FireShadowFlee`` metaproperty.
* The creature speed is accelerated until it disappears from the player's
* view, or after 15 seconds. Then it is destroyed.
*/
/**
* Script: TrapProperty
* Inherits: BaseTrap
* Links: ScriptParams(??property??)
*
* Change the properties on linked objects. Sets the property when turned on,
* or deletes it when turned off. The link data is the short name of the
* property to set or unset. If the data begins with $$@$$ then the data is
* the name of an object and all properties from that object will be copied to
* the linked object when turned on.
*/
/**
* Script: PropertyScript
* Inherits: BaseTrap
* Links: ControlDevice
* Parameter: property(string) - Name of the property to modify.
* Parameter: fields(string) - List of property fields.
* Parameter: onvalue(string) - Value or list of values to set when turned on.
* Parameter: offvalue(string) - Value or list of values to set when turned off.
*
* Modifies the value of a property on linked objects. The property name is the
* short name of the property as listed by ``list_props``. Simple properties do
* not need a $$fields$$ parameter and the value parameter is a single string.
* If the property has multiple fields, then the value parameter is a list of
* comma-separated values. With the $$fields$$ parameter, only the named fields
* are modified and the value parameter is a list that corresponds to those fields.
* Fields that don't have a listed value are unchanged. If either $$onvalue$$ or
* $$offvalue$$ is omitted, then the property is not changed for that switch.
*
* Property fields are named with an abbreviated format. Take the original name,
* as displayed in the Dromed object editor, and ignore anything that isn't a letter
* or number. Match the first field that starts with the name given in the $$fields$$
* parameter. The parameter name can end with a number enclosed in square braces.
* This is the subscript and will match the n-th field that starts with the name.
* So ''A[1]'' will match the first field that has the first letter ''A'', and
* ''A[2]'' will match the second field that starts with ''A''.
*
* Values are either a string, number, boolean, or vector. Multiple values are given as
* a list of values separated by commas. Any value in the list can be enclosed in
* parentheses. A pair of parentheses with nothing in-between is a null value and indicates
* that field should not be changed. An empty value not in parentheses is a blank string.
* A vector is three number separated by commas. Because commas are used between values,
* a vector in a list must be enclosed in parentheses.
*/
The PropertyScript is just using the built-in field parsers for now. This means you have to type the values the same way they appear in Dromed's dialog boxes.
In LgScript I've put in functions for creating object & links as userdata, but don't yet have support for using them in functions. But you can use them as:
Code:
local aLink = lgs.link(link_id_as_number)
print(aLink.id, aLink.source, aLink.dest, aLink.flavor)
print(aLink:Get()) -- returns dest,source,flavor
print(aLink:GetData(field_name))
aLink:SetData(...) -- this doesn't work yet
local anObj = lgs.object(objid_or_name)
print(anObj.id, anObj.archetype, anObj.name)
print(anObj.position, anObj.facing)
print(anObj:Exists(), anObj:HasMetaProperty(mp), anObj:InheritsFrom(archetype))
anObj:SetName("IAmNotAnObject")
You get the picture. Suggestions are welcome. I'll probably add a Teleport method to objects. And make it so wherever an object is expected, you can pass either a lgs.object, a number, or a string.
PS. ''heap_dump_modules'' ;)