| 07-29-2004, 11:41 AM | #1 |
Hello, I've searched for item respawning help but came up a lil short. There was a contest which dealt with it but the maps came up in Jass and I couldn't duplicate the item respawn system since I don't know jack about Jass... Anyways, what I have so far is: I have multiple places where hearts are stored. Hearts heal your hero when it's picked up and used instantly and goes bye-bye. Now, what I want to do is, have a new heart show up 30 seconds later if and ONLY if it's been used or destroyed. I don't want it piling up tons of hearts in one area. Here's my code so far, which doesn't work: Event: Unit - Unit uses an item. Condition: (Item-Type of (Item being manipulated)) Equal to Heart Action: Wait 30.00 seconds Item - Create Heart at (Position of (Item being manipulated)) I just can't seem to get it to work, could anyone give me a hand? Thanks. |
| 07-29-2004, 12:08 PM | #2 |
For some reason, the "Unit uses an item" triggers aren't too happy with humans in general. They mostly don't work. If you did the same thing using "Unit starts the effect of an ability" event and use the "Ability being cast = heart ability" condition, it should work fine. Thing is, with ths method you'll have the hearts created at wherever the player uses em and they can still stockpile them by using the hearts only in an area. The best method would be to assign each item to a variable. Then when an item is used, you'd run a for-loop to determine which heart it is and where it should respawn. If you need more specifics, just ask. |
| 07-29-2004, 07:41 PM | #3 |
Yes, could you give me some specifics on how I would go about getting the location of the heart and how I should set the variables since there may be 30+ hearts on the entire map. Thanks. |
| 07-29-2004, 10:35 PM | #4 |
I would strongly suggest using the triggers found in the map I created for the contest. They are perfectly suited for what you need. They are also rather complicated to achieve the full functionality that they do. It enumerates through all items present on the map during map init and then stores there position under gamecache and creates and stores a trigger and triggeraction for the item which fires upon its death it stores the trigger and action under a timer it creates for the item. Once the item dies, it waits 3 seconds (you can replace with whatever value you want) and then will create an item at the x and y specified.And then repeats the above paragraph process for the new item generated. It then launches the timer it stored under the item, destroys the trigger, the triggeraction and the expiring timer and finally clears the cache under the item. Maybe you won't be so hardcore about cleaning memory but since the only way to detect if an item died through being attacked is through a seperate trigger per item. Thus, its much better to simply rely on this proven system. You can simply add a filter to make it only run on heart items and make the time for whatever you want, |
| 07-30-2004, 01:02 AM | #5 |
weaaddar, I checked out your map before I posted. After careful review of your triggers. I still don't quit understand the JASS (plain text) code you've provided. Basically, I don't know where tell the code that I only want hearts to respawn since creeps will be dropping items and I'll probably be placing other items on the ground across the map. I noticed the call TriggerSleepAction(3.0) which I assume is the delay between respawns but thats about all I can get out of it. As for the item being destroyed I guess I can just give it more HP and if they want to waste time destroying it then thats their choice, it's not big deal at this point. If possible maybe you could PM me a quick visual or non-jass solution. Either way, thanks if you can help...anyone that is. |
| 07-30-2004, 06:23 PM | #6 |
Anyone have any insight on this problem? |
| 07-30-2004, 09:48 PM | #7 |
my code only iterates through items found on the map at map init. No other items. So if you would like to leave items on the ground you could just add them at a later point. (create at region X or whatever). The TriggerSleepAction(3.0) is correct in your case you want it to be 30 seconds. |
| 07-31-2004, 05:20 AM | #8 |
Cool that sounds good then. Thanks! |
