• 🏆 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] Engine Improving

Status
Not open for further replies.
Level 10
Joined
Feb 20, 2008
Messages
448
Hi people this thread is to help me improving my 2 engine i made

I found them very usefull and i would like to get poeple advice on how improving and also if i should release it!! thought its an engine its not really a spell's but u can take them to make spell's


actually i use GUI engine to save some code line much ass Vjass Librairy


maybe i didnt explain it good lolz here is the code itself

Badly some poeple are making spell,s and do not know alot!! I think this ressource could be useful since u could save huge line and many spell's.

I think a GUI Fading engine would not scare poeple that hate the usage of VJass.....not evry1 like and use Vjass even thought its best ......

Actually i made a tons of engine like that but most of them are only remake of other stuff for particular Situation or for my own needs

I dont think pro would not need to use this unless they wanna spare some time of coding :)


here is the variable call Exemple
  • Actions
    • -------- THOSE VARIABLE HAVE TO BE FILLED IN THE SPELL TRIGGER IN ORDER TO MAKE THE CORE RUN --------
    • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
    • -------- here i have set to no unit becuz its up to you to choose which unit will be fade most of time it will be : Last created Unit --------
    • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
    • Unit Group - Add (Last created unit) to FadeGroupUnit
    • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
    • -------- we got a color fading option 2 :P : false = no color fading --------
    • Set FadeColorYesNo = False
    • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
    • -------- we got a color fading option 2 :P : false = no color fading --------
    • Set FadeUnfadeYesNo = False
    • -------- do you want to unfade :P false = no :) --------
    • Set FadeRemoveFromMapYesNo = True
    • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
    • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
    • -------- do you want the fading to become transparent ? --------
    • Set FadeTransparencyYesNo = True
    • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
    • -------- 100 = full color --------
    • Set FadeBlue = 100.00
    • Set FadeGreen = 100.00
    • Set FadeRed = 100.00
    • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
    • -------- here is the reduce we use on transparency & color fading if you want 2 --------
    • Set FadeReduce = 10.00
    • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
    • -------- 100 = 100% invisibble --------
    • Set FadeMaxTransparency = 100.00
    • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
    • -------- 0 = 100% visible --------
    • Set FadeTransparency = 0.00
    • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
    • -------- here i run the core :) --------
    • Trigger - Run Fade Core <gen> (checking conditions)
