• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Chance on items dropping

Status
Not open for further replies.
Level 3
Joined
Jul 18, 2010
Messages
35
Here's the scenario:

The map is filled with tons of bandits, all sorts of different bandits; some that are ranged, some melee, and some spellcasters. What I'm trying to do is set it so theres a very small chance that they'll ALL drop [Item A].

Also, they need to be able to respawn and continue to have the chance to drop [Item A]. How can I do this?
 
  • TRIG
  • Events
    • Unit - A unit dies
  • Conditions
  • Actions
    • If (All conditios are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Unit-type of (Triggering unit)) Equal to Bandit (Melee)
        • (Unit-type of (Triggering unit)) Equal to Bandit (Ranged)
        • (Unit-type of (Triggering unit)) Equal to Bandit (Spellcaster)
      • Then - Actions
        • If (All conditions) then do (Actions) else do (Actions)
          • If - Conditions
            • (Random integer number between 1 and 100) Less than or Equal to 10
          • Then - Actions
            • Set Point1 = (Position of (Triggering unit))
            • Item - Create Item at Point1
            • Custom script: call RemoveLocation (udg_Point1)
 
Level 3
Joined
Jul 18, 2010
Messages
35
  • TRIG
  • Events
    • Unit - A unit dies
  • Conditions
  • Actions
    • If (All conditios are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Unit-type of (Triggering unit)) Equal to Bandit (Melee)
        • (Unit-type of (Triggering unit)) Equal to Bandit (Ranged)
        • (Unit-type of (Triggering unit)) Equal to Bandit (Spellcaster)
      • Then - Actions
        • If (All conditions) then do (Actions) else do (Actions)
          • If - Conditions
            • (Random integer number between 1 and 100) Less than or Equal to 10
          • Then - Actions
            • Set Point1 = (Position of (Triggering unit))
            • Item - Create Item at Point1
            • Custom script: call RemoveLocation (udg_Point1)

Thank you thank you! Quick question though... How do you use custom scripts? Where do you get the information to execute them properly?

EDIT: And I'm not sure I understand how to use integers...

EDIT2: Not working...
 
Last edited:
  • (Random integer number between 1 and 100) Less than or Equal to 10
This is the chance. It means that item will be dropped with 10% chance. If you want to increase/decrease the probability, just alter the 10 value.

Custom scripts are a way to unlock certain features of Jass and implement them within the GUI. This particular script removes the leak, created by the location, that addresses memory.
 
Level 3
Joined
Jul 18, 2010
Messages
35
  • (Random integer number between 1 and 100) Less than or Equal to 10
This is the chance. It means that item will be dropped with 10% chance. If you want to increase/decrease the probability, just alter the 10 value.

Custom scripts are a way to unlock certain features of Jass and implement them within the GUI. This particular script removes the leak, created by the location, that addresses memory.

Easy enough to grasp, the problem now is its not working at all. The variable I'm using is "Point" that is the right one, yes?
 
Level 3
Joined
Jul 18, 2010
Messages
35
Fixed it. "If (All conditios are true) then do (Actions) else do (Actions)"

That right there was messing it up, it has to be an "OR" condition. Thanks for laying out the formula and making me feel smart by fixing a small mistake ;)
 
Status
Not open for further replies.
Top