• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Saving Slot of item...

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
579
Hi everyone!
I created an Item "Armlet of Mordiggian" like in d.o.t.a... I made a trigger that switches 2 different items when this item is used, but tell me please how to save the slot number where this item was? Because it always jumps to the first free slot.... :ogre_frown:
Triggers:
Mordiggian
  • Events
  • Unit - A unit Begins casting the ability
  • Conditions
  • (Ability being cast) Equal to Unholy Strength to
  • Actions
  • Set Mordiggian_Caster_1 = (Casting unit)
  • Item - Remove (Item carried by Mordiggian_Caster_1 of type Armlet of Mordiggian)
  • Hero - Create Armlet Of Mordiggian and give it to Mordiggian_Caster_1
Mordiggian back
  • Events
  • Unit - A unit Begins casting the ability
  • Conditions
  • (Ability being cast) Equal to Unholy Strength from
  • Actions
  • Set Mordiggian_Caster_2 = (Casting unit)
  • Item - Remove (Item carried by Mordiggian_Caster_2 of type Armlet Of Mordiggian)
  • Hero - Create Armlet of Mordiggian and give it to Mordiggian_Caster_2
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Hi everyone!
I created an Item "Armlet of Mordiggian" like in d.o.t.a... I made a trigger that switches 2 different items when this item is used, but tell me please how to save the slot number where this item was? Because it always jumps to the first free slot.... :ogre_frown:
Triggers:
Mordiggian
  • Events
  • Unit - A unit Begins casting the ability
  • Conditions
  • (Ability being cast) Equal to Unholy Strength to
  • Actions
  • Set Mordiggian_Caster_1 = (Casting unit)
  • Item - Remove (Item carried by Mordiggian_Caster_1 of type Armlet of Mordiggian)
  • Hero - Create Armlet Of Mordiggian and give it to Mordiggian_Caster_1
Mordiggian back
  • Events
  • Unit - A unit Begins casting the ability
  • Conditions
  • (Ability being cast) Equal to Unholy Strength from
  • Actions
  • Set Mordiggian_Caster_2 = (Casting unit)
  • Item - Remove (Item carried by Mordiggian_Caster_2 of type Armlet Of Mordiggian)
  • Hero - Create Armlet of Mordiggian and give it to Mordiggian_Caster_2

add 6 items, remove the item, add the new item, remove the 6 items
 
Level 10
Joined
Mar 17, 2012
Messages
579
for each integer a from 1 to 6 do action
loop
if hero has item in slot [Integer A] then
set variable = Integer A

then remove the item and add the item to the specific slot

Can't find "add the item to the specific slot" does such a field exist??? :ogre_icwydt:
Could you please make some example-map for me? (bonuses are not important, just for me to see how it works)
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
@gorillabull, that is pretty good, but you could use Skip remaining actions like this:


  • Untitled Trigger 086
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Claws of Attack +15
            • Then - Actions
              • Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
              • Custom script: call UnitAddItemToSlotById(GetTriggerUnit(), 'ratc', bj_forLoopAIndex-1)
              • Skip remaining actions
            • Else - Actions
  • Untitled Trigger 086 Copy
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Avatar
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Claws of Attack +12
            • Then - Actions
              • Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
              • Custom script: call UnitAddItemToSlotById(GetTriggerUnit(), 'ratf', bj_forLoopAIndex-1)
              • Skip remaining actions
            • Else - Actions

ratc and ratf are item raw codes, check them by clicking Ctrl + D in object editor. ratc = Claws +12 and ratf = Claws +15.
 
Level 10
Joined
Mar 17, 2012
Messages
579
@gorillabull, that is pretty good, but you could use Skip remaining actions like this:


  • Untitled Trigger 086
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Claws of Attack +15
            • Then - Actions
              • Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
              • Custom script: call UnitAddItemToSlotById(GetTriggerUnit(), 'ratc', bj_forLoopAIndex-1)
              • Skip remaining actions
            • Else - Actions
  • Untitled Trigger 086 Copy
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Avatar
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Claws of Attack +12
            • Then - Actions
              • Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
              • Custom script: call UnitAddItemToSlotById(GetTriggerUnit(), 'ratf', bj_forLoopAIndex-1)
              • Skip remaining actions
            • Else - Actions

ratc and ratf are item raw codes, check them by clicking Ctrl + D in object editor. ratc = Claws +12 and ratf = Claws +15.

Sometimes I'm so pity that I don't know jass... :ogre_rage:
Good Job! Thanks! +
 
Level 17
Joined
Jul 17, 2011
Messages
1,864
this complicates things quite a bit because you are removing the item, you are also removing its cd instance, you cant make the unit drop the item because the armlet has no duration and the internal cd might expire while you are using it only way i see it working is get the cooldown item, use it to make it cooldown. this will replace it then remove the replaced item and add the original item which you initially replaced which is now on cd because you just used it. this had to be done after casting the first spell and ull need some extra code to detect if the item is already used and replaced to be on cd
use a boolean
 
Level 10
Joined
Mar 17, 2012
Messages
579
this complicates things quite a bit because you are removing the item, you are also removing its cd instance, you cant make the unit drop the item because the armlet has no duration and the internal cd might expire while you are using it only way i see it working is get the cooldown item, use it to make it cooldown. this will replace it then remove the replaced item and add the original item which you initially replaced which is now on cd because you just used it. this had to be done after casting the first spell and ull need some extra code to detect if the item is already used and replaced to be on cd
use a boolean

Doesn't seem like it will work... :ogre_icwydt: Interesting how Ice Frog made it in dota... :vw_wtf:
 
Level 10
Joined
Mar 17, 2012
Messages
579
Can't u make an an ability based on berserk and use a dummy unit to cast it on the unit when the item is removed. Just set the cool down of the ability to 5 seconds.

There is no buff...
1 - berserk is a self buff
2 - there is no buffs, Item gives some bonuses
3 - i already have the cooldown, but it doesn't start working and changes an item...

Is there any opotunity to set ability cooldown when it is given to me?
 
Status
Not open for further replies.
Top