3 Domination as a plugin for netquake mods
\r
4 by LordHavoc (lordhavoc@ghdigital.com)
\r
6 How to add domination points to a mod:
\r
7 1. Add this line to progs.src above world.qc:
\r
9 2. Comment out all lines in ClientObituary in client.qc that begin with targ.frags or attacker.frags.
\r
10 3. Add this above worldspawn in world.qc:
\r
12 4. Add this line to the end of worldspawn in world.qc:
\r
15 Note: The only teams who can use dom control points are identified by dom_team entities (if none exist these default to red and blue and use only quake models/sounds).
\r
18 void() dom_spawnteams;
\r
20 void() dompointthink =
\r
23 self.nextthink = time + 3;
\r
24 if (!self.goalentity.netname)
\r
26 head = find(head, classname, "player");
\r
29 if (head.team == self.goalentity.team)
\r
30 head.frags = head.frags + 1;
\r
31 head = find(head, classname, "player");
\r
35 void() dompointtouch =
\r
38 if (other.classname != "player")
\r
40 if (other.health < 1)
\r
42 // only valid teams can claim it
\r
43 head = find(world, classname, "dom_team");
\r
44 while (head && head.team != other.team)
\r
45 head = find(head, classname, "dom_team");
\r
46 if (!head || head.netname == "" || head == self.goalentity)
\r
49 self.goalentity = head;
\r
50 self.model = head.mdl;
\r
51 self.modelindex = head.dmg;
\r
52 self.skin = head.skin;
\r
54 bprint(head.message);
\r
57 if (head.noise != "")
\r
58 sound(self, CHAN_BODY, head.noise, 1, ATTN_NORM);
\r
59 if (head.noise1 != "")
\r
60 sound(self, CHAN_VOICE, head.noise1, 1, ATTN_NONE);
\r
63 /*QUAKED dom_team (0 .5 .8) (-16 -16 -24) (16 16 32)
\r
64 Team declaration for Domination gameplay, this allows you to decide what team
\r
65 names and control point models are used in your map.
\r
67 Note: If you use dom_team entities you must define at least 3 and only two
\r
68 can have netname set! The nameless team owns all control points at start.
\r
72 Name of the team (for example Red, Blue, Green, Yellow, Life, Death, etc)
\r
74 Scoreboard color of the team (for example 4 is red and 13 is blue)
\r
76 Model to use for control points owned by this team (for example
\r
77 "progs/b_g_key.mdl" is a gold keycard, and "progs/b_s_key.mdl" is a silver
\r
80 Skin of the model to use (for team skins on a single model)
\r
82 Sound to play when this team captures a point.
\r
83 (this is a localized sound, like a small alarm or other effect)
\r
85 Narrator speech to play when this team captures a point.
\r
86 (this is a global sound, like "Red team has captured a control point")
\r
88 Message to show when a team captures a point
\r
89 (for example "Red team has captured a control point", or
\r
90 "The forces of light have captured a mana well")
\r
95 precache_model(self.model);
\r
96 if (self.noise != "")
\r
97 precache_sound(self.noise);
\r
98 if (self.noise1 != "")
\r
99 precache_sound(self.noise1);
\r
100 self.classname = "dom_team";
\r
101 setmodel(self, self.model);
\r
102 self.mdl = self.model;
\r
103 self.dmg = self.modelindex;
\r
105 self.modelindex = 0;
\r
106 // this would have to be changed if used in quakeworld
\r
107 self.team = self.cnt + 1;
\r
110 void() dom_controlpoint_setup =
\r
113 // find the dom_team representing unclaimed points
\r
114 head = find(world, classname, "dom_team");
\r
115 while(head && head.netname != "")
\r
116 head = find(head, classname, "dom_team");
\r
118 objerror("no dom_team with netname \"\" found\n");
\r
120 // copy important properties from dom_team entity
\r
121 self.goalentity = head;
\r
122 setmodel(self, head.mdl);
\r
123 self.skin = head.skin;
\r
125 self.think = dompointthink;
\r
126 self.nextthink = time;
\r
127 self.touch = dompointtouch;
\r
128 self.solid = SOLID_TRIGGER;
\r
129 setsize(self, '-16 -16 -24', '16 16 32');
\r
130 setorigin(self, self.origin);
\r
134 /*QUAKED dom_controlpoint (0 .5 .8) (-16 -16 -24) (16 16 32)
\r
135 Control point for Domination gameplay.
\r
137 void() dom_controlpoint =
\r
139 self.think = dom_controlpoint_setup;
\r
140 self.nextthink = time + 0.1;
\r
143 // code from here on is just to support maps that don't have control point and team entities
\r
144 void(string teamname, float teamcolor, string pointmodel, float pointskin, string capsound, string capnarration, string capmessage) dom_spawnteam =
\r
146 local entity oldself;
\r
149 self.classname = "dom_team";
\r
150 self.netname = teamname;
\r
151 self.cnt = teamcolor;
\r
152 self.model = pointmodel;
\r
153 self.skin = pointskin;
\r
154 self.noise = capsound;
\r
155 self.noise1 = capnarration;
\r
156 self.message = capmessage;
\r
158 // this code is identical to dom_team
\r
159 setmodel(self, self.model);
\r
160 self.mdl = self.model;
\r
161 self.dmg = self.modelindex;
\r
163 self.modelindex = 0;
\r
164 // this would have to be changed if used in quakeworld
\r
165 self.team = self.cnt + 1;
\r
171 void(vector org) dom_spawnpoint =
\r
173 local entity oldself;
\r
176 self.classname = "dom_controlpoint";
\r
177 self.think = dom_controlpoint;
\r
178 self.nextthink = time;
\r
180 dom_controlpoint();
\r
184 void() dom_spawnteams =
\r
186 // LordHavoc: edit this if you want to change defaults
\r
187 dom_spawnteam("Red", 4, "models/domination/dom_red.md3", 0, "domination/claim.wav", "", "Red team has captured a control point");
\r
188 dom_spawnteam("Blue", 13, "models/domination/dom_blue.md3", 0, "domination/claim.wav", "", "Blue team has captured a control point");
\r
189 dom_spawnteam("Green", 3, "models/domination/dom_green.md3", 0, "domination/claim.wav", "", "Green team has captured a control point");
\r
190 dom_spawnteam("Yellow", 12, "models/domination/dom_yellow.md3", 0, "domination/claim.wav", "", "Yellow team has captured a control point");
\r
191 dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, "", "", "");
\r
194 void() dom_delayedinit =
\r
197 // if no teams are found, spawn defaults
\r
198 if (find(world, classname, "dom_team") == world)
\r
200 // if no control points are found, spawn defaults
\r
201 if (find(world, classname, "dom_controlpoint") == world)
\r
203 // here follow default domination points for each map
\r
205 if (world.model == "maps/e1m1.bsp")
\r
207 dom_spawnpoint('0 0 0');
\r
212 // if no supported map was found, make every deathmatch spawn a point
\r
213 head = find(world, classname, "info_player_deathmatch");
\r
216 dom_spawnpoint(head.origin);
\r
217 head = find(head, classname, "info_player_deathmatch");
\r
226 // we have to precache default models/sounds even if they might not be
\r
227 // used because worldspawn is executed before any other entities are read,
\r
228 // so we don't even know yet if this map is set up for domination...
\r
229 precache_model("models/domination/dom_red.md3");
\r
230 precache_model("models/domination/dom_blue.md3");
\r
231 precache_model("models/domination/dom_green.md3");
\r
232 precache_model("models/domination/dom_yellow.md3");
\r
233 precache_model("models/domination/dom_unclaimed.md3");
\r
234 precache_sound("domination/claim.wav");
\r
236 e.think = dom_delayedinit;
\r
237 e.nextthink = time + 0.1;
\r