1
0
Fork 0
forked from fte/fteqw
fteqw/quakec/fallout2/hos.qc

306 lines
5.9 KiB
C++
Raw Normal View History

void (float xx) hos_forward;
void () hos_stand1 = [ 11, hos_stand2 ]
{
};
void () hos_stand2 = [ 12, hos_stand3 ]
{
};
void () hos_stand3 = [ 13, hos_stand4 ]
{
};
void () hos_stand4 = [ 14, hos_stand5 ]
{
};
void () hos_stand5 = [ 15, hos_stand1 ]
{
};
void () hos_run1 = [ 0, hos_run2 ]
{
ai_forward(5);
};
void () hos_run2 = [ 1, hos_run3 ]
{
ai_forward(5);
};
void () hos_run3 = [ 2, hos_run4 ]
{
ai_forward(5);
};
void () hos_run4 = [ 3, hos_run5 ]
{
ai_forward(5);
};
void () hos_run5 = [ 4, hos_run6 ]
{
ai_forward(5);
};
void () hos_run6 = [ 5, hos_run1 ]
{
ai_forward(5);
};
void () hos_walk1 = [ 16, hos_walk2 ]
{
ai_forward(5);
};
void () hos_walk2 = [ 17, hos_walk3 ]
{
ai_forward(5);
};
void () hos_walk3 = [ 18, hos_walk4 ]
{
ai_forward(5);
};
void () hos_walk4 = [ 19, hos_walk5 ]
{
ai_forward(5);
};
void () hos_walk5 = [ 20, hos_walk6 ]
{
ai_forward(5);
};
void () hos_walk6 = [ 21, hos_walk7 ]
{
ai_forward(5);
};
void () hos_walk7 = [ 22, hos_walk8 ]
{
self.angles_y = random()*360;
ai_forward(5);
};
void () hos_walk8 = [ 23, hos_walk9 ]
{
ai_forward(5);
};
void () hos_walk9 = [ 24, hos_walk10 ]
{
ai_forward(5);
};
void () hos_walk10 = [ 25, hos_walk1 ]
{
ai_forward(5);
};
void () hos_deatha1 = [ 6, hos_deatha2 ]
{
};
void () hos_deatha2 = [ 7, hos_deatha3 ]
{
};
void () hos_deatha3 = [ 8, hos_deatha4 ]
{
};
void () hos_deatha4 = [ 9, hos_deatha5 ]
{
};
void () hos_deatha5 = [ 10, hos_deatha5 ]
{
};
void (float xx) hos_forward =
{
local float rng;
local entity te;
local string qqq;
local float qq;
local float dir1;
local float dir2;
self.movetype = MOVETYPE_STEP;
if ((self.cnt == MULTICAST_ALL))
{
return;
}
self.goalentity = self.friend;
if ((vlen ((self.origin - self.goalentity.origin)) > 96))
{
movetogoal ((SECRET_1ST_DOWN * xx));
self.angles = vectoangles ((self.goalentity.origin - self.origin));
traceline (self.origin, ((self.origin + (v_right * SVC_BIGKICK)) + (v_forward * 90)), FALSE, self);
dir1 = trace_fraction;
traceline (self.origin, ((self.origin + (v_right * 50)) + (v_forward * 90)), FALSE, self);
dir1 = (dir1 + trace_fraction);
traceline (self.origin, ((self.origin + (v_right * 70)) + (v_forward * 90)), FALSE, self);
dir1 = (dir1 + trace_fraction);
traceline (self.origin, ((self.origin + (v_right * 90)) + (v_forward * 90)), FALSE, self);
dir1 = (dir1 + trace_fraction);
traceline (self.origin, ((self.origin + (v_right * 110)) + (v_forward * 90)), FALSE, self);
dir1 = (dir1 + trace_fraction);
traceline (self.origin, ((self.origin - (v_right * SVC_BIGKICK)) + (v_forward * 90)), FALSE, self);
dir2 = trace_fraction;
traceline (self.origin, ((self.origin - (v_right * 50)) + (v_forward * 90)), FALSE, self);
dir2 = (dir2 + trace_fraction);
traceline (self.origin, ((self.origin - (v_right * 70)) + (v_forward * 90)), FALSE, self);
dir2 = (dir2 + trace_fraction);
traceline (self.origin, ((self.origin - (v_right * 90)) + (v_forward * 90)), FALSE, self);
dir2 = (dir2 + trace_fraction);
traceline (self.origin, ((self.origin - (v_right * 110)) + (v_forward * 90)), FALSE, self);
dir2 = (dir2 + trace_fraction);
if ((self.oldorg == self.origin))
{
if ((dir1 > dir2))
{
self.angles_y = (self.angles_y - ((AS_MELEE * random ()) * SVC_INTERMISSION));
}
else
{
if ((dir2 > dir1))
{
self.angles_y = (self.angles_y + ((AS_MELEE * random ()) * SVC_INTERMISSION));
}
else
{
self.oldorg = (self.oldorg + '0 0 1');
}
}
walkmove (self.angles_y, (SECRET_1ST_DOWN * xx));
}
}
if ((vlen ((self.origin - self.goalentity.origin)) < IT_LIGHTNING))
{
self.angles = vectoangles ((self.goalentity.origin - self.origin));
walkmove (self.angles_y, (-7 * xx));
}
if ((self.friend.team == PLAT_LOW_TRIGGER))
{
te = find (world, classname, "buyzone1");
}
if ((self.friend.team == SILENT))
{
te = find (world, classname, "buyzone2");
}
while (te)
{
rng = range (te);
if (((rng <= RANGE_NEAR) && (self.rescued == MULTICAST_ALL)))
{
te = find (world, classname, "hostage");
while (te)
{
if (((te.health > MULTICAST_ALL) && (te.rescued == MULTICAST_ALL)))
{
qq = (qq + PLAT_LOW_TRIGGER);
}
te = find (te, classname, "hostage");
}
self.rescued = PLAT_LOW_TRIGGER;
qqq = ftos ((qq - PLAT_LOW_TRIGGER));
bprint (SILENT, qqq);
bprint (SILENT, " hostages left\n");
setorigin (self, (self.origin - '0 0 512'));
}
te = find (te, classname, "buyzone");
}
self.oldorg = self.origin;
};
void (vector jojo) spawn_civilian =
{
local entity civ, te, oself;
local entity x;
local float stop;
x = findradius (jojo, 300);
while (x)
{
if (x.classname == "trigger_teleport")
stop = 1;
x = x.chain;
}
if (stop == 1)
{
remove(self);
return;
}
civ = spawn ();
oself = self;
self = civ;
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
self.takedamage = DAMAGE_AIM;
setmodel (self, "progs/hosfem.mdl");
setsize (self, '-10 -10 -24', '10 10 24');
self.health = 80;
self.netname = "civilian";
self.classname = "rhostage";
self.max_health = self.health;
hos_walk1 ();
self.th_die = hostage_die;
self.th_pain = hostage_pain;
self.rescued = 0;
self.angles_y = random()*360;
self.origin = jojo + '0 64 0';
self.origin_z = self.origin_z + 1;
droptofloor();
if (!walkmove(0, 0))
{
self.origin = jojo + '0 -64 0';
self.origin_z = self.origin_z + 1;
droptofloor();
if (!walkmove(0, 0))
{
self.origin = jojo + '64 0 0';
self.origin_z = self.origin_z + 1;
droptofloor();
if (!walkmove(0, 0))
{
self.origin = jojo + '-64 0 0';
self.origin_z = self.origin_z + 1;
droptofloor();
if (!walkmove(0, 0))
{
remove(self);
return;
}
}
}
}
te = findradius (self.origin, 24);
while (te)
{
if (te.classname == "player" || te.classname == "monster" && te.health > 0)
{
remove(self);
return;
}
te = te.chain;
}
if (self.waterlevel >= 2)
remove(self);
self = oself;
};