Post tutorial Report RSS Advanced Spawner

How triggers work in Lithtech to add functions to things like doors and enemies

Posted by on - Advanced Mapping/Technical

Tutorial originally posted on Fileplanet. Mirrored here for archival purposes. Originally written by Peewee_RotA


Blood 2: Maps
Advanced Spawner

In Dedit v1.0 for Blood 2 the spawner is a target entitiy that needs to be triggered like a door which is fairly simple. One of the advanced concepts that is not very well documented is the spawn command. I will now try to document that.

Now it's a different tutorial for a different time but communication between objects in the lithtech engine, specifcally triggers, act similar to Windows Messages between windows. A trigger sends a "message" to the name of an object. For example to activate a door named "Door1" you would set up a trigger with the TriggerName1 property of Door1 and the message property of TRIGGER. Now it sends the TRIGGER message to the door named "door1" which activates the TRIGGER event of the door class. In the case of a spawner when you send a TRIGGER message to a spawner it activates the spawner's TRIGGER event which spawns an object.

If you follow me so far get ready to be confused. Specific objects react to different messages. It's all based on what event is associated with that message. Most objects react to TRIGGER but some others, like the spawner, react to other messages as well. One of the messages that the spawner object specifically reacts to is the "spawn command." The only problem is that the spawn command is not a message that is sent to the spawner but is instead a message it sends itself after being triggered.

Now that you're thoroughly confused I'll say that again even simply. When the spawn object is sent the TRIGGER message the event it causes is the spawn command. So basically to use this spawn command all you need to do is edit your SpawnObject property. All tutorials of the spawner up until this point describe the spawn command as a seperate message sent to the spawner object when it is in fact simply a type of script you put inside the SpawnObject property.

So really all we do to use this spawn command message is add more information to our SpawnObject property. For example, lets say that you have a spawner named "Enemy1" and you wanted it to spawn a SoulDrudge with RandomHitPoints of 200. You would create a trigger with a TargetName1 of Enemy1 and a message of TRIGGER. Now in the spawner properties under SpawnObject you would put:
SoulDrudge RandomHitPoints 200;

Now when you hit that trigger a SoulDrudge will spawn with this extra property aplied to him. But lets say you want to have that spawned Soul Drudge activate a door elsewhere when he dies. Now you would create that door and name it say "SoulDeadDoor." All you need to do is go back and edit your SpawnObject again to say:
SoulDrudge RandomHitPoints 200; DeathTriggerTarget SoulDeadDoor; DeathTriggerMessage TRIGGER;

Now when that Soul Drudge dies it will activate that door. There are lots of other properties that you can add to the list using the spawn command. In order to add more properties all you need to do is add a semi-colon, the property name and then the value.

The syntax for the spawn command is:
ObjectName Property1 Value; Property2 Value; Property3 Value;

Now Dedit has 2 quirks that you'll want to remember when you do this. First of all Dedit and the Lithtech engine are case sensitive so be sure to make the word TRIGGER is in all caps and that you capitalize the same letters in the name of whatever your triggering.

In order to see the exact property names of an object that you want to specify you'll probably have to add that object and view it's properties so that you can copy it down exactly. The problem is the other quirk in Dedit which is the properties tab has a tendency not to show the entire property name when you try to view the properties of the selected node. So to fix this simply expand the size of the tab by using the resize bar on the right of the properties tab.

Also remember that the name of your object that your spawning needs to be exact so to get a list of what objects you want to spawn just click on one of the view panes, right click and select the "Add Object..." button and then copy down the exact spelling from that list. After you have the exact case and spelling just press cancel on the Add Object dialog box.

If you have any problems then it's probably a misspelling somewhere along the line so keep track of what all the names of the nodes are, if you spelled the object names right, and if you spelled the property names right. I find it usefull to add one of whatever object that I'm trying to spawn right next to the spawner for my reference and then delete that extra node after I know the spawner works.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: