• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Custom Combat System

Status
Not open for further replies.
Level 3
Joined
Jan 15, 2010
Messages
47
Hey all :)

Working on a custom combat system. The goal at this point is to make 1 armor reduce 1 damage. This is how it works in Gaia's Retaliation, for example, a unit deals 20 damage, the attacked unit has 5 armor, thus taking 15 damage.

I am using systems for damage detection and to determine armor. I have my trigger at the point where each time a unit is attacked, it displays the attacker, attacker's armor, defender, defenders armor, full damage (before armor), and reduced damage (after armor). Using these variables, I figured I could make this system first by reducing the effects of the normal wc3 system.

JASS:
    call SetWidgetLife(defender, GetWidgetLife(defender) + reducDamage)

Next step would be to apply the new damage. I changed that line to:

JASS:
    call SetWidgetLife(defender, (GetWidgetLife(defender) + reducDamage) + (fullDamage - defenderArmor))

My test:
I set up a little area with a hero and a footmen.

The results:
The first time a unit with full health is hit, they take the normal wc3 combat system determined damage (the reduced damage). At that point, they both seem to be in perpetual combat. Their life seems to be set to their max life minus the damage dealt. Each hit. I am not sure why. I thought it might be the GetWidgetLife returning the units max life, but I tested that too and it returns the current life.

I am sure someone sees a simple logical error that I have made, or better yet, I will figure it out as soon as I finally hit submit. Either way, help/advice/suggestions always appreciated :) Thanks!
 
Level 3
Joined
Jan 15, 2010
Messages
47
Based on the armor detection system i'm using, I don't need to alter the gameplay constant... aaaand i see my issue. I healed the unit for the intended damage, not damaged them >.<

But your equation works otherwise :)

Thanks!

Edit: After further testing, your equation works and mine doesn't. Hmm. Thanks!

I did the testing with a hero with 9 armor and a footmen with 10-10 dmg and I am taking 2 damage though :/
 
Last edited:
Level 3
Joined
Jan 15, 2010
Messages
47
yes, all constants for weapon/armor types set to 1.00.

maybe i should do this in 2 steps to be safe?
1. heal dmg dealt from normal system
2. deal dmg from new system?
 
Level 3
Joined
Jan 15, 2010
Messages
47
Also, it seems like nothing can be done about the first hit, as in, the combat system is malfunctioning...

For example, if i have 10 armor and the enemy has 10 dmg, I should *theoretically* not be taking damage, yet it goes to 92/100 health and stays there while he gets hit...

Any thoughts?
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
-take resistant skin
-i think you will need to put resistant skin in spellbook ability and disable spellbook to all players so that you don't see icon of resistant skin
-i think you will need a custom resistant skin value,you can use my system for that (go to my profile)


-and make armor take 100% of damage
OR
-use footman´s and set it to take 100% damage
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
The following code will add the necessary abilities (via ObjectMerger) but you need JNGP with Grimoire. The spell-book ability that is created is disabled (so that passive abilities contained in the spell-book are still active) which means when you add it it will not show up on the UI. This only needs to be done once, at map initialization (as shown).

JASS:
//! external ObjectMerger w3a Assk Blck Ssk3 1 99999.00 Ssk2 1 0.0 areq "" atar 1 "enemies,friend,neutral"
//! external ObjectMerger w3a Aspb Blk~ aite 0 spb1 1 "Blck" spb3 1 1 spb4 1 1 spb5 1 "none"

scope NegateDamageSetup initializer init
public function init takes nothing returns nothing
    // The object merger external calls above will add the necessary abilities. To
    // add the spell-book (containing the actual ability) simply use:
    //      UnitAddAbility(yourUnit, Blk~)
    local integer i = 0
    loop
        exitwhen(i == 16)
        call SetPlayerAbilityAvailable(Player(i), 'Blk~', false)
        set i = i + 1
    endloop
endfunction
endscope
 
Level 3
Joined
Jan 15, 2010
Messages
47
Ok, well I had been working on this and just got the email saying posts were made. ><

But yeah, I have been working with the resistant skin type buff with max damage blocked and stuff, but now my damage detection system doesn't work correctly. >< I think because it works on checking if a units health changes when a unit is attacked... idk I am about to read through the damage detection system i am using... (Intuitive Damage Detection System 1.13 by Rising_Dusk if anyone has any experience or can suggest a better one)

Edit:
After having read the damage detection system, i get to this code:

private function RunConditions takes nothing returns boolean
//* The conditions for what must be true for damage detection to run
return GetEventDamage() >= 0.0001 and DamageType != DAMAGE_TYPE_IGNORED
endfunction

I am guessing that if I have a resistant skin with 99999.00 damage absorb, and not leaving any damage, the event damage will be 0? Got some testing to do, or if anyone already knows, it will save some time :) Thanks!

Edit2: changed the resistant skin to absorb all but 0.01 damage :) Works flawlessly so far! Thanks for all the help guys. Slowly getting all my systems functional! Only need to learn how to do multiboards and a special spawn system and a save system and all my rpg systems will be complete :)

Edit3: Is there a way to detect a units damage? I think I am going at this the wrong way now. The event damage is now 0.011. So I can't determine the new damage amount, as it was an equation based off the event damage.
 
Last edited:
Status
Not open for further replies.
Top