Need Help With Setting Unit Damage

Blood_Wraith

New Member
Reaction score
2
I was wondering how you set a unit's damage, I couldn't find any obvious trigger actions for that, so I'm fairly lost here. I need to know how to set a units damage to something like this:

Unit - A unit Starts the effect of an ability

(Ability being cast) Equal to Summon Chocobo

Unit - Set damage of (Last created unit) to (Hero Level of Casting Unit + Hero Intelligence of Casting Unit X 6) X 1

Basically I'm going for a dynamic summon system with the summons damage, any help would be appreciated.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
Trigger:
  • Trigger
    • Events
      • Unit - A unit spawns a summoned unit
    • Conditions
      • Unit Type - Spawned unit type is equal to X
    • Actions
      • For Integer A from 1 to (Hero Level of Summoning Unit + Hero Intelligence of Summoning Unit X 6)
        • Loop - Actions
          • Item - Give Summoned Unit a Tome of Damage + 1

this should work but they will need to have a hero type inventory, so that they can use tomes
 

Blood_Wraith

New Member
Reaction score
2
Well it works, technically, but two problems; One: It spawns a bunch of TEENY tome effects which NEVER go away, thus taking up resources (I changed the tome model to a custom bag model, while it appears to leave no effects behind, the area of where they were spawned/used LAGS), and Two: When the Hero has a lot of Intelligence, it spawns SO MUCH TOMES, it super lags me for several seconds, and I also experienced a bunch of random doodads teleporting to the position of the summoned unit TWITCHING with screwed up vertexes, or whatever. I'm probably gonna need custom script to modify the unit's damage, which is what I wanted in the first place (even know I know pretty much nothing about it). Maybe I did the trigger wrong, take a look.

Trigger:
  • Events
    • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Chocobo (Summon)
    • Actions
      • For each (Integer A) from 1 to ((((Hero level of (Summoning unit)) + (Intelligence of (Summoning unit) (Include bonuses))) x 6) x 1), do (Actions)
        • Loop - Actions
          • Hero - Create Summon Damage Tome and give it to (Summoned unit)


Sorry I didn't know how to use the wc3 forum code before, I learned that from your post in my other thread, thanks. Still need help though.
 

merlinds

Member
Reaction score
15
You already solved the first problen. Just remove all the SE of the tomes.
For the second problem, just create diferent types of tomes, for example
TOme +1
Tome +2
Tome +3
Tome +4
Then after the loop you set a variable to:
Lvl of casting hero X inteligence of the hero X 6.
Then you manually set an if/then/else to check the amount, for example:
If the result is 25 you give the unit 25 Tomes +1 or 5 Tomes +5
If the result is 50 you give the unit 10 Tomes +5
In this way you reduce the amount of tomes, and the lag. I hope you understand the idea.
 

BloodySkullz

Active Member
Reaction score
10
What's the ability that the tomes should use?

I don't recall seeing a Powerup ability adding permanent damage, only stats such as Agility or Strength.
 

Iwan_Krissov

New Member
Reaction score
18
I was wondering how you set a unit's damage, I couldn't find any obvious trigger actions for that, so I'm fairly lost here. I need to know how to set a units damage to something like this:

If it does not matter to you, that the extra damage is displayed in green, you could create an ability based on the "Item - Damage Bonus +1". Switch off "Item-Ability", give it several levels, where each level will have another amount of damage added. (Level 1: +1 Damage, Level 2: +2 Damage etc...).
Add this ability to your units and than you can switch the level to the one you want via trigger functions...

Edit:
Can also be done similar with tech-levels. This would remove the green damage-numbers but there would be the numbers for techlevels at the attack-display...
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
It's possible to add an Item Damage Bonus ability to the unit and increase the damage that way, or have several different ones of 10 levels each to manipulate the value of the ones, tens, hundreds and so on. Since the ability has no icon, you can give it directly to the unit and increase its level to a certain integer value.
 

vypur85

Hibernate
Reaction score
803
If you don't mind the green values then you can check out 'Set Damage' located in my signature below. It's a system that allows you to set damage of a unit with just 5 abilities with 10 levels each. As suggested by the post above.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
you could split it up into bulks, i could do this easily with jass and a couple of extra items (+1, +5, +25, +100, +500, +2500, +10k, etc) that way it increases it 1 time for a MUCH larger number to reach that number with way less items

like this:
JASS:
function StatIncrease takes integer Max, unit u returns nothing
    local integer i = Max
    loop
        exitwhen (i == 0)
        if (i >= 10000) then
            call UnitAddItem(u, 10kItem)
            set i = i - 10000
        elseif (i >= 2500) then
            call UnitAddItem(u, 2.5kItem)
            set i = i - 2500
        elseif (i >= 500) the
            call UnitAddItem(u, 500Item)
            set i = i - 500
        elseif (i >= 100) then
            call UnitAddItem(u, 100Item)
            set i = i - 100
        elseif (i >= 25) then
            call UnitAddItem(u, 25Item)
            set i = i - 25
        elseif (i >= 5) then
            call UnitAddItem(u, 5Item)
            set i = i - 5
        else
            call UnitAddItem(u, 1Item)
            set i = i - 1
        endif
    endloop
