Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2014-02-28 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog
Chat

War3:Source
February 28, 2014, 02:54:42 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://ownageclan.com/jenkins/job/War3Source-Default1/
WIKI page: http://ownageclan.com/wiki/index.php/Main_Page
War3Source GIT repo: https://github.com/War3Source/War3Source
War3Source servers: http://www.game-monitor.com/search.php?vars=a_war3_version=
War3Source Function Reference: http://ownageclan.com/war3source/functionreference/?search=player
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Help understanding War3_DamageModPercent  (Read 104 times)
Remy Lebeau
Sr. Member
****
Posts: 327



View Profile WWW
« on: February 02, 2014, 04:34:36 PM »

Hi all,

I've come across a different usage of War3_DamageModPercent and wanted to know if this is correct.

I usually use War3_DamageModPercent within a OnW3TakeDmgAllPre function, my assumption being that it modifies the damage for that one instance only (eg, War3_DamageModPercent( 0.0 ) will mean that that one hit will do no damage).

However I've just come across this code:

Code:

public OnUltimateCommand(client,race,bool:pressed)
{
if(War3_GetRace(client)==thisRaceID && IsPlayerAlive(client) && pressed)
{
if(!Silenced(client))
{
if(War3_SkillNotInCooldown(client,thisRaceID,ULT_INTER,true))
{
new ult_inter=War3_GetSkillLevel(client,thisRaceID,ULT_INTER);
if(ult_inter>0)
{
War3_CooldownMGR(client,InterCD[ult_inter],thisRaceID,ULT_INTER,true,true);
War3_DamageModPercent(0.0);
CreateTimer(InterDur[ult_inter], UltOff, client);
}
else
{
PrintHintText(client, "Level your ultimate first");
}
}
}
}
}

public Action:UltOff(Handle:timer,any:client)
{
if(ValidPlayer(client)){
War3_DamageModPercent(1.0);
}
}


This seems to suggest that if you set War3_DamageModPercent OUTSIDE of a damage function, it will modify ALL damage until it's changed... Is this correct?  The downside that I can see is that you can't use a necklace (for example) or any other immunity to negate the damage reduction.
Logged

Revan
Sr. Member
****
Posts: 421



View Profile
« Reply #1 on: February 03, 2014, 05:06:24 PM »

Does the code actually work? I don't think it will do anything because the internal variable gets resetted upon the first W3WhateverDmgPreCall(which then calls into all war3source races/items/stuff).
Logged

#war3source on gamesurge
Remy Lebeau
Sr. Member
****
Posts: 327



View Profile WWW
« Reply #2 on: February 03, 2014, 07:01:40 PM »

Yeah, don't mind me.  I just tested it and it doesn't actually work.  It is wrong code.
Logged

Ownz
Developer
Administrator
Hero Member
*****
Posts: 2332



View Profile WWW
« Reply #3 on: February 03, 2014, 07:08:59 PM »

yup wrong, because each sdk hurt event (pre) the internal global number is reset to 1.0, and each mod percent is multiplied when this function is called.

it should have also given an error when you try to use modpercent outside of designated damage "stack"

if(!g_CanSetDamageMod){
        War3_LogWarning("You may not set damage mod percent here, use ....Pre forward");
        ThrowError("You may not set damage mod percent here, use ....Pre forward");
        //PrintPluginError(plugin);
    }
« Last Edit: February 03, 2014, 07:11:39 PM by Ownz » Logged

DarkEnergy
Remy Lebeau
Sr. Member
****
Posts: 327



View Profile WWW
« Reply #4 on: February 03, 2014, 09:04:47 PM »

ah! I have logging off atm, so didn't catch it.  Twasn't my code, hence why I only just spotted it.  All fixed now Smiley
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!