The code itself
  • Fade Core
    • Events
    • Conditions
    • Actions
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FADE_Index_Size Equal to 0
        • Then - Actions
          • Trigger - Turn on Fade Loop <gen>
        • Else - Actions
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- Increase the index size --------
      • Set FADE_Index_Size = (FADE_Index_Size + 1)
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- Dynamic Index --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FADE_Index_Size Greater than FADE_Index_maxSize
        • Then - Actions
          • Set FADE_Index[FADE_Index_Size] = FADE_Index_Size
          • Set FADE_Index_maxSize = FADE_Index_Size
        • Else - Actions
      • -------- Dynamic Index End --------
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • Set IndexInt = FADE_Index[FADE_Index_Size]
      • -------- Setup those arrays --------
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- do you want to unfade :P false = no :) --------
      • Set FADE_UnfadeYesNo[IndexInt] = FadeUnfadeYesNo
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- here is the unit to be faded :) --------
      • Custom script: set udg_FADE_GroupUnit[udg_IndexInt] = CreateGroup()
      • Unit Group - Add all units of FadeGroupUnit to FADE_GroupUnit[IndexInt]
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- Do you want the faded unit to be removed from map ? mostly yes...... --------
      • -------- unless u used it for a teleportation system ^^ you have to NOT remove the caster from the map :P --------
      • -------- you may like the unit to be removed from map as soon he is invisible or destroy it within the spell... or maybe both O_O XD --------
      • Set FADE_RemoveFromMapYesNo[IndexInt] = FadeRemoveFromMapYesNo
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- do you want the fading to become transparent ? --------
      • Set FADE_TransparencyYesNo[IndexInt] = FadeTransparencyYesNo
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- if 100 = 100% transparent --------
      • Set FADE_MaxTransparency[IndexInt] = FadeMaxTransparency
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- this is the fade rate that will be removed from the max transparency --------
      • Set FADE_Reduce[IndexInt] = FadeReduce
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- the fade start at 0 and end at 100 by interval of 10 :P --------
      • Set FADE_Transparency[IndexInt] = FadeTransparency
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • Set FADE_Blue[IndexInt] = FadeBlue
      • Set FADE_Red[IndexInt] = FadeRed
      • Set FADE_Green[IndexInt] = FadeGreen
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • Set FADE_MaxTransparency_Fake[IndexInt] = 0.00
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- boolean to be sure the insteance reducing wont be spamm : must be alway set to true here --------
      • Set FADE_Boolean[IndexInt] = True
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • Set FADE_Counter1[IndexInt] = 0
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • Unit Group - Remove all units of FadeGroupUnit from FadeGroupUnit
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FADE_UnfadeYesNo[IndexInt] Equal to False
        • Then - Actions
          • Unit Group - Pick every unit in FADE_GroupUnit[IndexInt] and do (Actions)
            • Loop - Actions
              • Animation - Change (Picked unit)'s vertex coloring to (FADE_Red[IndexInt]%, FADE_Green[IndexInt]%, FADE_Blue[IndexInt]%) with FADE_Transparency[IndexInt]% transparency
        • Else - Actions
          • Unit Group - Pick every unit in FADE_GroupUnit[IndexInt] and do (Actions)
            • Loop - Actions
              • Animation - Change (Picked unit)'s vertex coloring to (FADE_Red[IndexInt]%, FADE_Green[IndexInt]%, FADE_Blue[IndexInt]%) with FADE_MaxTransparency_Fake[IndexInt]% transparency
  • Fade Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer FADE_LOOP) from 1 to FADE_Index_Size, do (Actions)
        • Loop - Actions
          • -------- This let look everything cleaner. --------
          • Set IndexInt = FADE_Index[FADE_LOOP]
          • -------- Condition... --------
          • Set FADE_Transparency[IndexInt] = (FADE_Transparency[IndexInt] + FADE_Reduce[IndexInt])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FADE_Transparency[IndexInt] Less than FADE_MaxTransparency[IndexInt]
            • Then - Actions
              • -------- if you wanted you could do a color fade ^^ : let go your imagination :P the only limit is your imagination ^^!! --------
              • -------- you could even use FADE_Reduce to reduce the color :P --------
              • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FADE_COLORYesNo Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • FADE_UnfadeYesNo[IndexInt] Equal to False
                    • Then - Actions
                      • Set FADE_Red[IndexInt] = (FADE_Red[IndexInt] - FADE_Reduce[IndexInt])
                      • Set FADE_Green[IndexInt] = (FADE_Green[IndexInt] - FADE_Reduce[IndexInt])
                      • Set FADE_Blue[IndexInt] = (FADE_Blue[IndexInt] - FADE_Reduce[IndexInt])
                    • Else - Actions
                      • Set FADE_Red[IndexInt] = (FADE_Red[IndexInt] + FADE_Reduce[IndexInt])
                      • Set FADE_Green[IndexInt] = (FADE_Green[IndexInt] + FADE_Reduce[IndexInt])
                      • Set FADE_Blue[IndexInt] = (FADE_Blue[IndexInt] + FADE_Reduce[IndexInt])
                • Else - Actions
              • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
              • -------- here i fade the target by a little formula --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FADE_TransparencyYesNo[IndexInt] Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • FADE_UnfadeYesNo[IndexInt] Equal to False
                    • Then - Actions
                      • Unit Group - Pick every unit in FADE_GroupUnit[IndexInt] and do (Actions)
                        • Loop - Actions
                          • Animation - Change (Picked unit)'s vertex coloring to (FADE_Red[IndexInt]%, FADE_Green[IndexInt]%, FADE_Blue[IndexInt]%) with FADE_Transparency[IndexInt]% transparency
                    • Else - Actions
                      • Unit Group - Pick every unit in FADE_GroupUnit[IndexInt] and do (Actions)
                        • Loop - Actions
                          • Animation - Change (Picked unit)'s vertex coloring to (FADE_Red[IndexInt]%, FADE_Green[IndexInt]%, FADE_Blue[IndexInt]%) with FADE_MaxTransparency_Fake[IndexInt]% transparency
                  • -------- here i fade the target :) --------
                • Else - Actions
                  • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
            • Else - Actions
              • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
              • -------- Destroy handles --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FADE_Boolean[IndexInt] Equal to True
                • Then - Actions
                  • Set FADE_Boolean[IndexInt] = False
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • FADE_RemoveFromMapYesNo[IndexInt] Equal to True
                    • Then - Actions
                      • Unit Group - Pick every unit in FADE_GroupUnit[IndexInt] and do (Actions)
                        • Loop - Actions
                          • Unit - Remove (Picked unit) from the game
                    • Else - Actions
                  • -------- RecycleIndex --------
                  • Custom script: call DestroyGroup(udg_FADE_GroupUnit[udg_IndexInt])
                  • Set FADE_Transparency[IndexInt] = 0.00
                  • Set FADE_MaxTransparency[IndexInt] = 100.00
                  • Set FADE_Red[IndexInt] = 0.00
                  • Set FADE_Green[IndexInt] = 0.00
                  • Set FADE_Blue[IndexInt] = 0.00
                  • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
                  • Set FADE_Index[FADE_LOOP] = FADE_Index[FADE_Index_Size]
                  • Set FADE_Index[FADE_Index_Size] = IndexInt
                  • Set FADE_Index_Size = (FADE_Index_Size - 1)
                  • Set FADE_LOOP = (FADE_LOOP - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • FADE_Index_Size Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
      • -------- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= --------
      • -------- Turn the trigger again off if the index_size is below 0... --------
 
Level 7
Joined
Jun 8, 2010
Messages
283
This is pretty neat actually, but i think there is a flaw in your default parabola formula.

When a unit is at a higher altitude and casts the spell, the missile will target the point selected but with an offset equal to the height displacement of the ground to the group above the cliff.

Should fix that. The advanced parabola formula looks okay though.
 
Level 10
Joined
Feb 20, 2008
Messages
448
http://www.4shared.com/file/Wkd8LwFK/Fading_system_GUI_MUI__13b.html
i just realized i showed u wrong spells but i needed a review on my own jumps Thx :D Rep +


but about the jump what do u mean by This is pretty neat actually, but i think there is a flaw in your default parabola formula.

When a unit is at a higher altitude and casts the spell, the missile will target the point selected but with an offset equal to the height displacement of the ground to the group above the cliff.

Should fix that. The advanced parabola formula looks okay though.

does its mena i should add a height comparaison to see if the casting point is higher than the caster altitude so i fix the height.... im lil bit lost... my english is wrost im french can you explain me better or give me an exemple :D
 
Level 7
Joined
Jun 8, 2010
Messages
283
Yes, you should add a height check.

Ie. If you wanted to launch a missile from a hill that is for example +4 feet above sea level, and you target an area 10feet east of your position with the altitude of 1ft above sea level,

Your system seems like it would:
Calculate the difference between the height and then add that to how far the ejected missile goes.
Code:
4ft (cliff) - 1ft (targeted ground) = 4 feet (Altitude difference)
This 4ft is then added to how far the missile goes, so since youre targeting an area at 10ft east, it will add 4 feet to the distance instead of not adding the difference at all.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,207
A quick glance shocked me to see that there is no stacking code in the system.

By this I mean, what if you make a spell which makes the target unit cach fire and glow red. But then someone casts on you an ability which ups your stats (star power) that makes you flash all kinds of colours. There needs to be logic to deal with this situation eithor via a piority highest takes affect) or via blending (average colours).

