ÎtemSpawn: reworked Dog

This commit is contained in:
neon 2018-08-12 18:25:03 +02:00
parent daa75af559
commit ebdc21711d
3 changed files with 143 additions and 205 deletions

View File

@ -183,6 +183,22 @@ stock void SetEntityProps(int entity)
SetEntProp(entity, Prop_Send, "m_fEffects", 32);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action EquipWeapons(Handle timer, any userid)
{
int client = GetClientOfUserId(userid);
if (client != 0)
{
GivePlayerItem(client, "weapon_p90");
GivePlayerItem(client, "weapon_elite");
GivePlayerItem(client, "item_kevlar");
GivePlayerItem(client, "weapon_hegrenade");
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------

View File

@ -44,108 +44,85 @@ public Action Command_HumanDog(int client, int argc)
//----------------------------------------------------------------------------------------------------
public void SpawnHumanDog(float fOrigin[3])
{
char sBuffer[256];
float fOriginTemp[3];
// Knife
int iKnife = CreateEntityByName("weapon_knife");
Format(sBuffer, sizeof(sBuffer), "human_dog_knife_%d", g_iCounter);
DispatchKeyValue(iKnife, "targetname", sBuffer);
Format(sBuffer, sizeof(sBuffer), "11051995%d", g_iCounter);
DispatchKeyValue(iKnife, "hammerid", sBuffer);
DispatchKeyValue(iKnife, "spawnflags", "1");
DispatchKeyValue(iKnife, "angles", "0 0 0");
DispatchKeyValueVector(iKnife, "origin", fOrigin);
//DispatchKeyValue(iKnife, "OnPlayerPickUp", "!activator,AddOutput,renderfx 6,0,-1");
Format(sBuffer, sizeof(sBuffer), "human_dog_ui_%d,Activate,,0,-1", g_iCounter);
DispatchKeyValue(iKnife, "OnPlayerPickup", sBuffer);
DispatchSpawn(iKnife);
ActivateEntity(iKnife);
// weapon_knife.
int iKnife = CreateEntityAtOrigin("weapon_knife", fOrigin);
DispatchKeyFormat(iKnife, "targetname", "human_dog_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_human_dog_controls_%d,Activate,,0,1", g_iCounter);
DispatchKeyFormat(iKnife, "OnPlayerPickup", "!activator,AddOutput,health 50000,0,1");
DispatchKeyFormat(iKnife, "OnPlayerPickup", "item_spawn_speedmod,ModifySpeed,0.8,0,1");
SpawnAndActivate(iKnife);
HookSingleEntityOutput(iKnife, "OnPlayerPickup", HumanDogPickup, true);
// Model
int iModel = CreateEntityByName("prop_dynamic");
Format(sBuffer, sizeof(sBuffer), "human_dog_model_%d", g_iCounter);
DispatchKeyValue(iModel, "targetname", sBuffer);
DispatchKeyValue(iModel, "model", "models/player/pil/re1/dog/dog_pil.mdl");
DispatchKeyValue(iModel, "DisableBoneFollowers", "1");
DispatchKeyValue(iModel, "angles", "0 0 0");
DispatchKeyValue(iModel, "solid", "0");
DispatchKeyValue(iModel, "skin", "1");
DispatchKeyValue(iModel, "DefaultAnim", "Run_lower");
// model origin.
fOriginTemp[0] = fOrigin[0] + 10.4;
fOriginTemp[1] = fOrigin[1] - 2.0;
fOriginTemp[2] = fOrigin[2] - 40.32;
DispatchKeyValueVector(iModel, "origin", fOriginTemp);
DispatchSpawn(iModel);
ActivateEntity(iModel);
SetVariantString("!activator");
AcceptEntityInput(iModel, "SetParent", iKnife);
// pickup trigger_once
int iTrigger = CreateEntityByName("trigger_once");
Format(sBuffer, sizeof(sBuffer), "tnt_trigger_%d", g_iCounter);
DispatchKeyValue(iTrigger, "targetname", sBuffer);
DispatchKeyValue(iTrigger, "spawnflags", "1");
DispatchKeyValue(iTrigger, "startdisabled", "1");
DispatchKeyValue(iTrigger, "filtername", "item_spawn_human_filter");
DispatchKeyValue(iTrigger, "OnStartTouch", "item_spawn_weaponstrip,StripWeaponsAndSuit,,0,1");
DispatchKeyValueVector(iTrigger, "origin", fOrigin);
DispatchSpawn(iTrigger);
ActivateEntity(iTrigger);
SetEntityModel(iTrigger, "models/vortigaunt_slave.mdl");
float fMinbounds[3] = {-1.0, -1.0, -10.0};
float fMaxbounds[3] = {1.0, 1.0, 10.0};
SetEntPropVector(iTrigger, Prop_Send, "m_vecMins", fMinbounds);
SetEntPropVector(iTrigger, Prop_Send, "m_vecMaxs", fMaxbounds);
SetEntProp(iTrigger, Prop_Send, "m_nSolidType", 2);
int enteffects = GetEntProp(iTrigger, Prop_Send, "m_fEffects");
enteffects |= 32;
SetEntProp(iTrigger, Prop_Send, "m_fEffects", enteffects);
SetVariantString("!activator");
AcceptEntityInput(iTrigger, "SetParent", iKnife);
// prop_dynamic model.
int iModel = CreateEntityAtOrigin("prop_dynamic", fOriginTemp);
DispatchKeyFormat(iModel, "targetname", "item_human_dog_model_%d", g_iCounter);
DispatchKeyFormat(iModel, "model", "models/player/pil/re1/dog/dog_pil.mdl");
DispatchKeyFormat(iModel, "disablebonefollowers", "1");
DispatchKeyFormat(iModel, "defaultanim", "Run_lower");
DispatchKeyFormat(iModel, "angles", "0 0 0");
DispatchKeyFormat(iModel, "solid", "0");
DispatchKeyFormat(iModel, "skin", "1");
SpawnAndActivate(iModel);
ParentToEntity(iModel, iKnife);
// trigger_once strip.
int iTriggerStrip = CreateEntityAtOrigin("trigger_once", fOrigin);
DispatchKeyFormat(iTriggerStrip, "targetname", "item_human_dog_strip_%d", g_iCounter);
DispatchKeyFormat(iTriggerStrip, "filtername", "item_filter_human");
DispatchKeyFormat(iTriggerStrip, "spawnflags", "1");
DispatchKeyFormat(iTriggerStrip, "startdisabled", "1");
DispatchKeyFormat(iTriggerStrip, "OnStartTouch", "item_spawn_weaponstrip,StripWeaponsAndSuit,,0,1");
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);
// Relay Trigger
int iRelayTrigger = CreateEntityByName("logic_relay");
Format(sBuffer, sizeof(sBuffer), "human_dog_relay_trigger_%d", g_iCounter);
DispatchKeyValue(iRelayTrigger, "targetname", sBuffer);
DispatchKeyValue(iRelayTrigger, "spawnflags", "0");
Format(sBuffer, sizeof(sBuffer), "human_dog_relay_trigger2_%d,Trigger,,0,4", g_iCounter);
DispatchKeyValue(iRelayTrigger, "OnTrigger", sBuffer);
DispatchSpawn(iRelayTrigger);
ActivateEntity(iRelayTrigger);
SetVariantString("!activator");
AcceptEntityInput(iRelayTrigger, "SetParent", iKnife);
int iRelayTrigger = CreateEntityAtOrigin("logic_relay", fOrigin);
DispatchKeyFormat(iRelayTrigger, "targetname", "human_dog_relay_trigger_%d", g_iCounter);
DispatchKeyFormat(iRelayTrigger, "spawnflags", "0");
DispatchKeyFormat(iRelayTrigger, "OnTrigger", "human_dog_relay_trigger2_%d,Trigger,,0,4", g_iCounter);
SpawnAndActivate(iRelayTrigger);
ParentToEntity(iRelayTrigger, iKnife);
// Relay Trigger2
int iRelayTrigger2 = CreateEntityByName("logic_relay");
Format(sBuffer, sizeof(sBuffer), "human_dog_relay_trigger2_%d", g_iCounter);
DispatchKeyValue(iRelayTrigger2, "targetname", sBuffer);
DispatchKeyValue(iRelayTrigger2, "spawnflags", "0");
DispatchSpawn(iRelayTrigger2);
ActivateEntity(iRelayTrigger2);
SetVariantString("!activator");
AcceptEntityInput(iRelayTrigger2, "SetParent", iKnife);
int iRelayTrigger2 = CreateEntityAtOrigin("logic_relay", fOrigin);
DispatchKeyFormat(iRelayTrigger2, "targetname", "human_dog_relay_trigger2_%d", g_iCounter);
DispatchKeyFormat(iRelayTrigger2, "spawnflags", "0");
SpawnAndActivate(iRelayTrigger2);
ParentToEntity(iRelayTrigger2, iKnife);
HookSingleEntityOutput(iRelayTrigger2, "OnTrigger", HumanDogUse, false);
// Game UI
int iUI = CreateEntityByName("game_ui");
Format(sBuffer, sizeof(sBuffer), "human_dog_ui_%d", g_iCounter);
DispatchKeyValue(iUI, "targetname", sBuffer);
DispatchKeyValue(iUI, "spawnflags", "0");
DispatchKeyValue(iUI, "FieldOfView", "-1.0");
Format(sBuffer, sizeof(sBuffer), "human_dog_relay_trigger_%d,Trigger,,0,-1", g_iCounter);
DispatchKeyValue(iUI, "PressedAttack2", sBuffer);
DispatchSpawn(iUI);
ActivateEntity(iUI);
SetVariantString("!activator");
AcceptEntityInput(iUI, "SetParent", iKnife);
// game_ui.
int iControls = CreateEntityAtOrigin("game_ui", fOrigin);
DispatchKeyFormat(iControls, "targetname", "item_human_dog_controls_%d", g_iCounter);
DispatchKeyFormat(iControls, "spawnflags", "0");
DispatchKeyFormat(iControls, "fieldofview", "-1.0");
DispatchKeyFormat(iControls, "PressedAttack2", "human_dog_relay_trigger_%d,Trigger,,0,-1", g_iCounter);
SpawnAndActivate(iControls);
ParentToEntity(iControls, iKnife);
// enable pickup trigger
SetVariantString("!activator");
AcceptEntityInput(iTrigger, "Enable");
AcceptEntityInput(iTriggerStrip, "Enable");
g_iCounter ++;
g_iCounter++;
}
//----------------------------------------------------------------------------------------------------
@ -153,11 +130,8 @@ public void SpawnHumanDog(float fOrigin[3])
//----------------------------------------------------------------------------------------------------
public void HumanDogPickup(const char[] output, int caller, int activator, float delay)
{
char sBuffer[128];
Format(sBuffer, sizeof(sBuffer), "say ** %N has picked up Human Dog **", activator);
SetVariantString(sBuffer);
AcceptEntityInput(g_iConsole, "Command");
PrintToChat(activator, "RIGHT CLICK with your KNIFE to leave a present for the Zombies (max 4)");
ServerCommand("say ** %N has picked up Human Dog **", activator);
PrintToChat(activator, " RIGHT CLICK with your KNIFE to leave a present for the Zombies (max 4)");
CreateTimer(2.0, EquipWeapons, GetClientUserId(activator), TIMER_FLAG_NO_MAPCHANGE);
}
@ -166,7 +140,6 @@ public void HumanDogPickup(const char[] output, int caller, int activator, float
//----------------------------------------------------------------------------------------------------
public void HumanDogUse(const char[] output, int caller, int activator, float delay)
{
char sBuffer[256];
float fOrigin[3];
float fAngles[3];
GetClientEyeAngles(activator, fAngles);
@ -177,122 +150,71 @@ public void HumanDogUse(const char[] output, int caller, int activator, float de
fOrigin[1] = fOrigin[1] + Sine(DegToRad(fAngles[1])) * -50.0;
fOrigin[2] = fOrigin[2] - 62.00;
// Prop
int iProp = CreateEntityByName("prop_dynamic");
Format(sBuffer, sizeof(sBuffer), "human_dog_poo_%d", g_iCounter);
DispatchKeyValue(iProp, "targetname", sBuffer);
DispatchKeyValue(iProp, "model", "models/poo/curlygpoo.mdl");
DispatchKeyValue(iProp, "spawnflags", "0");
DispatchKeyValue(iProp, "PerformanceMode", "0");
DispatchKeyValue(iProp, "solid", "0");
DispatchKeyValueVector(iProp, "origin", fOrigin);
DispatchSpawn(iProp);
ActivateEntity(iProp);
// prop_dynamic model.
int iModel = CreateEntityAtOrigin("prop_dynamic", fOrigin);
DispatchKeyFormat(iModel, "targetname", "human_dog_poo_%d", g_iCounter);
DispatchKeyFormat(iModel, "model", "models/poo/curlygpoo.mdl");
DispatchKeyFormat(iModel, "spawnflags", "0");
DispatchKeyFormat(iModel, "PerformanceMode", "0");
DispatchKeyFormat(iModel, "solid", "0");
SpawnAndActivate(iModel);
// trigger
int iTrigger = CreateEntityByName("trigger_once");
Format(sBuffer, sizeof(sBuffer), "human_dog_poo_trigger_%d", g_iCounter);
DispatchKeyValue(iTrigger, "targetname", sBuffer);
DispatchKeyValue(iTrigger, "spawnflags", "1");
DispatchKeyValue(iTrigger, "startdisabled", "0");
DispatchKeyValue(iTrigger, "filtername", "item_spawn_zombie_filter");
Format(sBuffer, sizeof(sBuffer), "human_dog_poo_%d,Kill,,1,1", g_iCounter);
DispatchKeyValue(iTrigger, "OnStartTouch", sBuffer);
Format(sBuffer, sizeof(sBuffer), "human_dog_poo_hurt_%d,Enable,,0,1", g_iCounter);
DispatchKeyValue(iTrigger, "OnStartTouch", sBuffer);
Format(sBuffer, sizeof(sBuffer), "human_dog_poo_hurt_%d,Disable,,0.25,1", g_iCounter);
DispatchKeyValue(iTrigger, "OnStartTouch", sBuffer);
Format(sBuffer, sizeof(sBuffer), "human_dog_particles_%d,Start,,0,-1", g_iCounter);
DispatchKeyValue(iTrigger, "OnStartTouch", sBuffer);
Format(sBuffer, sizeof(sBuffer), "human_dog_particles_%d,Kill,,1,-1", g_iCounter);
DispatchKeyValue(iTrigger, "OnStartTouch", sBuffer);
Format(sBuffer, sizeof(sBuffer), "human_dog_sound_%d,PlaySound,,0,-1", g_iCounter);
DispatchKeyValue(iTrigger, "OnStartTouch", sBuffer);
DispatchKeyValueVector(iTrigger, "origin", fOrigin);
DispatchSpawn(iTrigger);
ActivateEntity(iTrigger);
SetEntityModel(iTrigger, "models/vortigaunt_slave.mdl");
float fMinbounds[3] = {-12.0, -12.0, -7.5};
float fMaxbounds[3] = {12.0, 12.0, 7.5};
SetEntPropVector(iTrigger, Prop_Send, "m_vecMins", fMinbounds);
SetEntPropVector(iTrigger, Prop_Send, "m_vecMaxs", fMaxbounds);
SetEntProp(iTrigger, Prop_Send, "m_nSolidType", 2);
int enteffects = GetEntProp(iTrigger, Prop_Send, "m_fEffects");
enteffects |= 32;
SetEntProp(iTrigger, Prop_Send, "m_fEffects", enteffects);
SetVariantString("!activator");
AcceptEntityInput(iTrigger, "SetParent", iProp);
// trigger the explosion.
int iTriggerExplosion = CreateEntityAtOrigin("trigger_once", fOrigin);
DispatchKeyFormat(iTriggerExplosion, "targetname", "human_dog_poo_trigger_%d", g_iCounter);
DispatchKeyFormat(iTriggerExplosion, "filtername", "item_filter_zombie");
DispatchKeyFormat(iTriggerExplosion, "spawnflags", "1");
DispatchKeyFormat(iTriggerExplosion, "startdisabled", "0");
DispatchKeyFormat(iTriggerExplosion, "OnStartTouch", "human_dog_poo_%d,Kill,,1,1", g_iCounter);
DispatchKeyFormat(iTriggerExplosion, "OnStartTouch", "human_dog_poo_hurt_%d,Enable,,0,1", g_iCounter);
DispatchKeyFormat(iTriggerExplosion, "OnStartTouch", "human_dog_poo_hurt_%d,Disable,,0.25,1", g_iCounter);
DispatchKeyFormat(iTriggerExplosion, "OnStartTouch", "human_dog_particles_%d,Start,,0,-1", g_iCounter);
DispatchKeyFormat(iTriggerExplosion, "OnStartTouch", "human_dog_particles_%d,Kill,,1,-1", g_iCounter);
DispatchKeyFormat(iTriggerExplosion, "OnStartTouch", "human_dog_sound_%d,PlaySound,,0,-1", g_iCounter);
SpawnAndActivate(iTriggerExplosion);
ParentToEntity(iTriggerExplosion, iModel);
// poo hurt
int iHurt = CreateEntityByName("trigger_hurt");
Format(sBuffer, sizeof(sBuffer), "human_dog_poo_hurt_%d", g_iCounter);
DispatchKeyValue(iHurt, "targetname", sBuffer);
DispatchKeyValue(iHurt, "spawnflags", "1");
DispatchKeyValue(iHurt, "startdisabled", "1");
DispatchKeyValue(iHurt, "filtername", "item_spawn_zombie_filter");
DispatchKeyValue(iHurt, "damagetype", "0");
DispatchKeyValue(iHurt, "damagemodel", "0");
DispatchKeyValue(iHurt, "damagecap", "20");
DispatchKeyValue(iHurt, "damage", "8000");
DispatchKeyValueVector(iHurt, "origin", fOrigin);
DispatchSpawn(iHurt);
ActivateEntity(iHurt);
SetEntityModel(iHurt, "models/vortigaunt_slave.mdl");
float fMinbounds2[3] = {-96.0, -112.0, -142.0};
float fMaxbounds2[3] = {96.0, 112.0, 142.0};
SetEntPropVector(iHurt, Prop_Send, "m_vecMins", fMinbounds2);
SetEntPropVector(iHurt, Prop_Send, "m_vecMaxs", fMaxbounds2);
SetEntProp(iHurt, Prop_Send, "m_nSolidType", 3);
int enteffects2 = GetEntProp(iHurt, Prop_Send, "m_fEffects");
enteffects2 |= 32;
SetEntProp(iHurt, Prop_Send, "m_fEffects", enteffects2);
SetVariantString("!activator");
AcceptEntityInput(iHurt, "SetParent", iProp);
// make the trigger work.
SetEntityBBox(iTriggerExplosion, view_as<float>({-12.0, -12.0, -7.5}), view_as<float>({12.0, 12.0, 7.5}));
SetEntityProps(iTriggerExplosion);
// Particles
int iParticles = CreateEntityByName("info_particle_system");
Format(sBuffer, sizeof(sBuffer), "human_dog_particles_%d", g_iCounter);
DispatchKeyValue(iParticles, "targetname", sBuffer);
DispatchKeyValue(iParticles, "effect_name", "fire_small_01");
DispatchKeyValue(iParticles, "start_active", "0");
DispatchKeyValueVector(iParticles, "origin", fOrigin);
DispatchSpawn(iParticles);
ActivateEntity(iParticles);
SetVariantString("!activator");
AcceptEntityInput(iParticles, "SetParent", iProp);
// trigger poo damage.
int iTriggerExplosionDamage = CreateEntityAtOrigin("trigger_hurt", fOrigin);
DispatchKeyFormat(iTriggerExplosionDamage, "targetname", "human_dog_poo_hurt_%d", g_iCounter);
DispatchKeyFormat(iTriggerExplosionDamage, "filtername", "item_filter_zombie");
DispatchKeyFormat(iTriggerExplosionDamage, "spawnflags", "1");
DispatchKeyFormat(iTriggerExplosionDamage, "startdisabled", "1");
DispatchKeyFormat(iTriggerExplosionDamage, "damagetype", "0");
DispatchKeyFormat(iTriggerExplosionDamage, "damagemodel", "0");
DispatchKeyFormat(iTriggerExplosionDamage, "damagecap", "20");
DispatchKeyFormat(iTriggerExplosionDamage, "damage", "8000");
SpawnAndActivate(iTriggerExplosionDamage);
ParentToEntity(iTriggerExplosionDamage, iModel);
// Sound
int iSound = CreateEntityByName("ambient_generic");
Format(sBuffer, sizeof(sBuffer), "human_dog_sound_%d", g_iCounter);
DispatchKeyValue(iSound, "targetname", sBuffer);
DispatchKeyValue(iSound, "spawnflags", "49");
DispatchKeyValue(iSound, "radius", "1250");
DispatchKeyValue(iSound, "message", "ambient/explosions/explode_9.wav");
DispatchKeyValue(iSound, "volume", "10");
DispatchKeyValue(iSound, "health", "10");
DispatchKeyValue(iSound, "pitch", "100");
DispatchKeyValue(iSound, "pitchstart", "100");
DispatchKeyValueVector(iSound, "origin", fOrigin);
DispatchSpawn(iSound);
ActivateEntity(iSound);
SetVariantString("!activator");
AcceptEntityInput(iSound, "SetParent", iProp);
// make the trigger work.
SetEntityBBox(iTriggerExplosionDamage, view_as<float>({-96.0, -112.0, -142.0}), view_as<float>({96.0, 112.0, 142.0}));
SetEntityProps(iTriggerExplosionDamage);
// particles.
int iParticles = CreateEntityAtOrigin("info_particle_system", fOrigin);
DispatchKeyFormat(iParticles, "targetname", "human_dog_particles_%d", g_iCounter);
DispatchKeyFormat(iParticles, "effect_name", "fire_small_01");
DispatchKeyFormat(iParticles, "start_active", "0");
SpawnAndActivate(iParticles);
ParentToEntity(iParticles, iModel);
// sound.
int iSound = CreateEntityAtOrigin("ambient_generic", fOrigin);
DispatchKeyFormat(iSound, "targetname", "human_dog_sound_%d", g_iCounter);
DispatchKeyFormat(iSound, "spawnflags", "49");
DispatchKeyFormat(iSound, "radius", "1250");
DispatchKeyFormat(iSound, "message", "ambient/explosions/explode_9.wav");
DispatchKeyFormat(iSound, "volume", "10");
DispatchKeyFormat(iSound, "health", "10");
DispatchKeyFormat(iSound, "pitch", "100");
DispatchKeyFormat(iSound, "pitchstart", "100");
SpawnAndActivate(iSound);
ParentToEntity(iSound, iModel);
g_iCounter ++;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action EquipWeapons(Handle timer, any userid)
{
int client = GetClientOfUserId(userid);
if (client != 0)
{
GivePlayerItem(client, "weapon_p90");
GivePlayerItem(client, "weapon_elite");
GivePlayerItem(client, "item_kevlar");
GivePlayerItem(client, "weapon_hegrenade");
}
}

View File

@ -575,8 +575,8 @@ public void SpawnWhiteKnight(float fOrigin[3])
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.");
PrintToChat(activator, " LEFT CLICK = ATTACK and RIGHT CLICK = SHIELD.");
CreateTimer(2.0, EquipWeapons, GetClientUserId(activator), TIMER_FLAG_NO_MAPCHANGE);
}
//----------------------------------------------------------------------------------------------------