• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Ability Level Increasing Issue

Status
Not open for further replies.
Level 10
Joined
Mar 25, 2008
Messages
339
I'm having issues with a spell leveling system i want to implement in my map, you begin by buying a item which instantly disaspears and Adds the Ability to your hero.
The leveling system im trying to implement simply looks if you have the spell and if you do it increases its level once you buy it again, for some reason neither of the following work, what can i do to make it work?

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of Throw Rock (Buy) for (Triggering unit)) Equal to 1
    • Then - Actions
      • Unit - Increase level of Throw Rock (Buy) for (Triggering unit)
    • Else - Actions
      • Do nothing
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of Throw Rock (Buy) for (Triggering unit)) Equal to 1
    • Then - Actions
      • Unit - Set level of Throw Rock (Buy) for (Triggering unit) to 2
    • Else - Actions
      • Do nothing
 
Level 10
Joined
Mar 25, 2008
Messages
339
Does the unit have the ability, where do you add it? What is the event?

Is a massive trigger, but ill post it if i can figure out which one of these allow for the person to open it to look at it, its basically like this though
  • Unit - A unit Acquires an item
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SpellAmount[(Player number of (Owner of (Triggering unit)))] Less than or equal to 4
      • (Item-type of (Item being manipulated)) Equal to Bash
    • Then - Actions
      • Unit - Add Bash (Buy) to (Triggering unit)
      • Set SpellAmount[(Player number of (Owner of (Triggering unit)))] = (SpellAmount[(Player number of (Owner of (Triggering unit)))] + 1)
    • Else - Actions
The Heros start with No spells, they buy a item which in return adds the ability too them, my form of a spell picking/buying system.
 
Level 10
Joined
Mar 25, 2008
Messages
339
Seems the trigger i was trying to put it in was causing it not to work correctly, i have it working now, but now the first time you buy it it goes to level 2 automatically, because it simply looks if the hero has the spell and if he does it ups it to level 2 so both hit at the same time apparently, is there any way i can fix that short of putting the entire triggers data below the entire leveling systems?
  • Spell Level Trigger
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Bash
          • And - All (Conditions) are true
            • Conditions
              • (Level of Bash (Buy) for (Triggering unit)) Greater than 0
              • (Level of Bash (Buy) for (Triggering unit)) Less than 3
        • Then - Actions
          • Unit - Increase level of Bash (Buy) for (Triggering unit)
        • Else - Actions
          • Do nothing
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
  • Spell Level Trigger
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Bash
        • Then - Actions
          • if ability level == 0 then
            • add abil
          • else
            • Unit - Increase level of Bash (Buy) for (Triggering unit)
        • Else - Actions
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
If you're into hashtables, then you could do it with two triggers.

The first trigger binds item types with abilities. You save an integer, the ability raw code for each item type.

call SaveInteger(hash, ItemTypeId, 0, abilityID)

In the "unit acquires an item" trigger, you load the integer (ability).

set abilID = LoadInteger(hash, GetItemTypeId(GetManipulatedItem()), 0)
if GetUnitAbilityLevel(GetTriggerUnit(), abilID) == 0 then
call UnitAddAbility(GetTriggerUnit(), abilID)
else
call IncUnitAbilityLevel(GetTriggerUnit(), abilID)
endif

Something like that.
 
Level 10
Joined
Mar 25, 2008
Messages
339
Heres what i eventually came up with, and yes it took alot of work lol, the trigger is so massive it almost crashes the world editor when opened xD.
About 30 to 50 of this:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SpellAmount[(Player number of (Owner of (Triggering unit)))] Less than or equal to 4
      • (Item-type of (Item being manipulated)) Equal to Bash
      • (Level of Bash (Buy) for (Triggering unit)) Equal to 0
    • Then - Actions
      • Unit - Add Bash (Buy) to (Triggering unit)
      • Set SpellAmount[(Player number of (Owner of (Triggering unit)))] = (SpellAmount[(Player number of (Owner of (Triggering unit)))] + 1)
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Bash
          • And - All (Conditions) are true
            • Conditions
              • (Level of Bash (Buy) for (Triggering unit)) Greater than or equal to 1
              • (Level of Bash (Buy) for (Triggering unit)) Less than 3
        • Then - Actions
          • Unit - Increase level of Bash (Buy) for (Triggering unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Bash
              • (Level of Bash (Buy) for (Triggering unit)) Equal to 0
              • SpellAmount[(Player number of (Owner of (Triggering unit)))] Equal to 5
            • Then - Actions
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |c00ff0000You alrea...
            • Else - Actions
              • Do nothing
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Bash
              • (Level of Bash (Buy) for (Triggering unit)) Equal to 3
              • (Hero level of (Triggering unit)) Greater than or equal to 20
            • Then - Actions
              • Unit - Increase level of Bash (Buy) for (Triggering unit)
            • Else - Actions
              • Do nothing
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Game - Display to (Player group((Owner of (Triggering unit))))
^Leaks player group: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
Remove all Do Nothing actions.

  • If - Conditions
    • (Item-type of (Item being manipulated)) Equal to Bash
    • And - All (Conditions) are true
      • Conditions
        • (Level of Bash (Buy) for (Triggering unit)) Greater than or equal to 1
        • (Level of Bash (Buy) for (Triggering unit)) Less than 3
->
  • If - Conditions
    • (Item-type of (Item being manipulated)) Equal to Bash
    • (Level of Bash (Buy) for (Triggering unit)) Greater than or equal to 1
    • (Level of Bash (Buy) for (Triggering unit)) Less than 3
 
Status
Not open for further replies.
Top