World Editor Unlimited Advanced Ability Problem

Undead Me

New Member
Reaction score
5
I was just made the editor of one of my favorite obscure maps, Laosh'Ra's Soulchess, so this week I set about making a new version. The map had been made in WEU which I hadn't used before but I downloaded it and got to work. Things were going pretty well for a while, I did some balancing and made some new abilities, but I ran into trouble with one:

The spell was to be called Enchanted Armor. When activated it gave bonus armor equal to 3% of the caster's max hp. However any time a unit with the Enchanted Armor buff took damage the unit lost 2 mana. If the unit ran out of mana the spell was ended.

The problem I ran into was with the change in armor. I tried to use the advanced trigger unit- change defense. I got all the triggers set up properly, but when I tried to save the map I was told there were now 5 errors in the triggers.

A page appeared with all the triggers in JASS (I'm passably good at JASS but I work with GUI when possible) and it pointed out the 5 lines. Every line was one of the ones that involved changing armor. They all began with "call changearmor." The specific error was called "Error: Expect function" or something like that.

My interpretation of that message is that Editor isn't recognizing "changearmor" as a valid function for some reason. I'm not sure why that would be because elsewhere in the map the original creator used a similar advanced unit- change maximum life with no problems.

Am I missing some obvious step to make an advanced stat change trigger work? Does anyone know another simple way to change armor up and down by a percentage of max life?
 

AoW_Hun7312

I'm a magic man, I've got magic hands.
Reaction score
76
WEU is notoriously known for its memory leaking GUI triggers and seemingly random crashes. I'd advise you switch.

Anyhow, onto your question. In order to do this you'll have to create an ability with X amount of levels (based off of the max health in your map). Have it gain 1 armor for each level. When the ability is casted on an unit, add the ability, then set it to a level based on the health. For example, a unit with 300 health will get 9 armor.
 

Tyman2007

Ya Rly >.
Reaction score
74
WEU has been known to destroy maps..

Use Jass Newgen. You don't need to know Jass to use it.
 

jjonj

New Member
Reaction score
1
Ive had the same problem, i loved WEU for a long time, but it the advanced triggers dont work anymore.

I needed its ability to grant health and armor aswell for my TD so i looked how WEU made its triggers and copied its system:

Here's the function i made (jass)
It requires global variable TempInt
and abilities copied from item ability that gives armor.
My abilities are 'A01S' which gives +16 armor
'A01W' which gives +8 armor and so on..
You call the function like this in your triggers:
Trigger:
  • Custom script: GiveArmor(5, GetLastCreatedUnit())

to give last created unit 5 armor
JASS:
function GiveArmor takes integer amount, unit WhichUnit returns nothing
    set udg_TempInt = amount
    loop
        exitwhen udg_TempInt == 0
        if udg_TempInt >= 16 then
            set udg_TempInt = udg_TempInt - 16
            call UnitAddAbilityBJ( 'A01S', WhichUnit )
        elseif udg_TempInt >= 8 then
            set udg_TempInt = udg_TempInt - 8
            call UnitAddAbilityBJ( 'A01W', WhichUnit )
        elseif udg_TempInt >= 4 then
            set udg_TempInt = udg_TempInt - 4
            call UnitAddAbilityBJ( 'A01V', WhichUnit )
        elseif udg_TempInt >= 2 then
            set udg_TempInt = udg_TempInt - 2
            call UnitAddAbilityBJ( 'A01U', WhichUnit )
        elseif udg_TempInt >= 1 then
            set udg_TempInt = udg_TempInt - 1
            call UnitAddAbilityBJ( 'A01X', WhichUnit )
        endif
    endloop
endfunction
 

Ayanami

칼리
Reaction score
288
There is another alternative, if you want damage, armor, etc. All you need is 5 abilities based on "Item - Armor Bonus" or "Item - Damage Bonus", depending on what you want. This method supports up to 99999 armor. It can be increased easily if needed.

I'll assume you need armor here.

Create 5 ability, all based on "Item - Armor Bonus". Change it to a unit ability. Set it to have 10 levels. Now, set all the level intervals with interval of ones, starting from 0. Here's an example.

Level 1: 0
Level 2: 1
Level 3: 2
...and so on.

For the next ability, set all the levels with intervals of tens, starting from zero yet again. Here's an example.

Level 1: 0
Level 2: 10
Level 3: 20
...and so on.

Repeat this until you reach your 5th ability, which should look something like this:

Level 1: 0
Level 2: 10000
Level 3: 20000
...and so on.

Now comes the triggering part. It's quite simple actually. Here are the variables that you need.

Variables
ArmorAbility - Ability Array with size of 5
TempReal - Real
TempDivider - Integer
TempInt - Integer
TempUnit - Unit

Now, in map initialization, set your ArmorAbility variables to the armor bonus spells. The highest interval (0, 10000, 20000, ...) should be set as ArmorAbility[1], while the lowest armor interval (0, 1, 2, ...) at ArmorAbility[5].

Trigger:
  • Initialize
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ArmorAbility[1] = Armor Bonus (10000's)
      • Set ArmorAbility[2] = Armor Bonus (1000's)
      • Set ArmorAbility[3] = Armor Bonus (100's)
      • Set ArmorAbility[4] = Armor Bonus (10's)
      • Set ArmorAbility[5] = Armor Bonus (1's)


And now, we have to add these abilities when the hero learns the certain spell.

Trigger:
  • Learned
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to MyAbility
      • (Level of MyAbility for (Triggering unit)) Equal to 1
    • Actions
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • Unit - Add ArmorAbility[IntegerA] to (Triggering unit)


When you add these abilities, it should provide 0 bonus armor as they are set to level 1 by default. That's the purpose of having armor bonus of 0 at every level 1. Now here's the armor adding part.

Trigger:
  • Armor Bonus
    • Events
      • <Your Event>
    • Conditions
      • <Your Conditions>
    • Actions
      • Set TempUnit = (Triggering unit) <-- Depends on what your event is
      • Set TempReal = 500.00 <-- Your armor bonus amount
      • Set TempDivider = 10000
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set TempInt = ((Integer(TempReal)) / TempDivider)
          • Unit - Set level of ArmorAbility[(Integer A)] for TempUnit to (TempInt + 1)
          • Set TempReal = (TempReal - (Real((TempInt x TempDivider))))
          • Set TempDivider = (TempDivider / 10)


You will get the exact bonus armor as stated in "Set TempReal" part (except the decimals of course). The armor bonus cap is up to 99999 in this case.

Using JASS would be much easier to accomplish this though, as you won't have to copy this whole chunk of code every time you want to apply bonus armor.
 

Undead Me

New Member
Reaction score
5
Thanks for the great responses everyone, though I think I'll stick with WEU at least until I finish this version.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top