Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: In light of filter_damage_type not working...  (Read 1565 times)

0 Members and 1 Guest are viewing this topic.

Offline Zadaki_L

  • *
  • +1% chance to make useful post
  • Zadaki_L has no influence.
In light of filter_damage_type not working...
« on: September 23, 2013, 01:04:58 AM »
I'm trying to force the player to take a zombie-infested and completely dark path to locate explosives in order to kill an "armored" antlionguard that can't be killed by bullets.

My plan was to apply a filter_damage_type to exclude bullet damage, and therefore force the player to get the explosives. But neither I nor anyone I can find on teh intarwebs can seem to get it to work in SMOD. I had thought about applying a "SetHealth" input once the explosive physics model islived, but then you could just explode it anywhere, and the antlionguard would die nonsensically. I could use an instant_trig with a touchname (since the antilonguard is in a specific bottleneck to prevent the player from moving forward) to ensure the bomb lands near the antlionguard.

But the npc_antlionguard doesn't accept the SetHealth input. So I'm basically to the point of making sure the player doesn't have enough ammo to kill the antlionguard after dealing with the zombies.

Any more elegant ideas?

Thanks!

Offline Rook

  • *
  • +2% chance to make useful post
  • Rook has no influence.
Re: In light of filter_damage_type not working...
« Reply #1 on: September 23, 2013, 07:18:03 PM »
I know my other post wasn't absolutely clear so here it is in plainer language: by default, SMOD disables damage filtering for most NPCs via the companion_damagefilter variable. Set its value to 1 and in my experience, you'll see filters work perfectly fine.  ;)

If you want to work around this limitation without changing the variable, here's a tested (albeit convoluted) solution for you:

Code: [Select]
// map_name.txt
"entities" {
"npc_antlionguard" {
"origin" "-142 -119 8"
"keyvalues" {
"targetname" "Greg"
}
}
"lua" {
"callfunc" "guardTweak"
}
}

Code: [Select]
-- map_name.lua
function guardTweak()
local name = 'Greg' -- Name of the antlion guard to tweak
local health = 2 -- How many explosive hits needed to trigger death
-- Note that only hits to the front are reliable
local ents = {
boot = {
classname = 'logic_auto',
spawnflags = '1',
OnMapSpawn = {
name.. '_*,FireUser1,,0.1,-1',
name.. ',addoutput,OnHalfHealth !self:SetHealth:500:0.0:-1,0,-1',
}
},
relay = {
classname = 'logic_relay',
targetname = name.. '_damage',
OnTrigger = name.. '_counter,Add,1,0,-1' -- The relay is used to prevent duplicate hits
},
counter = {
classname = 'math_counter',
targetname = name.. '_counter',
startValue = '0',
max = health,
OnHitMax = name.. '_hurt,TurnOn,,0.25,-1' -- Without a delay, death sound routinely misfires
},
blast = {
classname = 'filter_damage_type',
targetname = name.. '_filter',
damagetype = '64',
},
hurt = {
classname = 'point_hurt',
targetname = name.. '_hurt',
damage = '5000',
damageRadius = '32',
damageTarget = name,
OnUser1 = {
'!self,SetParent,' ..name.. ',0.1,-1',
'!self,SetParentAttachment,0,0.2,-1',
},
}
}
local attachments = {
{'0', {h = 12, v = 20}},
{'1', {h = 12, v = 20}}
}
for k, v in pairs(attachments) do
ents['target' ..k] = {
classname = 'func_button',
targetname = name.. '_target',
OnUser1 = {
'!self,SetDamageFilter,' ..name.. '_filter,0,-1',
'!self,SetParent,' ..name.. ',0.1,-1',
'!self,SetParentAttachment,' ..v[1].. ',0.2,-1',
'!self,addoutput,mins -' ..v[2].h.. ' -' ..v[2].h.. ' 0,0,-1',
'!self,addoutput,maxs ' ..v[2].h.. ' ' ..v[2].h.. ' ' ..v[2].v.. ',0,-1',
'!self,addoutput,solid 0,0,-1'
},
OnDamaged = name.. '_damage,Trigger,,0,-1',
}
end
for entry, settings in pairs(ents) do
local ent = HL2.CreateEntity(settings.classname or entry, settings.org or VECTORZERO, settings.ang or VECTORZERO)
if ent then
for k, v in pairs(settings) do
if type(v) ~= 'table' then
HL2.KeyValue(ent, k, v)
else
for _, output in pairs(v) do
HL2.KeyValue(ent, k, output)
end
end
end
HL2.SpawnEntity(ent)
end
end
end

I'm not entirely happy with it but it seems functional.
  • The guard is effectively invulnerable to any weapon that is not capable of killing it in one shot.
  • When explosive damage to the guard's front is recorded, the event adds to a counter. When this counter reaches health, a point_hurt is activated to kill the guard.
  • Thus our guard is killed only after a set number of explosive hits to it are counted.
Let me know if it doesn't work as expected for you.  ;D

Quit asking so many fun questions. I've got things to see and people to do! =)

Offline Xamp

  • *
  • +2% chance to make useful post
  • Xamp has no influence.
Re: In light of filter_damage_type not working...
« Reply #2 on: September 23, 2013, 07:27:26 PM »
Quit asking so many fun questions. I've got things to see and people to do! =)

Don't we all? :P


On wall duty again

Offline Zadaki_L

  • *
  • +1% chance to make useful post
  • Zadaki_L has no influence.
Re: In light of filter_damage_type not working...
« Reply #3 on: September 24, 2013, 01:29:22 AM »
Quit asking so many fun questions. I've got things to see and people to do! =)

Don't we all? :P

Hey, there's 40 engineering students whose assignments aren't getting graded right now...