• 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.

[Trigger] Unequipped-Item Removal in Map

Status
Not open for further replies.
Level 30
Joined
Jul 31, 2010
Messages
5,259
Unequipped-Item Removal in Map [SOLVED]

Hello Everybody! :grin:

I was wondering if someone knows how to make a trigger by removing item/s which aren't equipped or not taken by a hero or heroes in the map.

It will first show a warning that says "Unequipped Items Removed in 5 seconds."

and after that it will begin removing items.

Note: I've seen this in alot of online role-playing games and none in any of the rpg game mods in warcraft 3, because i'm making an RPG which applies that method and its really cool!

if anyone knows the triggers please show it to me ASAP :thumbs_up:

thank you and i will good credit when approved!


Update on Monday, Dec 27, 2010: I'm closing my discussion about the item removal since I already solved the problem and hence, It was a success! I made it work! :grin:


as for Pharaoh, Dr.Boom, and Maker. I appreciate your help for making ways of how the triggers will work, because of that, I will add you guys in my map credits when I finish the map im making right now, thank you and help more people in the Hive! :thumbs_up:
 
Last edited:
You can do this:
  • Trigger
  • Events
    • Unit - A unit loses an item
  • Conditions
  • Actions
    • Game - Display for (All players) the text "Unequipped Items will be removed in 5 seconds."
    • Countdown Timer - Start Timer1 as a one shot-timer that will expire in 5.00 seconds
  • Trigger1
  • Events
    • Time - Timer1 expires
  • Conditions
  • Actions
    • Item - Pick every item in (Playable map area) and do (Actions)
      • Loop - Actions
        • Item - Remove (Picked item)
Not MUI, to fit your needs. ;)
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

I never did a "system" of item removing before, so I experiment a little and get this:
JASS:
/// Help by Dr. Boom
// You can configure the globals like you want but some notes:
// The ItemUserData is increased every MAX_DATE_INCREASE_TIME by 1. If the Data reaches MAX_DATA the item is removed
// The Game massage contains: GAME_MASSAGE_PART_1 + The Name Of The Item + GAME_MASSAGE_PART_2 and is shown for GAME_MASSAGE_DURATION
library ItemRemove initializer Init

    globals
        private constant integer MAX_DATA = 50
        private constant real MAX_DATA_INCREASE_TIME = 0.10
        
        private constant string GAME_MASSAGE_PART_1 = "Item: "
        private constant string GAME_MASSAGE_PART_2 = " will disapear after 5 seconds"
        
        private constant real GAME_MASSAGE_DURATION = 3.
    endglobals
    
    
    function ItemRemoveActions takes nothing returns nothing
        local item enum = GetEnumItem()
        local integer i = 0
        
        if GetItemUserData(enum) == 0 and IsItemOwned(enum) == false then
            loop
                exitwhen i == 15
                call DisplayTimedTextToPlayer(Player(i),0.,0.,GAME_MASSAGE_DURATION,GAME_MASSAGE_PART_1 + GetItemName(enum) + GAME_MASSAGE_PART_2)
                set i = i + 1
            endloop
        call SetItemUserData(enum,1)
        elseif GetItemUserData(enum) >= 1 and GetItemUserData(enum) <= MAX_DATA - 1 then
            call SetItemUserData(enum,GetItemUserData(enum) + 1)
        elseif GetItemUserData(enum) == MAX_DATA then
            call RemoveItem(enum)
        endif
        set enum = null
    endfunction
    
    function ItemRemove takes nothing returns nothing
        call EnumItemsInRect(bj_mapInitialPlayableArea,null,function ItemRemoveActions)
    endfunction
    
    function ItemPickUp takes nothing returns nothing
        call SetItemUserData(GetManipulatedItem(),0)
    endfunction

    function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local trigger t2 = CreateTrigger()
        local integer i = 0
        
        call TriggerRegisterTimerEvent(t,MAX_DATA_INCREASE_TIME,true)
        call TriggerAddAction(t,function ItemRemove)
        loop
            exitwhen i == 15
            call TriggerRegisterPlayerUnitEvent(t2,Player(i),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
            set i = i + 1
        endloop
        call TriggerAddAction(t2,function ItemPickUp)
        set t = null
        set t2 = null
    endfunction
endlibrary

Ok this is an edit, to fixed those things, what Maker said (THANKS!) and fixed a bug. Now I make it much more configurable, read the small info in the trigger for more informations (green marked part)

Greetings and Peace
Dr. Boom
 
Last edited:
Level 30
Joined
Jul 31, 2010
Messages
5,259
I Tried your Trigger!

You can do this:
  • Trigger
  • Events
    • Unit - A unit loses an item
  • Conditions
  • Actions
    • Game - Display for (All players) the text "Unequipped Items will be removed in 5 seconds."
    • Countdown Timer - Start Timer1 as a one shot-timer that will expire in 5.00 seconds
  • Trigger1
  • Events
    • Time - Timer1 expires
  • Conditions
  • Actions
    • Item - Pick every item in (Playable map area) and do (Actions)
      • Loop - Actions
        • Item - Remove (Picked item)
Not MUI, to fit your needs. ;)

