• 🏆 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!

[Trigger] New mui systems branched from cs

Status
Not open for further replies.
Level 10
Joined
Sep 21, 2007
Messages
517
There is an idea that i have not tested yet... but as we all know: custom value can make something MUI, to the limit of 8192 units. Now iv just returned to mapmaking and realized that my custom value MUI way can be branched into making other MUI Arrays to satisfy more than one value, multiple MUI arrays for each and every unit by simply multiplying the custom value itself by a specified number after adjusting the custom value of the units in the map. (this way should be used for storing, indexing is to be used for spells)
This should look like this:
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set UnitMap = (Units in (Playable map area))
      • For each (Integer A) from 1 to (Number of units in UnitMap), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Integer_ID Greater than or equal to 8192
            • Then - Actions
            • Else - Actions
              • Set Integer_ID = (Integer_ID + 1)
              • Unit - Set the custom value of (Picked unit) to Integer_ID
      • Custom script: call DestroyGroup(udg_UnitMap)
Now that the custom values are set, we can multiply different arrays by the custom value of a unit to achieve desired information:
  • EXAMPLE
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A ground unit) Equal to True
    • Actions
      • Set groundunit[(Custom value of (Triggering unit))] = (dead + (String(Integer_ID)))
      • Set groundunit[((Custom value of (Triggering unit)) x 2)] = (dead2 + (String((Integer_ID)))
      • Set customvalueofdeadunit = (Custom value of (Triggering unit))
      • Trigger - Run regainingValue <gen> (checking conditions)


[for example over here i attached 2 strings to a ground unit which dies, one by normal custom value]

Now this information can be regained by simply using the custom value times the specified number itself:
  • regainingValue
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) the text: groundunit[customvalueofdeadunit]
      • Game - Display to (All players) the text: groundunit[(customvalueofdeadunit x 2)]
PLEASE NOTE THAT I DID MANY UNNEEDED PROCESSES IN THIS EXAMPLE ONLY TO SHOW YOU HOW THE "SYSTEM" WORKS, BUT IT CAN BE USED MUCH MORE EFFICIENTLY IN STORING VALUES AND REGAINING THE VALUES. IF SOMETHING WAS STORED AT THE BEGINNING, THEN IT CAN BE REGAINED BY ONLY MULTIPLYING BY THE SPECIFIED NUMBER OR EVEN NUMBERS.

Now this idea is really simple, yet it has so much potential... the only thing i dont know is the maximum number an array can store which would set the limits of this "system", unless of course there is a way to set reals in arrays indexes, which would be completely awesome :p

Hope it helped, and many additions would hopefully be made by our dear hive community xD
 
Level 9
Joined
Nov 28, 2008
Messages
704
I believe this is called vJass structs do all of this, but much more organisedly and cleaner looking (even if they compile to the same thing).

Good thing to have found out on your own, but everyone has been using this for a while.
 
Level 12
Joined
Mar 26, 2005
Messages
790
Well, I do not know about this. It will work ofc but better is this solution


E: unit- starts the effect of an ability
C: ability=XY
A: if X=8192, then set X=0
set casting unit=Caster(X)
set target unit=Target(X)
set X=X+1
wait 5 sec
if Y=8192, then set Y=0
Do something with Caster(Y)
Do somethng with Target(Y)
set Y=Y+1
 
Level 10
Joined
Sep 21, 2007
Messages
517
BTW guys whoever told me this is stupid idea for spell, i know... thats why im saying to use it for storage. this is because you can get back the value without looping through arrays and for faster execution, but the branching by multiplying is only for storage. I WOULD NEVER USE THIS FOR SPELL, and the attached CV Idea i knew a long time ago, i just wanted to add something extra to be able to open more solutions toward storing values. And ghostwolf, sup man >_> good thing ur not in army right bro?
 
Level 10
Joined
Sep 21, 2007
Messages
517
well i guess then i wont use the branching by multiplying cus u said so poot, since ur much more experienced then me t.t I still know that CV for systems is extremely useful, especially since i used it alot for alot of systems rather than having to loop through hell ;P Thanks for comment poot, been a couple of years since iv seen you, i remember starting mapmaking while you were there... Good times... Good times... ))
 
Status
Not open for further replies.
Top