ItemSpawn: More progress o/

Spawning physbox seems to crash tho atm???
This commit is contained in:
zaCade 2018-08-04 12:47:16 +02:00
parent 09bce80a3d
commit 75427ac376
2 changed files with 66 additions and 48 deletions

View File

@ -147,6 +147,31 @@ stock bool ParentToEntity(int entity, int parent)
return AcceptEntityInput(entity, "SetParent", parent, parent);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
stock void SetEntityBBox(int entity, const float mins[3], const float maxs[3])
{
SetEntPropVector(entity, Prop_Send, "m_vecMins", mins);
SetEntPropVector(entity, Prop_Send, "m_vecMaxs", maxs);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
stock void SetEntitySolid(int entity)
{
SetEntProp(entity, Prop_Send, "m_nSolidType", 3);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
stock void SetEntityNodraw(int entity)
{
SetEntProp(entity, Prop_Send, "m_fEffects", 32);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------

View File

@ -96,13 +96,11 @@ public void SpawnBalrog(float fOrigin[3])
ActivateAndSpawn(iTriggerStrip);
ParentToEntity(iTriggerStrip, iKnife);
// make the trigger work.
SetEntityModel(iTriggerStrip, "models/vortigaunt_slave.mdl");
// SetEntPropVector(iTriggerStrip, Prop_Send, "m_vecMins", {-8.0, -8.0, -8.0});
// SetEntPropVector(iTriggerStrip, Prop_Send, "m_vecMaxs", { 8.0, 8.0, 8.0});
// SetEntProp(iTriggerStrip, Prop_Send, "m_fEffects", GetEntProp(iTriggerStrip, Prop_Send, "m_fEffects") |= 32);
// SetEntProp(iTriggerStrip, Prop_Send, "m_nSolidType", 2);
SetEntityBBox(iTriggerStrip, view_as<float>({-8.0, -8.0, -8.0}), view_as<float>({8.0, 8.0, 8.0}));
SetEntitySolid(iTriggerStrip);
SetEntityNodraw(iTriggerStrip);
// trigger_hurt death.
int iTriggerDeath = CreateEntityAtOrigin("trigger_hurt", fOrigin);
@ -117,13 +115,11 @@ public void SpawnBalrog(float fOrigin[3])
ActivateAndSpawn(iTriggerDeath);
ParentToEntity(iTriggerDeath, iKnife);
// make the trigger work.
SetEntityModel(iTriggerDeath, "models/vortigaunt_slave.mdl");
// SetEntPropVector(iTriggerDeath, Prop_Send, "m_vecMins", {-8.0, -8.0, -8.0});
// SetEntPropVector(iTriggerDeath, Prop_Send, "m_vecMaxs", { 8.0, 8.0, 8.0});
// SetEntProp(iTriggerDeath, Prop_Send, "m_fEffects", GetEntProp(iTriggerOnce, Prop_Send, "m_fEffects") |= 32);
// SetEntProp(iTriggerDeath, Prop_Send, "m_nSolidType", 2);
SetEntityBBox(iTriggerDeath, view_as<float>({-8.0, -8.0, -8.0}), view_as<float>({8.0, 8.0, 8.0}));
SetEntitySolid(iTriggerDeath);
SetEntityNodraw(iTriggerDeath);
// walk origin.
fOriginTemp[0] = fOrigin[0] + 28.5;
@ -143,13 +139,11 @@ public void SpawnBalrog(float fOrigin[3])
ActivateAndSpawn(iTriggerWalk);
ParentToEntity(iTriggerWalk, iKnife);
// make the trigger work.
SetEntityModel(iTriggerWalk, "models/vortigaunt_slave.mdl");
// SetEntPropVector(iTriggerWalk, Prop_Send, "m_vecMins", {-32.0, -72.0, -84.0});
// SetEntPropVector(iTriggerWalk, Prop_Send, "m_vecMaxs", { 32.0, 72.0, 84.0});
// SetEntProp(iTriggerWalk, Prop_Send, "m_fEffects", GetEntProp(iTriggerOnce, Prop_Send, "m_fEffects") |= 32);
// SetEntProp(iTriggerWalk, Prop_Send, "m_nSolidType", 2);
SetEntityBBox(iTriggerWalk, view_as<float>({-32.0, -72.0, -84.0}), view_as<float>({32.0, 72.0, 84.0}));
SetEntitySolid(iTriggerWalk);
SetEntityNodraw(iTriggerWalk);
// roar origin.
fOriginTemp[0] = fOrigin[0] - 15.5;
@ -175,14 +169,12 @@ public void SpawnBalrog(float fOrigin[3])
ActivateAndSpawn(iTriggerRoar);
ParentToEntity(iTriggerRoar, iKnife);
// make the trigger work.
SetEntityModel(iTriggerRoar, "models/vortigaunt_slave.mdl");
// SetEntPropVector(iTriggerRoar, Prop_Send, "m_vecMins", {-736.0, -736.0, -560.0});
// SetEntPropVector(iTriggerRoar, Prop_Send, "m_vecMaxs", { 736.0, 736.0, 560.0});
// SetEntProp(iTriggerRoar, Prop_Send, "m_fEffects", GetEntProp(iTriggerRoar, Prop_Send, "m_fEffects") |= 32);
// SetEntProp(iTriggerRoar, Prop_Send, "m_nSolidType", 2);
SetEntityBBox(iTriggerRoar, view_as<float>({-736.0, -736.0, -560.0}), view_as<float>({736.0, 736.0, 560.0}));
SetEntitySolid(iTriggerRoar);
SetEntityNodraw(iTriggerRoar);
// attack origin.
fOriginTemp[0] = fOrigin[0] + 360.5;
fOriginTemp[1] = fOrigin[1] - 58.74;
@ -201,13 +193,11 @@ public void SpawnBalrog(float fOrigin[3])
ActivateAndSpawn(iTriggerAttack);
ParentToEntity(iTriggerAttack, iKnife);
// make the trigger work.
SetEntityModel(iTriggerAttack, "models/vortigaunt_slave.mdl");
// SetEntPropVector(iTriggerAttack, Prop_Send, "m_vecMins", {-152.0, -256.0, -71.5});
// SetEntPropVector(iTriggerAttack, Prop_Send, "m_vecMaxs", { 152.0, 256.0, 71.5});
// SetEntProp(iTriggerAttack, Prop_Send, "m_fEffects", GetEntProp(iTriggerAttack, Prop_Send, "m_fEffects") |= 32);
// SetEntProp(iTriggerAttack, Prop_Send, "m_nSolidType", 2);
SetEntityBBox(iTriggerAttack, view_as<float>({-152.0, -256.0, -71.5}), view_as<float>({152.0, 256.0, 71.5}));
SetEntitySolid(iTriggerAttack);
SetEntityNodraw(iTriggerAttack);
// ambient_generic walk.
int iSoundWalk = CreateEntityAtOrigin("ambient_generic", fOrigin);
@ -251,6 +241,7 @@ public void SpawnBalrog(float fOrigin[3])
ActivateAndSpawn(iSoundAttack);
ParentToEntity(iSoundAttack, iKnife);
// logic_relay roar.
int iRelayRoar = CreateEntityAtOrigin("logic_relay", fOrigin);
DispatchKeyFormat(iRelayRoar, "targetname", "item_balrog_roar_relay_%d", g_iCounter);
DispatchKeyFormat(iRelayRoar, "spawnflags", "0");
@ -262,9 +253,15 @@ public void SpawnBalrog(float fOrigin[3])
DispatchKeyFormat(iRelayRoar, "OnTrigger", "item_balrog_roar_sound_%d,PlaySound,,1,-1", g_iCounter);
DispatchKeyFormat(iRelayRoar, "OnTrigger", "item_balrog_roar_relay_%d,Enable,,25,-1", g_iCounter);
DispatchKeyFormat(iRelayRoar, "OnTrigger", "item_balrog_attack_relay_%d,Enable,,4,-1", g_iCounter);
DispatchKeyFormat(iRelayRoar, "OnTrigger", "item_spawn_speedmod,ModifySpeed,0,0,-1");
DispatchKeyFormat(iRelayRoar, "OnTrigger", "item_spawn_speedmod,ModifySpeed,0,1,-1");
DispatchKeyFormat(iRelayRoar, "OnTrigger", "item_spawn_speedmod,ModifySpeed,0,2,-1");
DispatchKeyFormat(iRelayRoar, "OnTrigger", "item_spawn_speedmod,ModifySpeed,0,3,-1");
DispatchKeyFormat(iRelayRoar, "OnTrigger", "item_spawn_speedmod,ModifySpeed,0.8,4,-1");
ActivateAndSpawn(iRelayRoar);
ParentToEntity(iRelayRoar, iKnife);
// logic_relay attack.
int iRelayAttack = CreateEntityAtOrigin("logic_relay", fOrigin);
DispatchKeyFormat(iRelayAttack, "targetname", "item_balrog_attack_relay_%d", g_iCounter);
DispatchKeyFormat(iRelayAttack, "spawnflags", "0");
@ -276,6 +273,11 @@ public void SpawnBalrog(float fOrigin[3])
DispatchKeyFormat(iRelayAttack, "OnTrigger", "item_balrog_attack_sound_%d,PlaySound,,1,-1", g_iCounter);
DispatchKeyFormat(iRelayAttack, "OnTrigger", "item_balrog_roar_relay_%d,Enable,,4,-1", g_iCounter);
DispatchKeyFormat(iRelayAttack, "OnTrigger", "item_balrog_attack_relay_%d,Enable,,4,-1", g_iCounter);
DispatchKeyFormat(iRelayAttack, "OnTrigger", "item_spawn_speedmod,ModifySpeed,0,0,-1");
DispatchKeyFormat(iRelayAttack, "OnTrigger", "item_spawn_speedmod,ModifySpeed,0,1,-1");
DispatchKeyFormat(iRelayAttack, "OnTrigger", "item_spawn_speedmod,ModifySpeed,0,2,-1");
DispatchKeyFormat(iRelayAttack, "OnTrigger", "item_spawn_speedmod,ModifySpeed,0,3,-1");
DispatchKeyFormat(iRelayAttack, "OnTrigger", "item_spawn_speedmod,ModifySpeed,0.8,4,-1");
ActivateAndSpawn(iRelayAttack);
ParentToEntity(iRelayAttack, iKnife);
@ -283,7 +285,8 @@ public void SpawnBalrog(float fOrigin[3])
fOriginTemp[0] = fOrigin[0] + 44.0;
fOriginTemp[1] = fOrigin[1] - 18.74;
fOriginTemp[2] = fOrigin[2] + 126.89;
/*
// func_physbox_multiplayer health.
int iHealth = CreateEntityAtOrigin("func_physbox_multiplayer", fOriginTemp);
DispatchKeyFormat(iHealth, "targetname", "item_balrog_health_%d", g_iCounter);
DispatchKeyFormat(iHealth, "spawnflags", "574464");
@ -328,31 +331,21 @@ public void SpawnBalrog(float fOrigin[3])
ActivateAndSpawn(iHealth);
ParentToEntity(iHealth, iKnife);
// SetEntPropVector(iHealth, Prop_Send, "m_vecMins", {-124.0, -120.0, -188.2});
// SetEntPropVector(iHealth, Prop_Send, "m_vecMaxs", { 124.0, 120.0, 188.2});
// SetEntProp(iHealth, Prop_Send, "m_fEffects", GetEntProp(iHealth, Prop_Send, "m_fEffects") |= 32);
// SetEntProp(iHealth, Prop_Send, "m_nSolidType", 2);
// make the trigger work.
SetEntityModel(iHealth, "models/vortigaunt_slave.mdl");
SetEntityBBox(iHealth, view_as<float>({-124.0, -120.0, -188.2}), view_as<float>({124.0, 120.0, 188.2}));
SetEntitySolid(iHealth);
SetEntityNodraw(iHealth);
HookSingleEntityOutput(iHealth, "OnBreak", BalrogKill, true);
*/
// game_ui.
int iControls = CreateEntityAtOrigin("game_ui", fOrigin);
DispatchKeyFormat(iControls, "targetname", "item_balrog_ui_%d", g_iCounter);
DispatchKeyFormat(iControls, "spawnflags", "0");
DispatchKeyFormat(iControls, "fieldofview", "-1.0");
DispatchKeyFormat(iControls, "PressedAttack", "item_balrog_attack_relay_%d,Trigger,,0,-1", g_iCounter);
DispatchKeyFormat(iControls, "PressedAttack", "item_spawn_speedmod_%d,ModifySpeed,0,0,-1", g_iCounter);
DispatchKeyFormat(iControls, "PressedAttack", "item_spawn_speedmod_%d,ModifySpeed,0,1,-1", g_iCounter);
DispatchKeyFormat(iControls, "PressedAttack", "item_spawn_speedmod_%d,ModifySpeed,0,2,-1", g_iCounter);
DispatchKeyFormat(iControls, "PressedAttack", "item_spawn_speedmod_%d,ModifySpeed,0,3,-1", g_iCounter);
DispatchKeyFormat(iControls, "PressedAttack", "item_spawn_speedmod_%d,ModifySpeed,0.8,4,-1", g_iCounter);
DispatchKeyFormat(iControls, "PressedAttack2", "item_balrog_roar_relay_%d,Trigger,,0,-1", g_iCounter);
DispatchKeyFormat(iControls, "PressedAttack2", "item_spawn_speedmod_%d,ModifySpeed,0,0,-1", g_iCounter);
DispatchKeyFormat(iControls, "PressedAttack2", "item_spawn_speedmod_%d,ModifySpeed,0,1,-1", g_iCounter);
DispatchKeyFormat(iControls, "PressedAttack2", "item_spawn_speedmod_%d,ModifySpeed,0,2,-1", g_iCounter);
DispatchKeyFormat(iControls, "PressedAttack2", "item_spawn_speedmod_%d,ModifySpeed,0,3,-1", g_iCounter);
DispatchKeyFormat(iControls, "PressedAttack2", "item_spawn_speedmod_%d,ModifySpeed,0.8,4,-1", g_iCounter);
AcceptEntityInput(iTriggerStrip, "Enable");
g_iCounter++;