Author Topic: Properly handle friendly fire and do things to a damaged player?  (Read 752 times)

I'm not sure how to do these things, %player.applyDamage only seems to accept a damage argument, and I'm not sure what the arguments are for %player.damage.
How would I properly do what I want to do? (see title)

%player.damage(Player that does the damage, Position where the damage occurred(might be relative to the player), Amount of damage, Damage type(usually something like $DamageType::Sword));

To do things to a damaged player you could package armor::onDamage(%data, %player, %damage), armor::damage(%data, %player, %source, %pos, %damage, %type), player::damage(%player, %source, %pos, %damage, %type), projectileData::damage(%data, %projectile, %collision, %fade, %pos, %normal), and I think there's a shapeBase::damage too.

What do you mean by "properly handle friendly fire"? Detect it and do something after? Package one of the above functions and check if the players are in the same minigame(and that they're in minigames at all) and then if you're using Slayer check if %client.getTeam() matches with the other person. Check if friendly fire is enabled, etc.
« Last Edit: February 22, 2016, 06:51:16 PM by jes00 »

What do you mean by "properly handle friendly fire"? Detect it and do something after? Package one of the above functions and check if the players are in the same minigame(and that they're in minigames at all) and then if you're using Slayer check if %client.getTeam() matches with the other person. Check if friendly fire is enabled, etc.
Detect if an attacker is on the same team as the victim is what I mean by friendly fire. (e.g. if(%victim.client.team == %attacker.client.team))
I'd like it to negate all damage.
i'll look into those functions.

also not using slayer, strongly dislike relying on 3rd party addons that have the potential to change later on, or break something i'm using.

If you're making your own minigame mod, you should package minigameCanDamage to determine whether players can damage each other. If you're using an existing minigame system and would like your weapon to play nicely with it, call minigameCanDamage(%objA, %objB) to determine if damage should be applied.

Also, don't use the %client.team variable. It has an obscure use in the chat system and will break chat if you change it. What are you making, by the way?

also not using slayer, strongly dislike relying on 3rd party addons that have the potential to change later on, or break something i'm using.

I always take great care to make new versions backwards-compatible. That's not really a good reason to re-make things.

Also, don't use the %client.team variable. It has an obscure use in the chat system and will break chat if you change it. What are you making, by the way?
noted.
I'm working on a mining+splatoon esque gamemode where the speed of weapons and mining is determined by music on the server.

I always take great care to make new versions backwards-compatible. That's not really a good reason to re-make things.
i have other reasons too lol

Code: [Select]
Armor::Damage(%data, %obj, %sourceObject, %position, %damage, %damageType)inherited to player
Code: [Select]
Player::Damage(%obj, %sourceObject, %position, %damage, %damageType)
« Last Edit: February 22, 2016, 10:00:59 PM by Swollow »