-TWC| Forum
Tutorial Adding new entities to Radiant - Printable Version

+- -TWC| Forum (https://board.twcclan.org)
+-- Forum: Offtopic (https://board.twcclan.org/forum-28.html)
+--- Forum: Creativity Corner (https://board.twcclan.org/forum-34.html)
+---- Forum: Mapping (https://board.twcclan.org/forum-55.html)
+---- Thread: Tutorial Adding new entities to Radiant (/thread-173.html)



Adding new entities to Radiant - Destroy666 - 26-02-2012

How to add new, mod specific entities to Radiant?
This tutorial may not be useful for most people, only ETJump, ETRun and Domination mods use new entities.
I'll use trigger_ballonly_multiple and team_powerball entities in this example. First has 2 spawnflags - AXIS_GOAL (1) & ALLIED_GOAL (2) and 1 key - scriptName. Second has no spawnflags and scriptname as key too.

1. .def files - GTK Radiant 1.4

Go to ET->etmain->scripts
Open any file with .def extension using any text editor.
Add this at the end:
Code:
/*QUAKED trigger_ballonly_multiple (.5 .5 .5) ? AXIS_GOAL ALLIED_GOAL -------- KEYS -------- "scriptName" The object name in the script file -------- SPAWNFLAGS -------- AXIS_GOAL only trigger if allied player is trying to make a goal ALLIED_GOAL only trigger if axis player is trying to make a goal -------- NOTES -------- Player must be on the right team and have the powerball it to trigger. It will call the "death" function in the object's script. */

Code:
/*QUAKED team_powerball (1 0 0) (-8 -8 -8) (8 8 8) -------- KEYS -------- "scriptname" name used for scripting purposes -------- SPAWNFLAGS -------- (none) -------- NOTES -------- Used in the Power Ball mod */
title - entity name, in first () is entity color, in second and third () entity size (isn't needed for entities similar to trigger and func - which need to be put on texture). After size and ? there should be spawnflags names, sorted by ascending values (1, 2, 4, 8, 16 etc.)
SPAWNFLAGS - you need to add the names used before in separate lines, next to them are descriptions
KEYS - key needs to be put in "" in separate line, next to it is description
NOTES is entity description
Each entity needs to start with /*QUAKED and end with */

2. .ent files - GTK Radiant 1.5/NetRadiant

Go to NetRadiant/GTK Radiant 1.5 folder -> et.game -> etmain
Open file with .ent extension using any text editor.
Add this (to avoid mess, add trigger_ between two other triggers, team_ between two other teams etc.):

Code:
<group name="trigger_ballonly_multiple" color=".5 .5 .5"> -------- KEYS -------- <string key="scriptname" name="scriptname">object's scriptname</string> -------- SPAWNFLAGS -------- <flag key="AXIS_GOAL" name="AXIS_GOAL" bit="0">Only trigger if Allied player is trying to make a goal.</flag> <flag key="ALLIED_GOAL" name="ALLIED_GOAL" bit="1">Only trigger if Axis player is trying to make a goal.</flag> -------- NOTES -------- Player must be on the right team and have the powerball it to trigger. It will call the "death" function in the object's script. </group>

Code:
<point name="team_powerball" color="1 0 0" box="-8 -8 -8 8 8 8"> -------- KEYS -------- <string key="scriptname" name="scriptname">Name of script block for entity</string> -------- SPAWNFLAGS -------- (none) -------- NOTES -------- Used in the Power Ball mod </point>

As you can see, .ent file uses another structure (XML). There are also more specifications like <point> for some entities and <group> for another. The best way to add new entities is to look at similar ones (for example for trigger_ballonly_multiple that would be trigger_flagonly_multiple) and edit them.

Tutorial written by Destroy666. If you want to copy it to your site, please include the author and link to this thread.