General > Developers Corner
Player damage & NPCs + Teams
Buzzkill:
Guys, I know the answer to this one is going to be a facepalm moment for me...
If I spawn a typical zombie (npc_zombie or npc_fastzombie) it will do damage during its attacks when players are not assigned to teams. The moment I assign teams, the zombies still attempt to attack, but no damage is dealt. Example:
In JailBreak, players are assigned to Team 1 or Team 2 (prisoners/guards)
If I spawn a zombie in (manually or through ulx maul) it doesn't do damage despite its efforts to attack (eventually ulx maul will kill the player because it has a failsafe built in, but thats moot).
*IF* I modify the JailBreak code to assign the player to Team 0 (which of course breaks much of JailBreak's gameplay), zombies then do damage as expected (like they do in non-Team gamemodes like base or sandbox).
What am I missing here? I don't think it's a relationship issue, since ulx maul very specifically sets the relationship. I tried putting breadcrumbs in PlayerShouldTakeDamage both in Jailbreak and in base and I see no activity.
Thanks (again!)
Mike
JamminR:
Without looking at the entire gamemode code, my guess is that there's specific code somewhere to only allow team damage from opposing teams. (Obvious, yes, I know you're likely asking 'where')
At first thought, yes, I'd think that should be in PlayerTakeDamage. But, I could also see perhaps other checks used. Primary and or Secondary attack perhaps.
Does Jailbreak allow damage any other way but by the other team? (fall damage, vehicle?, prop?)
Anything in 'any' PlayerTakeDamage hook that does team comparisons?
When the wolves get spawned, are they assigned a team by the gamemode? (my guess is no of course)
Buzzkill:
Thanks. I'd gone through as many hooks and overrides as I could find that seemed relevant, but of course I could have (and likely have) missed something. Will look again.
No team assignment to the NPC's as far as I can see, especially since ULX's own maul command is suffering the same issue (and why I felt like I could sneak the question in here, even though it's not really a ULX issue).
What's more, strider and headcrab damage works as expected, so I'm not sure if there's a common base class for zombies that is the issue, or perhaps slash damage (versus bullet, poison, etc).
Thanks,
Mike
JamminR:
Wow, so, headcrabs, striders and other creatures cause damage but wolves do not. And, you've tried spawning using non-ulx spawned wolves I take it.
There are class commands in Gmod now, (You may know that, but I just stumbled across it while searching your issue in the Gmod wiki) I'd dig into class assignment checks too.
And, for your information, Dev corner is for more than just ULX/Lua coding questions.
Though it's intended for focus on our projects of course, we do like to exercise our brains outside of Team Ulysses projects.
(Oh, and for fun searches through code like this, I use a Windows 'grep' like tool. If you're not on linux, search out "dngrep". I like it much better than Windows search)
Does jailbreak allow team killing? If not, it's own protection scheme may be preventing wolves from hurting. Perhaps see if you can find that mechanism.
Buzzkill:
Just FYI -- it's zombies (ie, npc_zombie and npc_fastzombie, though there may be others) that are the issue. Wolves seem to have crept in -- just wanted to clarify. :)
Most everything I do server-wise for gmod is in linux, so yes -- grep and I are good friends. :) JB does have its own protection scheme baked into PlayerShouldTakeDamage. I've put breadcrumb statements in before any of the logic (as well as turning the logic on and off) and none of my zombie attacks ever make it that far. And these are overrides too -- not hooks,
Navigation
[0] Message Index
[#] Next page
Go to full version