2 // attacker spawn point
3 void info_player_attacker() {
4 self.team = COLOR_TEAM1; // red, gets swapped every round
5 info_player_deathmatch();
8 // defender spawn point
9 void info_player_defender() {
10 self.team = COLOR_TEAM2; // blue, gets swapped every round
11 info_player_deathmatch();
14 // reset this objective. Used when spawning an objective
15 // and when a new round starts
16 void assault_objective_reset() {
17 if(self.spawnflags) { // first objective
19 self.nextthink = time + 0.1;
21 self.health = ASSAULT_VALUE_INACTIVE;
25 void assault_objective_use() {
28 self.nextthink = time + 0.1;
31 void assault_objective_think() {
35 ent = find(world, targetname, self.target);
39 self.nextthink = time + 0.1;
44 void target_objective() {
45 self.classname = "target_objective";
46 self.think = assault_objective_think;
47 self.use = assault_objective_use;
48 assault_objective_reset();
51 // decrease the health of targeted objectives
52 void assault_objective_decrease() {
53 // can only be triggered once per round
59 ent = find(world, targetname, self.target);
61 ent.health = ent.health - self.dmg;
62 ent = find(ent, targetname, self.target);
68 // this entity should target an objective and be targeted by triggers
69 void target_objective_decrease() {
71 self.classname = "target_objective_decrease";
76 self.use = assault_objective_decrease;
80 // reset objectives, toggle spawnpoints, reset triggers, ...
81 void assault_new_round() {
83 // this assumes self.classname == "func_assault_roundend"!
84 self.cnt = self.cnt + 1;
86 // swap spawn point teams
90 ent = find(world, classname, "info_player_deathmatch");
95 if(self.team == COLOR_TEAM1) {
96 self.team = COLOR_TEAM2;
98 self.team = COLOR_TEAM1;
102 ent = find(ent, classname, "info_player_deathmatch");
105 // reset all objectives
106 ent = find(world, classname, "target_objective");
111 assault_objective_reset();
114 ent = find(ent, classname, "target_objective");
117 // reset all target_objective_decrease
118 ent = find(world, classname, "target_objective_decrease");
122 ent = find(ent, classname, "target_objective_decrease");
126 // actually restart round... how to do that?
129 void target_assault_roundend() {
130 self.cnt = 0; // round counter
131 self.classname = "target_assault_roundend";
132 self.use = assault_new_round;