Currently it is whichever updates last gets the visual piority. Even if this is something stupid like a slight yellow tint for some spell it might take piority over major colour changes based on update order.
 
Level 10
Joined
Feb 20, 2008
Messages
448
A quick glance shocked me to see that there is no stacking code in the system.

By this I mean, what if you make a spell which makes the target unit cach fire and glow red. But then someone casts on you an ability which ups your stats (star power) that makes you flash all kinds of colours. There needs to be logic to deal with this situation eithor via a piority highest takes affect) or via blending (average colours).

Currently it is whichever updates last gets the visual piority. Even if this is something stupid like a slight yellow tint for some spell it might take piority over major colour changes based on update order.

so you mean my fading system could be glitched ? Becuz i dont understand the point of Stacking into a fading engine o-O


do you mean if the same unit getting color changed by 2 poeple 1 fter another 1 of those should had a priority ? if yes how could i done this o-O never watch stacking code or saw those :(

becuz i agree if that is a stacking would make it betetr but how could i done ? .

BTW for the jumps engine i deleted it becuz its shitty made 2 much flaws so im using 1 i found in forums :( i will give credits :/ lolz and betetr than mine! but i would like to improve this engine (fading engine)
 
Yeah, this is what Dr Super Good means. There is the term "MUI" and then there is the term "stacking". MUI is an effect to enable distribution of instances among multiple units, while stacking is an effect to enable distribution of instances (of the spell/system) to one unit, meaning a unit can be affected, without new events on the unit overriding the previous ones. I will give you an example.
You have a spell that gradually increases the size of your unit. Let's say that the current size (provided by the spell) of the unit is 2.3 * (the original one). A unit comes and casts Bloodlust on you, which increases the size of your unit by the value set in the Object Editor. The unit's size will be set to the Bloodlust's scaling value, and will go back to 2.3x, when the next timed event fires for that unit, to go on to 2.4x (assuming that you increase your unit's size periodically by 10%).
What Dr Super Good suggests is that you should find the average size of the size, provided by your custom spell and Bloodlust's. Let's say you have 2.3x size and Bloodlust gives you 5x size. If you make no 'stacking' change (as Dr Super Good suggests), your unit will suddenly have a size of 5x. To make it smoother (and add the 'stacking' enhancement), your unit's new size should be 5 + 2.3 / 2 = 3.65x. So, what you should do, is devide the current amount of instances addressing on the same unit (I devided by 2, because the assumed unit in under the effect of two spells).

Of course, my example has to do with two different spells. I just gave you a heads up of what stacking means.

To your case, let's assume that your unit's size is 1x and the spell is casted, when a periodic event runs, taking the size up to 2.4x, and then the same spell is casted on your unit, which still increases in size. The new size will start from 1x, when your previous size was 2.4x and it will keep switching from 1x + to 2.4x +.
 
Level 10
Joined
Feb 20, 2008
Messages
448
If you make no 'stacking' change (as Dr Super Good suggests), your unit will suddenly have a size of 5x. To make it smoother (and add the 'stacking' enhancement), your unit's new size should be 5 + 2.3 / 2 = 3.65x. So, what you should do, is devide the current amount of instances addressing on the same unit (I devided by 2, because the assumed unit in under the effect of two spells).

Of course, my example has to do with two different spells. I just gave you a heads up of what stacking means.

To your case, let's assume that your unit's size is 1x and the spell is casted, when a periodic event runs, taking the size up to 2.4x, and then the same spell is casted on your unit, which still increases in size. The new size will start from 1x, when your previous size was 2.4x and it will keep switching from 1x + to 2.4x +.

can you show me a code exemple ? im trying to understand hard for french guy lolz! Thx anyway :D
 
Status
Not open for further replies.
Top