• 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] Spawning Items, Despawning Items, Unknown Problem.

Status
Not open for further replies.
Level 1
Joined
Mar 7, 2012
Messages
2
Hi, first time using this site and looked like a great place to find help for a very frustrating problem.

The goal of the trigger is to Randomly spawn an item with odds based upon the amount of that item you already have (stored in a variable) in comparison to the level of the unit killed that drops the item. With a maximum of 50% drop chance. For example, if you have 20 food, and you kill a level 18 unit that drops food, there would be a 1 in 3 chance that it would drop.

All of this works fine, but in setting up the rate like this i found if you just leave the items on the ground, your chances for the drop will remain high, thus you can kill a respawn location to your hearts content. My remedy was to Set each item to a Variable as it spawned, wait 5 seconds, then despawn it. So i set up the following Trigger.

attachment.php


I have looked over it several times and see nothing wrong with my logic, spawning just 1 item at a time works ok, but if you happen to get 2 drops withing 5 seconds, it skips all but the last one that dropped in that time period and only despawns the very last one. The two Quest events were put in place to track this. If killing 2 in five seconds, it will read, Setting last item to 1... Setting last item to 2... Removing item 2. It seems to change the varable in a trigger that is still in progress even though the variable changed is (Interger A).

Thanks for the help, I believe to have a solution but would require 30-40 minutes of tedious if/then/else tricks that the loop 1 through 20 should cover.
 

Attachments

  • warcraft 3 issue.jpg
    warcraft 3 issue.jpg
    166.1 KB · Views: 143
Level 37
Joined
Mar 6, 2006
Messages
9,243
The wait messes it up, you can't really use Integer A loop with a wait. If the integer is used by some other loop while the original loop is running, then the integer's will be incorrect.

Instead of the wait, quest display and item remove, run this kind of trigger:

  • Custom script: local integer i = bj_forLoopAIndex
  • Wait 5.00 seconds
  • Custom script: set udg_integer = i
  • *something here*
You need to create a variable calle integer in variable editor. The *something here part* could be your check if the item should be removed and the action to remove it.
 
Status
Not open for further replies.
Top