endfunction
 

Ayanami

칼리
Reaction score
288
you could split it up into bulks, i could do this easily with jass and a couple of extra items (+1, +5, +25, +100, +500, +2500, +10k, etc) that way it increases it 1 time for a MUCH larger number to reach that number with way less items

like this:
JASS:
function StatIncrease takes integer Max, unit u returns nothing
    local integer i = Max
    loop
        exitwhen (i == 0)
        if (i >= 10000) then
            call UnitAddItem(u, 10kItem)
            set i = i - 10000
        elseif (i >= 2500) then
            call UnitAddItem(u, 2.5kItem)
            set i = i - 2500
        elseif (i >= 500) the
            call UnitAddItem(u, 500Item)
            set i = i - 500
        elseif (i >= 100) then
            call UnitAddItem(u, 100Item)
            set i = i - 100
        elseif (i >= 25) then
            call UnitAddItem(u, 25Item)
            set i = i - 25
        elseif (i >= 5) then
            call UnitAddItem(u, 5Item)
            set i = i - 5
        else
            call UnitAddItem(u, 1Item)
            set i = i - 1
        endif
    endloop
endfunction

Why are you adding items?
 

Blood_Wraith

New Member
Reaction score
2
What's the ability that the tomes should use?

I don't recall seeing a Powerup ability adding permanent damage, only stats such as Agility or Strength.

It's Item Permanent Damage Gain.

If it does not matter to you, that the extra damage is displayed in green, you could create an ability based on the "Item - Damage Bonus +1". Switch off "Item-Ability", give it several levels, where each level will have another amount of damage added. (Level 1: +1 Damage, Level 2: +2 Damage etc...).
Add this ability to your units and than you can switch the level to the one you want via trigger functions...

Edit:
Can also be done similar with tech-levels. This would remove the green damage-numbers but there would be the numbers for techlevels at the attack-display...

Tech-levels? You mean upgrades right? How would I do that? Give me an example please.
If you don't mind the green values then you can check out 'Set Damage' located in my signature below. It's a system that allows you to set damage of a unit with just 5 abilities with 10 levels each. As suggested by the post above.

Well I copied your system into my map and of course modified it a bit to work for my trigger, and it works! But for some reason when I do my -vision chat command (a trigger I put in to reveal the whole map), it lags, which it didn't do that before, oh well. It didn't lag when I do iseedeadpeople, for some reason though. Anyways have some rep, also it would be cool if someone gave me an example of how that upgrade type trigger would work.

Edit: Also it lags for a moment at the beginning of my map, when I do a command to unpause/make vulnerable several units, but like I said: Weird. As long as it only does that ONCE that I'm fine.
 

vypur85

Hibernate
Reaction score
803
Upgrade is not such a good idea for dynamic damage settings because upgrades cannot be degraded.

Lag is common (without preloading) when implementing the simple system because there are 5 abilities with 10 levels each. Technically, this is not much and won't cause much stress to the computer in a long run. I have no idea why the vision trigger lags the game. Perhaps there are too many units localised at certain region which causes this problem.

And the system I made did not include preloading of the 5 abilities. So it's natural to lag a little when the abilities are added for the first time. Try preloading them. It gets better that way, I hope.
Code:
Damage System Init
    Events
        Map initialization
    Conditions
    Actions
        Set Int_DamageSys_DigitCount = 5
        Set Abi_DamageSys_Damage[1] = Damage (1x) 
        Set Abi_DamageSys_Damage[2] = Damage (10x) 
        Set Abi_DamageSys_Damage[3] = Damage (100x) 
        Set Abi_DamageSys_Damage[4] = Damage (1000x) 
        Set Abi_DamageSys_Damage[5] = Damage (10000x)
        [B]Unit - Create 1 AnyUnitAtAll for WhoEverAtAll at AnywhereAtAll facing wherever....
        For each (Integer A) from 1 to 5, do (Actions)
            Loop - Actions
                Unit - Add Abi_DamageSys_Damage[Integer A] to (Last created unit)
        Unit - Remove (Last created unit)[/B]

Just add the bolded stuff.
 

Blood_Wraith

New Member
Reaction score
2
I guess it fixed the lag after I added those lines, thanks again! But a problem (which I can get by I suppose) is that I can't do something like Arithmetic: (Hero Level + Hero Intelligence X 6) X 0.50, it seems to be strict, not allowing me to do point.anything. For summons atleast, I'll bypass that by just modifying the (Hero Level + Hero Intelligence) part and leave the X 0.50 (or whatever comes after hero level + hero intelligence) part. Actually in this case I just left the (X 0.50, or whatever) part to X 1.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
I think you should change the "x 0.50" to "/ 2". Integers and reals don't work well with each other. Better still, convert all your integers into reals and use the real values instead.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top