• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Couple Questions

Status
Not open for further replies.
Level 12
Joined
May 20, 2009
Messages
822
#1: Is there some kind of pip system around? The idea looks something like this:

KFEHDEO.png


The green dots filling up the empty/transparent dots. Should be able to manually control when the pips are changed, something like

  • ... stuff ...
  • Unit Group - Pick every unit in (PipUnits) and do (Actions)
    • Loop - Actions
      • If Triggering Unit is equal to (Picked Unit) Then
        • Set Pip[int] = Pip[int] + 1
        • Actions
  • ... stuff ...
#2: Is this a good way to do random chance?

  • Set RandomChance = Random number between 1 and 100.
  • Set Chance = 70
    • For each (Integer Int[0]) from 1 to Chance, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Int[0] = RandomChance Then
          • Then - Actions
            • Actions
          • Else - Actions
            • Chance failed stuff...
 
To #2
No it isn't; you do upto 70 Checks, but only need 1.
Simple Random can be done that way:
  • Set Random = (Random integer number between 1 and 100)
  • Set Chance = 70
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Random Smaller Equal Chance
    • Then - Actions
      • -------- Effect Appears --------
    • Else - Actions
      • -------- Failed. --------
Weighted Random;
Is a more controlled Random, where you have multiple Options each having its own Chance to appear but only 1 Effect appears each execution.
Has a nice usage in Item Drop etc.;
In this Example we Create Footmen; Highest Chance is 1 Footmen with 4/8; 2 Footmen is 2/8; None Footmen is 1/8 and 3 Footmen is 1/8: 4+2+1+1=8.
PS: The Possible Options should be outsourced into an Init Trigger in the Real project.
  • Set Random = (Random integer number between 0 and 7)
  • Set Chances[0] = 1
  • Set Chances[1] = 1
  • Set Chances[2] = 1
  • Set Chances[3] = 1
  • Set Chances[4] = 2
  • Set Chances[5] = 2
  • Set Chances[6] = 3
  • Set Chances[7] = 0
  • Set Loc = (Center of (Playable map area))
  • Einheit - Create Chances[Random] Footmen for Player 1 (Rot) at Loc facing 90 degrees
  • Custom script: call RemoveLocation(udg_Loc)
If you use Jass or Custom Script you could use Item Pool/Unit Pool for Drops/Spawn to achive weight Random.
 
Last edited:
Status
Not open for further replies.
Top