| 06-22-2008, 08:12 PM | #1 |
As title says, I need help on how to actually modify the damage a unit recieves. I dont know how to do it in either JASS (still beginner) or Triggers (read around, couldnt do it the way I need it to work). This is basically what I wanted to do: 1) A Hero is carrying "Iron Sword" with 10 charges. (With 10 as max charges) 2) When Hero attacks, charges drop when "Durability" equals a certain number when randomized. (<-- This is already done) 3) The charges is equal to 9 on Iron Sword, Hero attacks again. 4) The damage that the enemy recieves = 90% of maximum damage (<-- The part I CANNOT do) Changing damage recieved depending on the amount of Charges on the weapon with 10 charges as max, not sure how to do it. |
| 06-22-2008, 08:16 PM | #2 |
I think that this takes quite an afford to work. You'll probably need something like bonusmod to trigger the damage bonus of your sword so you can adjust it via triggers. |
| 06-22-2008, 08:36 PM | #3 |
What do you mean by 90% of maximum damage? |
| 06-22-2008, 09:33 PM | #4 |
You could add Item Attack Damage Bonus (I think that's what the ability is called) to the hero when an item is gained, and set it to the desired level when the weapon is acquired (and remove it when the item is dropped). When durability is lost, just reduce the level of the ability. Only problem would be the fact that the damage is shown as bonus damage (the green text) rather than normal damage. |
| 06-22-2008, 10:04 PM | #5 | |
Quote:
The MaximumDamage = the damage done at that time WITHOUT the changes. The 90% part is calculated to reduce the damage done. So for every charge removed, you lose 10%. @the-thingy: Not sure about that method. I had each weapon with a Item Attack Damage Bonus of +2 already. I have a crafting system for combining weapons and etc. to make weapons with higher bonuses and extras. Wished Blizzard just let us have a goddamned easier way to lower damage. BTW: For reference, watch a "Monster Hunter Freedom" video for the PSP. Weapons have a sharpness system so that when you attack with it, it gets duller. And when it gets too dull, your will do little to no damage. |
| 06-22-2008, 11:41 PM | #6 | ||
Ok, considering how you formulated your question, I'm not exactly sure what's the problem, this... Quote:
Quote:
Since figuring out the first should be fairly easy for someone who has already figured out the second, I'm going to assume it's the second that's giving you problems. Damage prevention is tricky business. First, you need a damage detection system (this part would be just one trigger if we had a generic unit takes damage event, but since that only comes as a specific unit event it takes some more work to get this part working). Once we have damage detection working, it gets tricky. Sometimes, you can just give the unit some life back immediately when the damage detection trigger runs, however, you can only refund life this way when the amount of life refunded is less than the difference between unit's max hp and current hp, otherwise you won't be able to refund as much as you want. When this occurs, you must start a 0.0 second timer in the damage detection trigger and then refund the damage in the function that timer calls (the timer allows for the damage to actually be dealt, thus lowering the unit's actual hp below it's max hp enough that you have "room" to refund it). A new exception here would be if the damage dealt would kill the unit, in that case you would need to refund part of the damage before it's dealt, so the unit doesn't die, and refund the rest after the damage is dealt and you have room to restore the rest of it. Even this won't be enough, though, if you can deal damage higher than the unit's max hp, in that case you need to give the unit a bonus hp ability which allows the unit to survive the damage and then remove the ability and restore the unit's life after the damage is dealt. |
| 06-23-2008, 12:10 AM | #7 |
And then just see what kind of hell it becomes if you try to modify damage multiple times on the same unit at the same moment. That's why I created DamageMod. |
| 06-23-2008, 12:54 AM | #9 |
There is no other method to do it other than the one Anitarf described. |
| 06-23-2008, 12:55 AM | #10 |
Darn, editor is cursed :0 Anyone can give a nice example of a working one? EDIT: Got the charges to actually be calculated into a reduction damage via replacing Lumber (I dont use Lumber in my map for any reason). Now I'm trying to comprehend what Anitarf means by giving the life back and by how much. EDIT 2: Heres my update on the system. It works so far, just need some help with making it nicer. Also a question: Does the trigger edit damage upon the event "takes damage" immediately and changes it right away OR does it change it after it deals the original damage? (Sorry for bad wording, its midnight and lack of sleep) EDIT3: Removed to protect eyes of the innocent! |
| 06-23-2008, 08:25 AM | #11 |
You're using the wrong event responses in your damage detection trigger, "attacked unit" and "attacking unit" should only be used with "unit is attacked" events. That's why your durability counters didn't work properly in the original, you didn't need to use lumber for them. Actual damage is dealt immediately after the damage detection trigger runs, that's why I was talking about 0.0 timers in my previous post, it allows you to refund damage after it's dealt in those cases when you can't refund it earlier due to the unit being at max hp. |
