• 🏆 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!

Item with Divine Shield

Status
Not open for further replies.
Level 7
Joined
Mar 24, 2008
Messages
184
I made a permanent item with the Item Divine shield ability (plus other two passive abilities), but i have a problem...the first time it's used it works, but once the cooldown is ready it won't work anymore. I've tried to use the normal divine shield (the non-item version), but i have the same problem
How do i make it recastable?
 
Level 7
Joined
Mar 24, 2008
Messages
184
i don't see why, also it's a map i'm making for a spell...but here's a sample map with the problem...

Well, i've discovered that if you have two items with both the item divine shield ability then you'll be able to cast it once for each item.

I changed the cooldown group to the same of the Item Divine shield, but nothing
 

Attachments

  • divineshielditem.w3x
    11.7 KB · Views: 52
Level 8
Joined
Mar 12, 2008
Messages
437
I stumbled on a similar problem once and I solved it, don't remember how though. I'll try to fix it now.

I didn't find any solution, but it appears that you can reuse the item after dropping it. So you could make a trigger that runs when that item is used, then drops the item and gives it to the unit again.
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
You have to remove divine shield item after cast and then add a new one. (at least I did it in my map and it works 100%)

  • DS
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to YourItem
    • Actions
      • -------- We are using Unit uses Item event --------
      • -------- Set conditions according to your item --------
      • -------- ---------------------------------------- --------
      • -------- The next thing we should do is removing existing item --------
      • -------- Before doing so, it would be good to store its type in a variable --------
      • -------- Variable is item-type global --------
      • Set item = (Item-type of (Item being manipulated))
      • -------- ---------------------------------------- --------
      • -------- Now its safe to remove our item --------
      • Item - Remove (Item being manipulated)
      • -------- ---------------------------------------- --------
      • -------- When the item is removed we must replace it with new one --------
      • Hero - Create item and give it to (Triggering unit)
      • -------- Item will have cooldown so you don't have to worry about it --------
      • -------- Just be sure to put Divine Shield ability as items first ability in OE --------
      • -------- ... And set the right cooldown group --------
      • -------- Using item-type variable will let you make multiple item event in same trigger --------
 
Level 7
Joined
Mar 24, 2008
Messages
184
i tried different group cooldowns but nothing, also the active ability is already on top...on the map i attached to my previous post it's the only ability (notice that the first time i use the item it works, after that then it doesn't)

I see your trigger will obviously work, but i'm watiting to see if there's some other solution that doens't require triggers. If there isn't then i'll use that

EDIT: Also dropping and re-picking it works, that's weird...Should it be because of divine shield requires the undivineshield order to stop?
 
Level 7
Joined
Mar 24, 2008
Messages
184
This item is for a test map for my spells (gives you 20000 hp and mp regen and can turn you invulnerable if used) so i would like to not use a trigger for that :p though i think i'll just use a drop/pick trigger if there isn't any other solution

I've tried with Big Bad Voodoo but it's hardcoded so it won't affect yourself

that's how i solved it (if someone in a future will need something like that), though i rathered not using a trigger:

JASS:
scope DivineShieldItem initializer InitTrig 
    function Conditions takes nothing returns boolean
        return GetItemTypeId(GetManipulatedItem()) == 'I000'
    endfunction

    function GetInventoryIndexOfItem takes unit u, item it returns integer
        local integer i=0
        loop
            if (UnitItemInSlot(u, i) != null) and (UnitItemInSlot(u, i) == it) then
                return i
            endif
            set i=i+1
            exitwhen i>=bj_MAX_INVENTORY
        endloop
        return 0
    endfunction

    function Actions takes nothing returns nothing
        local integer i=GetInventoryIndexOfItem(GetTriggerUnit(), GetManipulatedItem())
        call UnitRemoveItem(GetTriggerUnit(), GetManipulatedItem())
        call UnitAddItem(GetTriggerUnit(), GetManipulatedItem())
        call UnitDropItemSlot(GetTriggerUnit(), GetManipulatedItem(), i)
    endfunction

    //===========================================================================
    function InitTrig takes nothing returns nothing
        local trigger DivineShieldItem=CreateTrigger()
        local integer i=0
        loop
            exitwhen i==16
            call TriggerRegisterPlayerUnitEvent(DivineShieldItem,Player(i),EVENT_PLAYER_UNIT_USE_ITEM,ANTILEAKFILTER)
            set i = i + 1
        endloop
        call TriggerAddCondition(DivineShieldItem, Condition(function Conditions))
        call TriggerAddAction(DivineShieldItem, function Actions)
        set DivineShieldItem=null
    endfunction
endscope
 
Last edited:
Status
Not open for further replies.
Top