HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

timed life on items?

04-02-2007, 06:15 AM#1
ZiegSlavric
trying to get items i have created from triggers to be removed after a set amount of time on ground. tried adding the timed life after the item is created blah blah and got nothing.

heres the trigger i have so far.

Events
Unit - A unit owned by Neutral Passive Dies
Actions
Item - Create (Random level 10 item-type) at (Position of (Dying unit))
Item - Set life of (Last created item) to 10.00
Wait 15.00 seconds
Unit - Create 1 (Unit-type of (Dying unit)) for Neutral Passive at (Position of (Dying unit)) facing (Facing of (Dying unit)) degrees

problem is that when the item is created it stays there and it seems the trigger that gives it timed life isnt working. any help would be nice.
04-02-2007, 10:32 AM#2
ZiegSlavric
anyone up to helping me?
04-02-2007, 11:22 AM#3
blu_da_noob
It's been four hours. Don't double post and have patience.

That function doesn't give an item 'timed life'. Items have life just like units have life. So all you're doing is giving the item 10 life. You could wait 10 seconds and then remove the item if you feel so inclined. (Might be useful if items could have hp regen xD)
04-02-2007, 12:21 PM#4
BoNe
So you want the item to be removed after 15 seconds? Well if so make a variable called Item_ItemGettingRemoved and do this trigger:

Events
Unit - A unit owned by Neutral Passive Dies

Actions
Item - Create (Random level 10 item-type) at (Position of (Dying unit))
Set Item_ItemGettingRemoved = (Last created item)
Wait 15.00 seconds
Item - Remove Item_ItemGettingRemoved
Unit - Create 1 (Unit-type of (Dying unit)) for Neutral Passive at (Position of

The problem with this way is if you kill another unit before 15 seconds is over it doesn't work. I'm not sure if there's a simpler way but you could make 15 variables Item_ItemGettingRemoved1, Item_ItemGettingRemoved2 etc and have 15 different triggers. The triggers would look like this:

Events
Unit - A unit owned by Neutral Passive Dies

Actions
Item - Create (Random level 10 item-type) at (Position of (Dying unit))
Set Item_ItemGettingRemoved1 = (Last created item)
Trigger - Turn of (This trigger)
Wait 15.00 seconds
Trigger - Turn on (This trigger)
Item - Remove Item_ItemGettingRemoved1
Unit - Create 1 (Unit-type of (Dying unit)) for Neutral Passive at (Position of

Events
Unit - A unit owned by Neutral Passive Dies

Actions
Item - Create (Random level 10 item-type) at (Position of (Dying unit))
Set Item_ItemGettingRemoved2 = (Last created item)
Trigger - Turn of (This trigger)
Wait 15.00 seconds
Trigger - Turn on (This trigger)
Item - Remove Item_ItemGettingRemoved2
Unit - Create 1 (Unit-type of (Dying unit)) for Neutral Passive at (Position of

and keep doing that untill you have 15 different triggers.

Hope this has helped.
04-02-2007, 07:17 PM#5
MaD[Lion]
Using global vars tat way makes things complicated.

Use local vars is better. But if u dont knwo jass then u need to find a more logical way
04-02-2007, 09:28 PM#6
ZiegSlavric
right now i have it removing a random item on the map evey 15 seconds and set the buildings path req to nothing so it respawns on top of the item. it works for now but i would like a better way of doing it.
04-02-2007, 10:17 PM#7
MaD[Lion]
I have a method but it wont work if tere are many items in 1 spot. Gui is really hard
04-03-2007, 08:10 AM#8
akolyt0r
he has not sayed, that he doesnt want have any jass ...has he ??
so ...
Trigger:
ItemKilla
Collapse Ereignisse
Einheit - A unit owned by Neutral passiv Stirbt
Bedingungen
Collapse Aktionen
Custom script: local item i
Set TempPoint = (Position of (Dying unit))
Gegenstand - Create (Random level 10 item-type) at TempPoint
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: set i=GetLastCreatedItem()
Wait 15.00 seconds
Custom script: call RemoveItem(i)
Custom script: set i=null
04-04-2007, 02:10 AM#9
MaD[Lion]
lol ure evil one :D
04-04-2007, 03:00 AM#10
Ammorth
I would recommend at least a 30 second time to pick-up items, or only delete them if a player is not within a certain distance. Some people (myself included) take a while to pick-up item, as we have to read and compare the numerous descriptions. And let me tell you, its a pain when you are deciding what item to pick up when suddenly, it disappears.