Professional Documents
Culture Documents
local playersCount=count(players);
--flashbang in mp
MAKE_STUNNED_ANIMATION = function (self, entity, sender)
if (entity.BLINDED_ANIM_COUNT) then
local rnd = random(0,entity.BLINDED_ANIM_COUNT);
local anim_name = format("blind%02d",rnd);
entity:InsertAnimationPipe(anim_name,4);
local dur = entity:GetAnimationLength(anim_name);
AI:EnablePuppetMovement(entity.id,0,dur+3); -- added the
timeouts in the pipe
entity:TriggerEvent(AIEVENT_ONBODYSENSOR,dur+3);
else
Hud:AddMessage("==================UNACCEPTABLE
ERROR====================");
Hud:AddMessage("Entity "..entity:GetName().." tried to make
blinded anim, but no blindXX anims for his character.");
Hud:AddMessage("==================UNACCEPTABLE
ERROR====================");
end
end,
---------------------------------------------
FLASHBANG_GRENADE_EFFECT = function (self, entity, sender)
if (entity.ai) then
entity:InsertSubpipe(0,"stunned");
entity:Readibility("FLASHBANG_GRENADE_EFFECT",1);
end
end,
self:DrawTeams(player);
self:DrawStealthMeter(0,567);
self:DrawCrosshairName(player);
self:DrawItems(player);
--infos
%Game:SetHUDFont("hud", "ammo");
self:OnUpdateCommonHudElements();
ents = System:GetEntities();
local counterPL = 0;
local counterPLAlive = 0;
local counterAI = 0;
local counterAIAlive = 0;
for i,player in ents do
if player.entity_type=="player" and not player.ai then
if player.cnt.health > 0 then
counterPLAlive=counterPLAlive+1;
else
counterPL=counterPL+1;
end
elseif player.entity_type=="player" and player.ai then
if player.cnt.health > 0 then
counterAIAlive=counterAIAlive+1;
else
counterAI=counterAI+1;
end
end
end
counterPL=counterPL+counterPLAlive
counterAI=counterAI+counterAIAlive
%Game:SetHUDFont("default", "default");
%Game:WriteHudString(10,400,"players: "..counterPLAlive.."/"..counterPL
, 1, 1, 1, 1, 15,15);
%Game:WriteHudString(10,415,"computers:
"..counterAIAlive.."/"..counterAI, 1, 1, 1, 1, 15,15);
-end
--finding an anchor
OnSpawn = function(self,entity )
entity:InitAIRelaxed();
AI:CreateGoalPipe("JobPatrolPath");
AI:PushGoal("JobPatrolPath","pathfind",1,entity:GetName().."_PATH");
AI:PushGoal("JobPatrolPath","trace",1,1);
AI:PushGoal("JobPatrolPath","signal",0,1,"TRY_TO_FIND_IDLE",0);
entity:SelectPipe(0,"JobPatrolPath");
entity:InsertSubpipe(0,"setup_idle");
end,
---------------------------------------------
OnBored = function (self, entity)
entity:MakeRandomConversation();
end,
if (idle) then
AI:Signal(0, 1, "DO_SOMETHING_IDLE",entity.id);
end
end,
--end
--friendly fire-
gr_FriendlyFire
-end