Hello everyone. Such a question. I want to make an "all against all" mode. In "Team Settings" I choose the "Free For All" mode, but at this moment my rocket launcher causes damage to myself. Setting up the "FriendlyExplosionDamage" weapon does not give a result, although it works correctly in other modes ("Team Versus" and "Frienly"). If I delete "TeamSettings", then when testing with bots, someone still becomes my ally. Question: how can I make sure that in the "only enemies are around" mode, I do not cause damage to myself? Thank you in advance for your help.
seems to be a bug in the WeaponProjectileExplosionServer script or the CustomProperty("FriendlyExplosionDamage") that the script references. This script determines who gets damaged and by how much. The script checks if FriendlyExplosionDamage is ticked but sets the result to true regardless of whether it is ticked or not. Workaround that worked for me was to deinstance the rocket launcher template change the name of the custom property to something new eg FriendlyDamage then edit line 37 in the script
from
"local FRIENDLY_EXPLOSION = script:GetCustomProperty("FriendlyExplosionDamage")"
to
"local FRIENDLY_EXPLOSION = script:GetCustomProperty("FriendlyDamage")"
save script, test and then save this modified rocket launcher as a new template.
Hi, thanks for the answer. I tried your method, but it didn't work out.
- I could not rename the property, it is located in the Scripts section, there is simply no such function.
- I created a new custom property, named it FriendlyDamage and renamed it in the script itself local FRIENDLY_EXPLOSION = script: GetCustomProperty ("FriendlyDamage"). But the result was still the same. I even commented out this part of the code:
elseif not Teams code.Are Team s Enemies(target.team, WEAPON.owner.team)
and FRIENDLY_EXPLOSION then
can Damage = true
But still the damage is done on me... Maybe there are some other ideas?
Yaahhu, I did it!!! If someone is interested, then we need this place of code:
-- The farther the player from the blast the less damage that player takes
local damageAmount = CoreMath.Lerp(EXPLOSION_DAMAGE_RANGE.y, EXPLOSION_DAMAGE_RANGE.x, (displacement).size / EXPLOSION_RADIUS)
-- Create damage information
local damage = Damage.New(damageAmount)
damage.sourcePlayer = WEAPON.owner
-- Apply damage to player
target:ApplyDamage(damage)
I added the following condition there:
if target == WEAPON.owner then
damageAmount = 0
end
Now this piece of code looks like this:
-- The farther the player from the blast the less damage that player takes
local damageAmount = CoreMath.Lerp(EXPLOSION_DAMAGE_RANGE.y, EXPLOSION_DAMAGE_RANGE.x, (displacement).size / EXPLOSION_RADIUS)
if target == WEAPON.owner then
damageAmount = 0
end
-- Create damage information
local damage = Damage.New(damageAmount)
damage.sourcePlayer = WEAPON.owner
-- Apply damage to player
target:ApplyDamage(damage)
I even felt like a programmer!!!! :))
well done.
I even felt like a programmer!!!! :))
It is that buzz you get when it finally works that makes programming/scripting addictive.