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!
I was wondering if its possible (without JASS) to make a set unit-type drop a specific item-type based on percentage, like, for example, the unit has a 30% chance to drop a "Trollslayer Sword", 50% chance to drop a "Steel Sword", 20% chanc to drop a "Destroyer Sword." And also, would i have to add up to 100% or, could they drop multiple items with each item having a set %age (EX: Trollslayer 70%, Steel Sword 90%, Destroyer Sword 20%), where the other left over percent would be dropping nothing?
Sorry if its confusing, can't think of any other way to describe it though. Basically, can you make units drop weapons based on a percentage of weapon drops, and if you can, how?
There is a relatively easy GUI way to do it. I'll give example from my map
This trigger shows a complete way for multiple item drops. It is the actual trigger from my map (I'll replace the names with others so it makes more sense. Look for ALL CAPS)
Events
Unit - A unit Dies
Conditions
Actions
Set LOCATION = (Position of (Dying unit)) //SET LOCATION HERE
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Unit-type of (Triggering unit)) Equal to UNIT 1
(Unit-type of (Triggering unit)) Equal to UNIT 2
(Unit-type of (Triggering unit)) Equal to UNIT 3
//DESTROY MEMORY LEAK
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 100) Less than or equal to 10
Then - Actions
Item - Create ITEM 1 at LOCATION //You can add more items to this by simply copy pasting above trigger and changing for items you want dropped
Else - Actions
//If chance didnt proc it repeats for next item
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 100) Less than or equal to 8
Then - Actions
Item - Create ITEM 2 at LOCATION
//DESTROY MEMORY LEAK
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
//You hopefully get the picture
1. You can continue this cycle as long as you want. Putting multiple items in one "then" section will make both spawn at the location
2. Make sure to remove memory leaks for whatever location you use. Set the location in the trigger where you see this //SET LOCATION HERE and set the clearer here //DESTROY MEMORY LEAK . Destroy memory leak by typing in custom script "Call RemoveLocation (udg_your_variable)" without the quotation marks.
3. If you want this trigger to be able to run multiple times in one death (get the effects from the first if/then/else and be able to get the effects of any other if/then/else at the same time), simply copy paste the trigger and change any data.
Umm, sorry but I've never done a trigger like this before - so i'm a little confused.
Wouldn't the Position of dying unit be the location? So what do I put in for the //SET LOCATION thing, and hwo do I destroy it in the DESTROY MEMORY LEAKS part?
By setting the location in a variable (type of variable is "point", and it is NOT an array), it allows you to delete it by using custom script, or a small snippet of JASS, to destroy the memory leak. And the reason the item is spawned at the variable is because the variable is THE EXACT SAME PLACE AS THE POSITION OF THE DYING UNIT BECAUSE YOU SET IT TO BE THE EXACT SAME PLACE
Memory Leaks are saved data that doesn't get deleted automatically when a trigger runs. For example, when you take the position of dying unit (a point), and you use it without using a variable and custom script to destroy it, you "leak" a point. This means your game will have to keep track of the point for the entire duration of the match, making it laggier and increasing chance of disconnect. Instead of letting this happen, we use a variable to store the position and then use custom script AFTER (do not EVER put before or else it erases the variable) the job is done to clear the data from the wc3 engine.
Here is an example using actual variable names
Events
Unit - A unit Dies
Conditions
Actions
Set Temp_point = (Position of (Triggering Unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Unit-type of (Triggering unit)) Equal to Mummy
(Unit-type of (Triggering unit)) Equal to Villager Zombie
(Unit-type of (Triggering unit)) Equal to Zombie
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 100) Less than or equal to 10
In this example, when any of the three unit types die, it has a chance (1/10) to create an item called health +20 at temp point. Notice that at the START of the variable temp point was set to the position of the dying unit. After temp point was used in a function and was not needed further, I removed it by typing "call RemoveLocation(udg_Temp_point)", which basically means destroy the location Temp_point from warcraft 3's memory. As a side note, we use triggering unit in the variable because it is faster and works more efficiently (or so I'm told).
If you still don't understand how this functions, and how to use variables and custom script to remove memory leaks, just post in another comment. To gain a complete understanding of what causes memory leaks, and which things (groups, points, , special effects) can cause memory leaks, and more importantly, how to fix them, try looking up a tutorial on the subject. I'm sure that the Hive has plenty.
EDIT: If you post your triggers all nice and neat inside hidden tabs I'm sure some people will help you with the specifics of it, but make sure to post in the right area (triggers and script section)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.