hey i tried your trigger but it didn't work, when i placed alot of items in the map it didn't get removed and when a hero drops an item the text message pops out, can you make a map example for this?:wgrin:

thank you!
 
Level 30
Joined
Jul 31, 2010
Messages
5,259
Hello!

Moin moin =)

I never did a "system" of item removing before, so I experiment a little and get this:
JASS:
/// Help by Dr. Boom
// You can configure the globals like you want but some notes:
// The ItemUserData is increased every MAX_DATE_INCREASE_TIME by 1. If the Data reaches MAX_DATA the item is removed
// The Game massage contains: GAME_MASSAGE_PART_1 + The Name Of The Item + GAME_MASSAGE_PART_2 and is shown for GAME_MASSAGE_DURATION
library ItemRemove initializer Init

    globals
        private constant integer MAX_DATA = 50
        private constant real MAX_DATA_INCREASE_TIME = 0.10
        
        private constant string GAME_MASSAGE_PART_1 = "Item: "
        private constant string GAME_MASSAGE_PART_2 = " will disapear after 5 seconds"
        
        private constant real GAME_MASSAGE_DURATION = 3.
    endglobals
    
    
    function ItemRemoveActions takes nothing returns nothing
        local item enum = GetEnumItem()
        local integer i = 0
        
        if GetItemUserData(enum) == 0 and IsItemOwned(enum) == false then
            loop
                exitwhen i == 15
                call DisplayTimedTextToPlayer(Player(i),0.,0.,GAME_MASSAGE_DURATION,GAME_MASSAGE_PART_1 + GetItemName(enum) + GAME_MASSAGE_PART_2)
                set i = i + 1
            endloop
        call SetItemUserData(enum,1)
        elseif GetItemUserData(enum) >= 1 and GetItemUserData(enum) <= MAX_DATA - 1 then
            call SetItemUserData(enum,GetItemUserData(enum) + 1)
        elseif GetItemUserData(enum) == MAX_DATA then
            call RemoveItem(enum)
        endif
        set enum = null
    endfunction
    
    function ItemRemove takes nothing returns nothing
        call EnumItemsInRect(bj_mapInitialPlayableArea,null,function ItemRemoveActions)
    endfunction
    
    function ItemPickUp takes nothing returns nothing
        call SetItemUserData(GetManipulatedItem(),0)
    endfunction

    function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local trigger t2 = CreateTrigger()
        local integer i = 0
        
        call TriggerRegisterTimerEvent(t,MAX_DATA_INCREASE_TIME,true)
        call TriggerAddAction(t,function ItemRemove)
        loop
            exitwhen i == 15
            call TriggerRegisterPlayerUnitEvent(t2,Player(i),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
            set i = i + 1
        endloop
        call TriggerAddAction(t2,function ItemPickUp)
        set t = null
        set t2 = null
    endfunction
endlibrary

Ok this is an edit, to fixed those things, what Maker said (THANKS!) and fixed a bug. Now I make it much more configurable, read the small info in the trigger for more informations (green marked part)

Greetings and Peace
Dr. Boom

hmm, i'm still not good at Jass cause i'm soo0 lazy! hahaa!:xxd:

just kidding! thanks for the help but i only need a trigger-based formula for this if you can make one? but don't worry i'll try the vjass version you made.

thanks again!
 
Status
Not open for further replies.
Top