2018-08-07 21:54:11 +02:00
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
// Purpose:
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
public Action Command_WhiteKnight(int client, int argc)
|
|
|
|
{
|
|
|
|
float fOrigin[3];
|
|
|
|
|
|
|
|
if (argc < 1)
|
|
|
|
{
|
|
|
|
GetClientEyePosition(client, fOrigin);
|
|
|
|
SpawnWhiteKnight(fOrigin);
|
|
|
|
LogAction(client, -1, "\"%L\" spawned WhiteKnight at <%f><%f><%f>.", client, fOrigin[0], fOrigin[1], fOrigin[2]);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
|
|
|
char sArgs[64];
|
|
|
|
char sTargetName[MAX_TARGET_LENGTH];
|
|
|
|
int iTargets[MAXPLAYERS];
|
|
|
|
int iTargetCount;
|
|
|
|
bool bIsML;
|
|
|
|
|
|
|
|
GetCmdArg(1, sArgs, sizeof(sArgs));
|
|
|
|
|
|
|
|
if ((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, COMMAND_FILTER_CONNECTED, sTargetName, sizeof(sTargetName), bIsML)) <= 0)
|
|
|
|
{
|
|
|
|
ReplyToTargetError(client, iTargetCount);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < iTargetCount; i++)
|
|
|
|
{
|
2018-08-11 16:36:11 +02:00
|
|
|
if(IsClientInGame(iTargets[i]) && IsPlayerAlive(iTargets[i]) && (ZR_IsClientHuman(iTargets[i])))
|
2018-08-07 21:54:11 +02:00
|
|
|
{
|
|
|
|
GetClientEyePosition(iTargets[i], fOrigin);
|
|
|
|
SpawnWhiteKnight(fOrigin);
|
|
|
|
LogAction(client, -1, "\"%L\" gave WhiteKnight to \"%L\".", client, iTargets[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
// Purpose:
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
public void SpawnWhiteKnight(float fOrigin[3])
|
|
|
|
{
|
|
|
|
float fOriginTemp[3];
|
|
|
|
|
|
|
|
// weapon_knife.
|
|
|
|
int iKnife = CreateEntityAtOrigin("weapon_knife", fOrigin);
|
2018-08-11 15:47:04 +02:00
|
|
|
DispatchKeyFormat(iKnife, "targetname", "item_knight_knife_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iKnife, "hammerid", "11051995%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iKnife, "spawnflags", "1");
|
|
|
|
DispatchKeyFormat(iKnife, "angles", "0 0 0");
|
|
|
|
DispatchKeyFormat(iKnife, "OnPlayerPickup", "!self,AddOutput,renderfx 6,0,1");
|
|
|
|
DispatchKeyFormat(iKnife, "OnPlayerPickup", "item_knight_model_%d,SetAnimation,dog_run,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iKnife, "OnPlayerPickup", "item_knight_model_%d,SetDefaultAnimation,dog_run,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iKnife, "OnPlayerPickup", "item_knight_health_%d,FireUser1,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iKnife, "OnPlayerPickup", "item_knight_health_%d,FireUser2,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iKnife, "OnPlayerPickup", "item_knight_controls_%d,Activate,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iKnife, "OnPlayerPickup", "!activator,AddOutput,health 50000,0,1");
|
2018-08-07 21:54:11 +02:00
|
|
|
SpawnAndActivate(iKnife);
|
|
|
|
|
|
|
|
HookSingleEntityOutput(iKnife, "OnPlayerPickup", WhiteKnightPickup, true);
|
|
|
|
|
|
|
|
// model origin.
|
|
|
|
fOriginTemp[0] = fOrigin[0] + 6.0;
|
2018-08-10 19:35:32 +02:00
|
|
|
fOriginTemp[1] = fOrigin[1];
|
|
|
|
fOriginTemp[2] = fOrigin[2] - 32.0;
|
2018-08-07 21:54:11 +02:00
|
|
|
|
|
|
|
// prop_dynamic model.
|
|
|
|
int iModel = CreateEntityAtOrigin("prop_dynamic", fOriginTemp);
|
2018-08-11 15:47:04 +02:00
|
|
|
DispatchKeyFormat(iModel, "targetname", "item_knight_model_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iModel, "model", "models/dog_jugger.mdl");
|
|
|
|
DispatchKeyFormat(iModel, "disablebonefollowers", "1");
|
|
|
|
DispatchKeyFormat(iModel, "defaultanim", "ragdoll");
|
|
|
|
DispatchKeyFormat(iModel, "angles", "0 0 0");
|
|
|
|
DispatchKeyFormat(iModel, "solid", "0");
|
2018-08-07 21:54:11 +02:00
|
|
|
SpawnAndActivate(iModel);
|
|
|
|
ParentToEntity(iModel, iKnife);
|
|
|
|
|
|
|
|
// trigger_once strip.
|
|
|
|
int iTriggerStrip = CreateEntityAtOrigin("trigger_once", fOrigin);
|
2018-08-11 15:47:04 +02:00
|
|
|
DispatchKeyFormat(iTriggerStrip, "targetname", "item_knight_strip_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iTriggerStrip, "filtername", "item_spawn_human_filter");
|
|
|
|
DispatchKeyFormat(iTriggerStrip, "spawnflags", "1");
|
|
|
|
DispatchKeyFormat(iTriggerStrip, "startdisabled", "1");
|
|
|
|
DispatchKeyFormat(iTriggerStrip, "OnStartTouch", "item_spawn_weaponstrip,StripWeaponsAndSuit,,0,1");
|
2018-08-07 21:54:11 +02:00
|
|
|
SpawnAndActivate(iTriggerStrip);
|
|
|
|
ParentToEntity(iTriggerStrip, iKnife);
|
|
|
|
|
|
|
|
// make the trigger work.
|
|
|
|
SetEntityBBox(iTriggerStrip, view_as<float>({-8.0, -8.0, -8.0}), view_as<float>({8.0, 8.0, 8.0}));
|
|
|
|
SetEntityProps(iTriggerStrip);
|
|
|
|
|
2018-08-11 15:47:04 +02:00
|
|
|
// attack origin.
|
2018-08-10 19:35:32 +02:00
|
|
|
fOriginTemp[0] = fOrigin[0] + 112.0;
|
|
|
|
fOriginTemp[1] = fOrigin[1];
|
|
|
|
fOriginTemp[2] = fOrigin[2] + 4.0;
|
|
|
|
|
2018-08-11 15:47:04 +02:00
|
|
|
// trigger_push attack.
|
|
|
|
int iTriggerAttack1 = CreateEntityAtOrigin("trigger_push", fOriginTemp);
|
|
|
|
DispatchKeyFormat(iTriggerAttack1, "targetname", "item_knight_attack_1_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iTriggerAttack1, "filtername", "item_spawn_zombie_filter");
|
|
|
|
DispatchKeyFormat(iTriggerAttack1, "spawnflags", "1");
|
|
|
|
DispatchKeyFormat(iTriggerAttack1, "startdisabled", "1");
|
|
|
|
DispatchKeyFormat(iTriggerAttack1, "pushdir", "-45 0 0");
|
|
|
|
DispatchKeyFormat(iTriggerAttack1, "speed", "600");
|
|
|
|
SpawnAndActivate(iTriggerAttack1);
|
|
|
|
ParentToEntity(iTriggerAttack1, iKnife);
|
2018-08-10 19:35:32 +02:00
|
|
|
|
|
|
|
// make the trigger work.
|
2018-08-11 15:47:04 +02:00
|
|
|
SetEntityBBox(iTriggerAttack1, view_as<float>({-70.0, -52.0, -36.0}), view_as<float>({70.0, 52.0, 36.0}));
|
|
|
|
SetEntityProps(iTriggerAttack1);
|
|
|
|
|
|
|
|
// trigger_push attack.
|
|
|
|
int iTriggerAttack2 = CreateEntityAtOrigin("trigger_push", fOriginTemp);
|
|
|
|
DispatchKeyFormat(iTriggerAttack2, "targetname", "item_knight_attack_2_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iTriggerAttack2, "filtername", "item_spawn_zombie_filter");
|
|
|
|
DispatchKeyFormat(iTriggerAttack2, "spawnflags", "1");
|
|
|
|
DispatchKeyFormat(iTriggerAttack2, "startdisabled", "1");
|
|
|
|
DispatchKeyFormat(iTriggerAttack2, "pushdir", "-45 0 0");
|
|
|
|
DispatchKeyFormat(iTriggerAttack2, "speed", "1500");
|
|
|
|
SpawnAndActivate(iTriggerAttack2);
|
|
|
|
ParentToEntity(iTriggerAttack2, iKnife);
|
2018-08-10 19:35:32 +02:00
|
|
|
|
|
|
|
// make the trigger work.
|
2018-08-11 15:47:04 +02:00
|
|
|
SetEntityBBox(iTriggerAttack2, view_as<float>({-70.0, -52.0, -36.0}), view_as<float>({70.0, 52.0, 36.0}));
|
|
|
|
SetEntityProps(iTriggerAttack2);
|
2018-08-10 19:35:32 +02:00
|
|
|
|
2018-08-11 15:47:04 +02:00
|
|
|
// attack origin.
|
2018-08-10 19:35:32 +02:00
|
|
|
fOriginTemp[0] = fOrigin[0] + 130.0;
|
|
|
|
fOriginTemp[1] = fOrigin[1];
|
|
|
|
fOriginTemp[2] = fOrigin[2] + 4.0;
|
|
|
|
|
2018-08-11 15:47:04 +02:00
|
|
|
// trigger_hurt attack.
|
|
|
|
int iTriggerAttack3 = CreateEntityAtOrigin("trigger_hurt", fOriginTemp);
|
|
|
|
DispatchKeyFormat(iTriggerAttack3, "targetname", "item_knight_attack_3_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iTriggerAttack3, "filtername", "item_spawn_zombie_filter");
|
|
|
|
DispatchKeyFormat(iTriggerAttack3, "spawnflags", "9");
|
|
|
|
DispatchKeyFormat(iTriggerAttack3, "startdisabled", "1");
|
|
|
|
DispatchKeyFormat(iTriggerAttack3, "damagetype", "512");
|
|
|
|
DispatchKeyFormat(iTriggerAttack3, "damagemodel", "0");
|
|
|
|
DispatchKeyFormat(iTriggerAttack3, "damagecap", "20");
|
|
|
|
DispatchKeyFormat(iTriggerAttack3, "damage", "800");
|
|
|
|
SpawnAndActivate(iTriggerAttack3);
|
|
|
|
ParentToEntity(iTriggerAttack3, iKnife);
|
2018-08-10 19:35:32 +02:00
|
|
|
|
|
|
|
// make the trigger work.
|
2018-08-11 15:47:04 +02:00
|
|
|
SetEntityBBox(iTriggerAttack3, view_as<float>({-52.0, -52.0, -36.0}), view_as<float>({52.0, 52.0, 36.0}));
|
|
|
|
SetEntityProps(iTriggerAttack3);
|
2018-08-10 19:35:32 +02:00
|
|
|
|
2018-08-11 15:47:04 +02:00
|
|
|
// nuke origin.
|
2018-08-10 19:35:32 +02:00
|
|
|
fOriginTemp[0] = fOrigin[0] + 6.0;
|
|
|
|
fOriginTemp[1] = fOrigin[1];
|
|
|
|
fOriginTemp[2] = fOrigin[2] + 32.0;
|
|
|
|
|
2018-08-11 15:47:04 +02:00
|
|
|
// trigger_hurt nuke.
|
|
|
|
int iTriggerNuke = CreateEntityAtOrigin("trigger_hurt", fOriginTemp);
|
|
|
|
DispatchKeyFormat(iTriggerNuke, "targetname", "item_knight_nuke_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iTriggerNuke, "filtername", "item_spawn_zombie_filter");
|
|
|
|
DispatchKeyFormat(iTriggerNuke, "spawnflags", "9");
|
|
|
|
DispatchKeyFormat(iTriggerNuke, "startdisabled", "1");
|
|
|
|
DispatchKeyFormat(iTriggerNuke, "damagetype", "512");
|
|
|
|
DispatchKeyFormat(iTriggerNuke, "damagemodel", "0");
|
|
|
|
DispatchKeyFormat(iTriggerNuke, "damagecap", "20");
|
|
|
|
DispatchKeyFormat(iTriggerNuke, "damage", "20000");
|
|
|
|
SpawnAndActivate(iTriggerNuke);
|
|
|
|
ParentToEntity(iTriggerNuke, iKnife);
|
2018-08-10 19:35:32 +02:00
|
|
|
|
2018-08-11 15:47:04 +02:00
|
|
|
// make the trigger work.
|
|
|
|
SetEntityBBox(iTriggerNuke, view_as<float>({-1024.0, -1024.0, -800.0}), view_as<float>({1024.0, 1024.0, 800.0}));
|
|
|
|
SetEntityProps(iTriggerNuke);
|
|
|
|
|
|
|
|
// ambient_generic attack.
|
|
|
|
int iSoundAttack1 = CreateEntityAtOrigin("ambient_generic", fOrigin);
|
|
|
|
DispatchKeyFormat(iSoundAttack1, "targetname", "item_knight_attack_sound_1_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iSoundAttack1, "spawnflags", "48");
|
|
|
|
DispatchKeyFormat(iSoundAttack1, "radius", "1250");
|
|
|
|
DispatchKeyFormat(iSoundAttack1, "sourceentityname", "item_knight_knife_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iSoundAttack1, "message", "npc/roller/blade_out.wav");
|
|
|
|
DispatchKeyFormat(iSoundAttack1, "volume", "10");
|
|
|
|
DispatchKeyFormat(iSoundAttack1, "health", "10");
|
|
|
|
DispatchKeyFormat(iSoundAttack1, "pitch", "100");
|
|
|
|
DispatchKeyFormat(iSoundAttack1, "pitchstart", "100");
|
|
|
|
SpawnAndActivate(iSoundAttack1);
|
|
|
|
ParentToEntity(iSoundAttack1, iKnife);
|
|
|
|
|
|
|
|
// ambient_generic attack.
|
|
|
|
int iSoundAttack2 = CreateEntityAtOrigin("ambient_generic", fOrigin);
|
|
|
|
DispatchKeyFormat(iSoundAttack2, "targetname", "item_knight_attack_sound_2_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iSoundAttack2, "spawnflags", "48");
|
|
|
|
DispatchKeyFormat(iSoundAttack2, "radius", "1250");
|
|
|
|
DispatchKeyFormat(iSoundAttack2, "sourceentityname", "item_knight_knife_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iSoundAttack2, "message", "npc/strider/strider_skewer1.wav");
|
|
|
|
DispatchKeyFormat(iSoundAttack2, "volume", "10");
|
|
|
|
DispatchKeyFormat(iSoundAttack2, "health", "10");
|
|
|
|
DispatchKeyFormat(iSoundAttack2, "pitch", "100");
|
|
|
|
DispatchKeyFormat(iSoundAttack2, "pitchstart", "100");
|
|
|
|
SpawnAndActivate(iSoundAttack2);
|
|
|
|
ParentToEntity(iSoundAttack2, iKnife);
|
|
|
|
|
|
|
|
// ambient_generic attack.
|
|
|
|
int iSoundNuke1 = CreateEntityAtOrigin("ambient_generic", fOrigin);
|
|
|
|
DispatchKeyFormat(iSoundNuke1, "targetname", "item_knight_nuke_sound_1_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iSoundNuke1, "spawnflags", "49");
|
|
|
|
DispatchKeyFormat(iSoundNuke1, "radius", "1250");
|
|
|
|
DispatchKeyFormat(iSoundNuke1, "sourceentityname", "item_knight_knife_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iSoundNuke1, "message", "ambient/levels/citadel/portal_beam_shoot4.wav");
|
|
|
|
DispatchKeyFormat(iSoundNuke1, "volume", "10");
|
|
|
|
DispatchKeyFormat(iSoundNuke1, "health", "10");
|
|
|
|
DispatchKeyFormat(iSoundNuke1, "pitch", "100");
|
|
|
|
DispatchKeyFormat(iSoundNuke1, "pitchstart", "100");
|
|
|
|
SpawnAndActivate(iSoundNuke1);
|
|
|
|
ParentToEntity(iSoundNuke1, iKnife);
|
|
|
|
|
|
|
|
// ambient_generic attack.
|
|
|
|
int iSoundNuke2 = CreateEntityAtOrigin("ambient_generic", fOrigin);
|
|
|
|
DispatchKeyFormat(iSoundNuke2, "targetname", "item_knight_nuke_sound_2_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iSoundNuke2, "spawnflags", "49");
|
|
|
|
DispatchKeyFormat(iSoundNuke2, "radius", "1250");
|
|
|
|
DispatchKeyFormat(iSoundNuke2, "sourceentityname", "item_knight_knife_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iSoundNuke2, "message", "ambient/explosions/explode_6.wav");
|
|
|
|
DispatchKeyFormat(iSoundNuke2, "volume", "10");
|
|
|
|
DispatchKeyFormat(iSoundNuke2, "health", "10");
|
|
|
|
DispatchKeyFormat(iSoundNuke2, "pitch", "100");
|
|
|
|
DispatchKeyFormat(iSoundNuke2, "pitchstart", "100");
|
|
|
|
DispatchKeyFormat(iSoundNuke2, "fadein", "0");
|
|
|
|
DispatchKeyFormat(iSoundNuke2, "fadeout", "0");
|
|
|
|
SpawnAndActivate(iSoundNuke2);
|
|
|
|
ParentToEntity(iSoundNuke2, iKnife);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// logic_relay walk.
|
|
|
|
int iRelayWalk = CreateEntityAtOrigin("logic_relay", fOrigin);
|
|
|
|
DispatchKeyFormat(iRelayWalk, "targetname", "item_knight_walk_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayWalk, "spawnflags", "0");
|
|
|
|
DispatchKeyFormat(iRelayWalk, "OnTrigger", "item_knight_model_%d,SetAnimation,dog_run,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayWalk, "OnTrigger", "item_knight_model_%d,SetDefaultAnimation,dog_run,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayWalk, "OnTrigger", "item_knight_attack_compare_%d,SetCompareValue,0,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayWalk, "OnTrigger", "item_knight_shield_compare_%d,SetCompareValue,0,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayWalk, "OnTrigger", "item_knight_nuke_compare_%d,SetCompareValue,0,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayWalk, "OnTrigger", "item_spawn_speedmod,ModifySpeed,1,0,-1");
|
|
|
|
SpawnAndActivate(iRelayWalk);
|
|
|
|
ParentToEntity(iRelayWalk, iKnife);
|
2018-08-10 19:35:32 +02:00
|
|
|
|
|
|
|
// logic_relay death.
|
|
|
|
int iRelayDeath = CreateEntityAtOrigin("logic_relay", fOrigin);
|
2018-08-11 15:47:04 +02:00
|
|
|
DispatchKeyFormat(iRelayDeath, "targetname", "item_knight_death_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayDeath, "spawnflags", "0");
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnTrigger", "!self,FireUser1,,0.1,-1");
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "item_knight_knife_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "item_knight_strip_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "item_knight_attack_1_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "item_knight_attack_2_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "item_knight_attack_3_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "item_knight_nuke_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "item_knight_attack_sound_1_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "item_knight_attack_sound_2_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "item_knight_nuke_sound_1_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "item_knight_nuke_sound_2_%d,Kill,,0,1", g_iCounter);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "item_knight_walk_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "!activator,AddOutput,rendermode 0,0,1");
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "!activator,AddOutput,renderfx 0,0,1");
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "!activator,SetDamageFilter,,0,1");
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "!activator,SetHealth,0,0.02,-1");
|
|
|
|
DispatchKeyFormat(iRelayDeath, "OnUser1", "!self,Kill,,0,1");
|
2018-08-10 19:35:32 +02:00
|
|
|
SpawnAndActivate(iRelayDeath);
|
|
|
|
ParentToEntity(iRelayDeath, iKnife);
|
|
|
|
|
|
|
|
// health origin.
|
|
|
|
fOriginTemp[0] = fOrigin[0] + 6.0;
|
|
|
|
fOriginTemp[1] = fOrigin[1];
|
|
|
|
fOriginTemp[2] = fOrigin[2] + 56.0;
|
|
|
|
|
|
|
|
// func_physbox_multiplayer health.
|
|
|
|
int iHealth = CreateEntityAtOrigin("func_physbox_multiplayer", fOriginTemp);
|
2018-08-11 15:47:04 +02:00
|
|
|
DispatchKeyFormat(iHealth, "targetname", "item_knight_health_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "model", "models/props/cs_militia/crate_extrasmallmill.mdl");
|
|
|
|
DispatchKeyFormat(iHealth, "spawnflags", "9237504");
|
|
|
|
DispatchKeyFormat(iHealth, "rendermode", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "renderfx", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "rendercolor", "255 255 255");
|
|
|
|
DispatchKeyFormat(iHealth, "renderamt", "255 255 255");
|
|
|
|
DispatchKeyFormat(iHealth, "propdata", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "pressuredelay", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "preferredcarryangles", "0 0 0");
|
|
|
|
DispatchKeyFormat(iHealth, "performancemode", "1");
|
|
|
|
DispatchKeyFormat(iHealth, "notsolid", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "nodamageforces", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "material", "2");
|
|
|
|
DispatchKeyFormat(iHealth, "massScale", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "health", "750");
|
|
|
|
DispatchKeyFormat(iHealth, "gibdir", "0 0 0");
|
|
|
|
DispatchKeyFormat(iHealth, "forcetoenablemotion", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "explosion", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "exploderadius", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "explodemagnitude", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "explodedamage", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "disableshadows", "1");
|
|
|
|
DispatchKeyFormat(iHealth, "disablereceiveshadows", "1");
|
|
|
|
DispatchKeyFormat(iHealth, "damagetype", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "damagetoenablemotion", "0");
|
|
|
|
DispatchKeyFormat(iHealth, "damagefilter", "item_spawn_zombie_filter");
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_knife_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_strip_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_attack_1_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_attack_2_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_attack_3_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_nuke_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_attack_sound_1_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_attack_sound_2_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_nuke_sound_1_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_nuke_sound_2_%d,Kill,,0,1", g_iCounter);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_walk_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_controls_%d,Kill,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_model_%d,ClearParent,,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_model_%d,SetAnimation,dog_die,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnBreak", "item_knight_model_%d,SetDefaultAnimation,dog_die_loop,0,1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnUser1", "!activator,SetDamageFilter,item_spawn_human_filter,0,-1");
|
|
|
|
DispatchKeyFormat(iHealth, "OnUser1", "!activator,AddOutput,rendermode 10,0,-1");
|
|
|
|
DispatchKeyFormat(iHealth, "OnUser1", "!activator,AddOutput,renderfx 6,0,-1");
|
|
|
|
DispatchKeyFormat(iHealth, "OnUser1", "!self,FireUser1,,1,-1");
|
|
|
|
DispatchKeyFormat(iHealth, "OnUser2", "item_knight_death_%d,CancelPending,,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnUser2", "item_knight_death_%d,Trigger,,0.05,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iHealth, "OnUser2", "!self,FireUser2,,0.1,-1");
|
2018-08-10 19:35:32 +02:00
|
|
|
SpawnAndActivate(iHealth);
|
|
|
|
ParentToEntity(iHealth, iKnife);
|
2018-08-07 21:54:11 +02:00
|
|
|
|
2018-08-10 19:35:32 +02:00
|
|
|
// make the physbox work.
|
|
|
|
SetEntityBBox(iHealth, view_as<float>({-36.0, -52.0, -56.0}), view_as<float>({36.0, 52.0, 56.0}));
|
|
|
|
SetEntityProps(iHealth);
|
2018-08-07 21:54:11 +02:00
|
|
|
|
2018-08-10 19:35:32 +02:00
|
|
|
HookSingleEntityOutput(iHealth, "OnBreak", WhiteKnightKill, true);
|
|
|
|
|
|
|
|
// game_ui.
|
|
|
|
int iControls = CreateEntityAtOrigin("game_ui", fOrigin);
|
2018-08-11 15:47:04 +02:00
|
|
|
DispatchKeyFormat(iControls, "targetname", "item_knight_controls_%d", g_iCounter);
|
|
|
|
DispatchKeyFormat(iControls, "spawnflags", "0");
|
|
|
|
DispatchKeyFormat(iControls, "fieldofview", "-1.0");
|
|
|
|
DispatchKeyFormat(iControls, "PressedAttack", "item_knight_attack_compare_%d,Compare,,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iControls, "PressedAttack2", "item_knight_shield_compare_%d,Compare,,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iControls, "PressedBack", "item_knight_combo_5_%d,Trigger,,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iControls, "PressedBack", "item_knight_combo_7_%d,Trigger,,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iControls, "PressedForward", "item_knight_combo_6_%d,Trigger,,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iControls, "PressedForward", "item_knight_combo_8_%d,Trigger,,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iControls, "PressedMoveLeft", "item_knight_combo_1_%d,Trigger,,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iControls, "PressedMoveLeft", "item_knight_combo_2_%d,Trigger,,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iControls, "PressedMoveRight", "item_knight_combo_3_%d,Trigger,,0,-1", g_iCounter);
|
|
|
|
DispatchKeyFormat(iControls, "PressedMoveRight", "item_knight_combo_4_%d,Trigger,,0,-1", g_iCounter);
|
2018-08-10 19:35:32 +02:00
|
|
|
SpawnAndActivate(iControls);
|
|
|
|
ParentToEntity(iControls, iKnife);
|
2018-08-07 21:54:11 +02:00
|
|
|
|
|
|
|
AcceptEntityInput(iTriggerStrip, "Enable");
|
|
|
|
g_iCounter++;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
// Purpose:
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
public void WhiteKnightPickup(const char[] output, int caller, int activator, float delay)
|
|
|
|
{
|
|
|
|
ServerCommand("say ** %N has picked up the White Knight **", activator);
|
|
|
|
|
|
|
|
PrintToChat(activator, " LEFT CLICK = ATTACK and RIGHT CLICK = SHIELD.");
|
2018-08-10 19:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
// Purpose:
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
public void WhiteKnightKill(const char[] output, int caller, int activator, float delay)
|
|
|
|
{
|
|
|
|
ServerCommand("say ** %N has killed the White Knight **", activator);
|
2018-08-07 21:54:11 +02:00
|
|
|
}
|