1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  4. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  5. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  6. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  7. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Help to improve this spell

Discussion in 'World Editor Help Zone' started by jonbon29, Aug 3, 2015.

  1. jonbon29

    jonbon29

    Joined:
    Aug 19, 2014
    Messages:
    1,096
    Resources:
    0
    Resources:
    0
    Hello guys I had this very simple triggered spell I made

    Weapon Slam
    • Weapon Slam
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to |cffff4500Weapon Slam|r
      • Actions
        • -------- ------------------------------------------------------------------------------------------------- --------
        • -------- Getting the Spell constants --------
        • -------- ------------------------------------------------------------------------------------------------- --------
        • Set Temp_Unit = (Triggering unit)
        • Set Temp_Target = (Target unit of ability being cast)
        • Set Temp_Stats = (Strength of Temp_Unit (Include bonuses))
        • Set Temp_Ability_Level = (Level of (Ability being cast) for Temp_Unit)
        • -------- ------------------------------------------------------------------------------------------------- --------
        • -------- Setting the Spell values --------
        • -------- ------------------------------------------------------------------------------------------------- --------
        • Set Temp_Base_Value = (50.00 x (Real(Temp_Ability_Level)))
        • Set Temp_Total_Value = (Temp_Base_Value + (0.50 x (Real(Temp_Stats))))
        • -------- ------------------------------------------------------------------------------------------------- --------
        • -------- Creating and setting the dummy unit --------
        • -------- ------------------------------------------------------------------------------------------------- --------
        • Unit - Cause Temp_Unit to damage Temp_Target, dealing Temp_Total_Value damage of attack type Normal and damage type Normal
        • -------- ------------------------------------------------------------------------------------------------- --------


    Its really simple right :ogre_hurrhurr: that is why I need some help from you guys to improve it.

    Things I want to add in this trigger is.....

    -When the hero successfully kills a unit by this ability, it will give him permanent + 1 strength. But if he kills a hero by this ability he will receive permanent + 2 strength instead.
     
  2. Shadow Fury

    Shadow Fury

    Joined:
    Nov 4, 2013
    Messages:
    1,630
    Resources:
    4
    Maps:
    3
    Template:
    1
    Resources:
    4
    Trigger the damage, don't do it through object editor so that we know when the damage dealt. After that, you use if/then/else to check that if the unit is dead and was a non-hero, then you add +1 strength to the caster. If the unit is the dead and it was a hero, then add +2 strength to the caster.
     
  3. Flux

    Flux

    Joined:
    Feb 6, 2014
    Messages:
    2,334
    Resources:
    28
    Maps:
    1
    Spells:
    19
    Tutorials:
    2
    JASS:
    6
    Resources:
    28
    He did trigger the damage

    @jonbon:
    I haven't tried, but can you try getting the damaged Unit's hp after the Unit Damage and see if it is the hp before or after the damage was done. I guessing it is before but I actually haven't tried it. If the hp is after, then Shadow Fury's suggestion will work.

    Another possible way is to create another unit with a unique unit type and instead of Temp_unit to damage Temp_target, make it Last Created Unit damage Temp_Target.
    Then create another trig with A unit dies event and if the killing unit is the unique unit-type unit, add str to your caster.
     
  4. Shadow Fury

    Shadow Fury

    Joined:
    Nov 4, 2013
    Messages:
    1,630
    Resources:
    4
    Maps:
    3
    Template:
    1
    Resources:
    4
    Lol I see now.
     
  5. jonbon29

    jonbon29

    Joined:
    Aug 19, 2014
    Messages:
    1,096
    Resources:
    0
    Resources:
    0
    Sorry Shadow Flux, I'm confuse :vw_wtf: What do you mean by ''but can you try getting the damaged Unit's hp after the Unit Damage and see if it is the hp before or after the damage was done.''


    Should I make another trigger for this? Or I'll include this one on my trigger that I posted?
     
  6. Shadow Fury

    Shadow Fury

    Joined:
    Nov 4, 2013
    Messages:
    1,630
    Resources:
    4
    Maps:
    3
    Template:
    1
    Resources:
    4
    Include it in this trigger and it is done.
     
  7. Flux

    Flux

    Joined:
    Feb 6, 2014
    Messages:
    2,334
    Resources:
    28
    Maps:
    1
    Spells:
    19
    Tutorials:
    2
    JASS:
    6
    Resources:
    28
    • Weapon Slam
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Weapon Slam
      • Actions
        • Set Temp_Unit = (Triggering unit)
        • Set Temp_Target = (Target unit of ability being cast)
        • Set Temp_Stats = (Strength of Temp_Unit (Include bonuses))
        • Set Temp_Ability_Level = (Level of Weapon Slam for Temp_Unit)
        • Set Temp_Base_Value = (50.00 x (Real(Temp_Ability_Level)))
        • Set Temp_Total_Value = (Temp_Base_Value + (0.50 x (Real(Temp_Stats))))
        • Unit - Cause Temp_Unit to damage Temp_Target, dealing Temp_Total_Value damage of attack type Normal and damage type Normal
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Life of Temp_Target) Less than 0.41
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Temp_Target is A Hero) Equal to True
              • Then - Actions
                • Hero - Modify Strength of Temp_Unit: Add 2
              • Else - Actions
                • Hero - Modify Strength of Temp_Unit: Add 1
          • Else - Actions
     
  8. jonbon29

    jonbon29

    Joined:
    Aug 19, 2014
    Messages:
    1,096
    Resources:
    0
    Resources:
    0
    Tnx for the help Shawdow guys!
     
  9. jonbon29

    jonbon29

    Joined:
    Aug 19, 2014
    Messages:
    1,096
    Resources:
    0
    Resources:
    0
    Hello guys I have another triggered ability and this time its passive, it activates when the hero uses his spells.

    Battle Born
    • Battle Born
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • Or - Any (Conditions) are true
          • Conditions
            • (Ability being cast) Equal to |cffff4500Warcry|r
            • (Ability being cast) Equal to |cffff4500Weapon Slam|r
      • Actions
        • -------- ------------------------------------------------------------------------------------------------- --------
        • -------- Getting the Spell constants --------
        • -------- ------------------------------------------------------------------------------------------------- --------
        • Set Temp_Unit = (Triggering unit)
        • Set Temp_Location = (Position of Temp_Unit)
        • Set TempPlayer = (Owner of Temp_Unit)
        • Set TempAbility = Battle Born (Dummy Ability)
        • -------- ------------------------------------------------------------------------------------------------- --------
        • -------- Creating and setting the dummy unit --------
        • -------- ------------------------------------------------------------------------------------------------- --------
        • Unit - Create 1 Dummy for TempPlayer at Temp_Location facing Default building facing degrees
        • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
        • Unit - Add TempAbility to (Last created unit)
        • Unit - Order (Last created unit) to Human Priest - Inner Fire Temp_Unit
        • -------- ------------------------------------------------------------------------------------------------- --------
        • -------- Clearing Leaks --------
        • -------- ------------------------------------------------------------------------------------------------- --------
        • Custom script: call RemoveLocation(udg_Temp_Location)


    My question is how can I make this passive ability to cooldown after the hero uses an ability which activate this passive ability?
     
  10. Arad MNK

    Arad MNK

    Joined:
    Dec 11, 2014
    Messages:
    1,889
    Resources:
    3
    Maps:
    2
    Spells:
    1
    Resources:
    3
    Requirement: Unit Indexer
    Use an Array Boolean in your spell trigger. After you cast it, set it true. After some time, Turn it to false.

    Easy ha?
     
  11. jonbon29

    jonbon29

    Joined:
    Aug 19, 2014
    Messages:
    1,096
    Resources:
    0
    Resources:
    0
    Hi Sir Arad MNK, I just putted Bribe's Unit Indexer in my map. However its my first time to use a library and I'm having troubles which trigger I should attach in my triggered spell.

    Bribe's Unit Indexer
    • Unit Indexer
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Custom script: call ExecuteFunc("InitializeUnitIndexer")
        • Custom script: endfunction
        • -------- --------
        • -------- This is the most important function - it provides an index for units as they enter the map --------
        • -------- --------
        • Custom script: function IndexUnit takes nothing returns boolean
        • Custom script: local integer pdex = udg_UDex
        • -------- --------
        • -------- You can use the boolean UnitIndexerEnabled to protect some of your undesirable units from being indexed --------
        • -------- - Example: --------
        • -------- -- Set UnitIndexerEnabled = False --------
        • -------- -- Unit - Create 1 Dummy for (Triggering player) at TempLoc facing 0.00 degrees --------
        • -------- -- Set UnitIndexerEnabled = True --------
        • -------- --------
        • -------- You can also customize the following block - if conditions are false the (Matching unit) won't be indexed. --------
        • -------- --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • UnitIndexerEnabled Equal to True
          • Then - Actions
            • -------- --------
            • -------- Generate a unique integer index for this unit --------
            • -------- --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • UDexRecycle Equal to 0
              • Then - Actions
                • Set UDex = (UDexGen + 1)
                • Set UDexGen = UDex
              • Else - Actions
                • Set UDex = UDexRecycle
                • Set UDexRecycle = UDexNext[UDex]
            • -------- --------
            • -------- Link index to unit, unit to index --------
            • -------- --------
            • Set UDexUnits[UDex] = (Matching unit)
            • Unit - Set the custom value of UDexUnits[UDex] to UDex
            • -------- --------
            • -------- Use a doubly-linked list to store all active indexes --------
            • -------- --------
            • Set UDexPrev[UDexNext[0]] = UDex
            • Set UDexNext[UDex] = UDexNext[0]
            • Set UDexNext[0] = UDex
            • -------- --------
            • -------- Fire index event for UDex --------
            • -------- --------
            • Set UnitIndexEvent = 0.00
            • Set UnitIndexEvent = 1.00
            • Set UnitIndexEvent = 0.00
            • Custom script: set udg_UDex = pdex
          • Else - Actions
        • Custom script: return false
        • Custom script: endfunction
        • -------- --------
        • -------- The next function is called each time a unit enters the map --------
        • -------- --------
        • Custom script: function IndexNewUnit takes nothing returns boolean
        • Custom script: local integer pdex = udg_UDex
        • Custom script: local integer ndex
        • -------- --------
        • -------- Recycle indices of units no longer in-play every (15) units created --------
        • -------- --------
        • Set UDexWasted = (UDexWasted + 1)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • UDexWasted Equal to 15
          • Then - Actions
            • Set UDexWasted = 0
            • Set UDex = UDexNext[0]
            • Custom script: loop
            • Custom script: exitwhen udg_UDex == 0
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Custom value of UDexUnits[UDex]) Equal to 0
              • Then - Actions
                • -------- --------
                • -------- Remove index from linked list --------
                • -------- --------
                • Custom script: set ndex = udg_UDexNext[udg_UDex]
                • Custom script: set udg_UDexNext[udg_UDexPrev[udg_UDex]] = ndex
                • Custom script: set udg_UDexPrev[ndex] = udg_UDexPrev[udg_UDex]
                • Set UDexPrev[UDex] = 0
                • -------- --------
                • -------- Fire deindex event for UDex --------
                • -------- --------
                • Set UnitIndexEvent = 2.00
                • Set UnitIndexEvent = 0.00
                • -------- --------
                • -------- Recycle the index for later use --------
                • -------- --------
                • Set UDexUnits[UDex] = No unit
                • Set UDexNext[UDex] = UDexRecycle
                • Set UDexRecycle = UDex
                • Custom script: set udg_UDex = ndex
              • Else - Actions
                • Set UDex = UDexNext[UDex]
            • Custom script: endloop
            • Custom script: set udg_UDex = pdex
          • Else - Actions
        • -------- --------
        • -------- Handle the entering unit (Matching unit) --------
        • -------- --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Custom value of (Matching unit)) Equal to 0
          • Then - Actions
            • Custom script: call IndexUnit()
          • Else - Actions
        • Custom script: return false
        • Custom script: endfunction
        • -------- --------
        • -------- The next function initializes the core of the system --------
        • -------- --------
        • Custom script: function InitializeUnitIndexer takes nothing returns nothing
        • Custom script: local integer i = 0
        • Custom script: local region re = CreateRegion()
        • Custom script: local rect r = GetWorldBounds()
        • Set UnitIndexerEnabled = True
        • Custom script: call RegionAddRect(re, r)
        • Custom script: call TriggerRegisterEnterRegion(CreateTrigger(), re, Filter(function IndexNewUnit))
        • Custom script: call RemoveRect(r)
        • Custom script: set re = null
        • Custom script: set r = null
        • Custom script: loop
        • Custom script: call GroupEnumUnitsOfPlayer(bj_lastCreatedGroup, Player(i), Filter(function IndexUnit))
        • Custom script: set i = i + 1
        • Custom script: exitwhen i == 16
        • Custom script: endloop
        • -------- --------
        • -------- This is the "Unit Indexer Initialized" event, use it instead of "Map Initialization" for best results --------
        • -------- --------
        • Set UnitIndexEvent = 3.00
        • Set UnitIndexEvent = 0.00


    It is really complicated just by looking at those triggers :ogre_hurrhurr:
     
  12. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,653
    Resources:
    3
    Spells:
    3
    Resources:
    3
    You just place that trigger inside your map.
    Then you have the Unit Indexer installed which means that you can use its features.

    Then you create a boolean array global variable.
    Inside the spell, you check if that boolean under the index of the custom value of the unit is equal to true. If so, you apply the effect.
    You also set that boolean to true.
    Then you would require a timer or just a timed wait and set the boolean to false again.
     
  13. Arad MNK

    Arad MNK

    Joined:
    Dec 11, 2014
    Messages:
    1,889
    Resources:
    3
    Maps:
    2
    Spells:
    1
    Resources:
    3
    Exactly what Wietlol Said.

    NOTE: You won't be Able to use Custom Value of units Anymore...
     
  14. jonbon29

    jonbon29

    Joined:
    Aug 19, 2014
    Messages:
    1,096
    Resources:
    0
    Resources:
    0
    I guess this would be pretty hard then, but I'll try. Thanks guys.
     
  15. Flux

    Flux

    Joined:
    Feb 6, 2014
    Messages:
    2,334
    Resources:
    28
    Maps:
    1
    Spells:
    19
    Tutorials:
    2
    JASS:
    6
    Resources:
    28
    Or if you don't want to use Unit Indexer, use Hashtable instead.
    Do you want the passive to show cooldown?
     
  16. jonbon29

    jonbon29

    Joined:
    Aug 19, 2014
    Messages:
    1,096
    Resources:
    0
    Resources:
    0
    Yes I do want the passive ability to show cooldown.
     
  17. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,653
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Xonok uses a way of the spell shield as a "Passive" ability that you can use to simulate a cooldown.
    It works pretty well.
     
  18. jonbon29

    jonbon29

    Joined:
    Aug 19, 2014
    Messages:
    1,096
    Resources:
    0
    Resources:
    0
    Does he uses Unit Indexer with that too?
     
  19. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,653
    Resources:
    3
    Spells:
    3
    Resources:
    3
    I dont know... he could have.
     
  20. Arad MNK

    Arad MNK

    Joined:
    Dec 11, 2014
    Messages:
    1,889
    Resources:
    3
    Maps:
    2
    Spells:
    1
    Resources:
    3
    Hashtables are slightly slower than Indexes, But Indexes have a 8192 Limit I Think.