Code: Select all
/*
===============
Helicopter Code
===============
*/
void() Heli_Anim =
{
local float end;
while (end != 1)// while end isnt 1 so if it hasnt reached end point
{
if (self.weaponframe == 0)//check if weapon frame is 0
self.weaponframe = self.weaponframe + 1; // increment by 1
if (self.weaponframe >= 8)//end of animation
return;
self.nextthink = time + 0.1;
}
if(end == 0) // if it has reached end point
{
self.weaponframe == 0; // reset animation frame to first one and dont play anything
}
}
entity() item_unspawn =
{
precache_model(self.model);
setmodel (self,self.model);
self.skin = 0;
}
entity() item_heli =
{
precache_model(self.model);
setmodel (self,self.model);
self.skin = 0;
}
void() heli_spawn =
{
entity spawn;
spawn = item_heli(); // setting spawn to where the helicopter spawns
}
void() Heli =
{
self.classname = "helicopter";
self.health = 500; // heli health
self.takedamage = DAMAGE_AIM;
self.solid = SOLID_NOT; // not solid so it can go thorugh map entity's and walls etc..
};
void() Heli_Move =
{
vector start; // vector for startpoint of heli
vector end; // vector for endpoint of heli
heli_spawn(); // spawn heli
start = self.origin;
end = v_forward*10; // not sure how i would make it go to the end entity
makevectors(self.v_angle);
// pseudo code for end because im not sure how to do it(if start (the point where the heli start) hits the end entity(item_unspawn) then end = 0 and remove model from map)
}