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

Chinese Dragon 1.51

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Chinese Dragon
this thing causes lag and I don't know where the leak is!!!

a word from BPower...
someone kindly tell me what does that mean
'-> Create the tail as a whole and move it along with the head.'


  • Settings
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set DRA_AttackType = Normal
      • Set DRA_DamageType = Normal
      • Set DRA_Type = Dragon
      • Set DRA_DummyType = Dummy
      • Set DRA_Spd = 30.00
      • Set DRA_Dmg = 30.00
      • Set DRA_DmgRange = 100.00
      • Set DRA_Abilities = Summon Dragon
      • Set DRA_Cons_Interval = 2.00
  • Trained
    • Events
      • Unit - A unit Finishes training a unit
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Trained unit)) Equal to Dragon
          • (Ability being cast) Equal to DRA_Abilities
    • Actions
      • Set DRA_MUI = (DRA_MUI + 1)
      • Set DRA_Intervals[DRA_MUI] = 0.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is A structure) Equal to True
        • Then - Actions
          • Set DRA_Trained[DRA_MUI] = (Trained unit)
        • Else - Actions
          • Set DRA_Cast_Point = (Position of (Triggering unit))
          • Unit - Create 1 DRA_Type for (Owner of (Triggering unit)) at DRA_Cast_Point facing (Facing of (Triggering unit)) degrees
          • Set DRA_Trained[DRA_MUI] = (Last created unit)
          • Selection - Add DRA_Trained[DRA_MUI] to selection
          • Custom script: call RemoveLocation(udg_DRA_Cast_Point)
      • Set DRA_TempPoint00 = (Position of DRA_Trained[DRA_MUI])
      • Set DRA_TempPoint003 = (DRA_TempPoint00 offset by 100.00 towards (Facing of DRA_Trained[DRA_MUI]) degrees)
      • Unit - Order DRA_Trained[DRA_MUI] to Patrol To DRA_TempPoint003
      • Custom script: call RemoveLocation(udg_DRA_TempPoint00)
      • Custom script: call RemoveLocation(udg_DRA_TempPoint00)
      • Custom script: call RemoveLocation(udg_DRA_TempPoint003)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DRA_MUI Equal to 1
        • Then - Actions
          • Trigger - Turn on Loop <gen>
        • Else - Actions
  • Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DRA_Loop_A_Interger) from 1 to DRA_MUI, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DRA_Trained[DRA_Loop_A_Interger] is alive) Equal to True
            • Then - Actions
              • Set DRA_Intervals[DRA_Loop_A_Interger] = (DRA_Intervals[DRA_Loop_A_Interger] - 1.00)
              • Set DRA_TempPoint001 = (Position of DRA_Trained[DRA_Loop_A_Interger])
              • Set DRA_TempPoint002 = (DRA_TempPoint001 offset by DRA_Spd towards (Facing of DRA_Trained[DRA_Loop_A_Interger]) degrees)
              • Set DRA_UnitGroup = (Units within DRA_DmgRange of DRA_TempPoint001 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of DRA_Trained[DRA_Loop_A_Interger])) Equal to True) and (((Matching unit) is alive) Equal to True)
              • Unit Group - Pick every unit in DRA_UnitGroup and do (Actions)
                • Loop - Actions
                  • Unit - Cause DRA_Trained[DRA_Loop_A_Interger] to damage (Picked unit), dealing DRA_Dmg damage of attack type DRA_AttackType and damage type DRA_DamageType
              • Custom script: call DestroyGroup(udg_DRA_UnitGroup)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DRA_Intervals[DRA_Loop_A_Interger] Less than or equal to 0.00
                • Then - Actions
                  • Unit - Create 1 DRA_DummyType for (Owner of DRA_Trained[DRA_Loop_A_Interger]) at DRA_TempPoint001 facing (Facing of DRA_Trained[DRA_Loop_A_Interger]) degrees
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                  • Set DRA_Intervals[DRA_Loop_A_Interger] = DRA_Cons_Interval
                • Else - Actions
              • Custom script: call SetUnitY(udg_DRA_Trained[udg_DRA_Loop_A_Interger], GetLocationY(udg_DRA_TempPoint002))
              • Custom script: call SetUnitX(udg_DRA_Trained[udg_DRA_Loop_A_Interger], GetLocationX(udg_DRA_TempPoint002))
              • Custom script: call RemoveLocation(udg_DRA_TempPoint001)
              • Custom script: call RemoveLocation(udg_DRA_TempPoint002)
            • Else - Actions
              • Set DRA_Trained[DRA_Loop_A_Interger] = DRA_Trained[DRA_MUI]
              • Set DRA_Intervals[DRA_Loop_A_Interger] = DRA_Intervals[DRA_MUI]
              • Set DRA_MUI = (DRA_MUI - 1)
              • Set DRA_Loop_A_Interger = (DRA_Loop_A_Interger - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DRA_MUI Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • Walk
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Issued order) Not equal to (Order(patrol))
          • (Unit-type of (Ordered unit)) Equal to DRA_Type
    • Actions
      • Set DRA_TempPoint004 = (Target point of issued order)
      • Unit - Order (Ordered unit) to Patrol To DRA_TempPoint004
      • Custom script: call RemoveLocation(udg_DRA_TempPoint004)


Oh forgot to add credits
Dragon head model by Jhonny Janbo

again! variable more uniform
and is there any solution other than just let the unit patrolling?

added item
Contents

Dragons! (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 09:14, 2nd May 2014 BPower: Currently you are using 5 location variables, while just two would be enough. In "trained" you remove the same location twice. Anything used more than once...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

09:14, 2nd May 2014
BPower:
Currently you are using 5 location variables, while just two would be enough.
In "trained" you remove the same location twice.
Anything used more than once (twice) should be stored into a variable to save computation time, for instance TriggeringUnit.
You stated, you understood my suggestion about moving the dragon. I want to see it in the next update.
 

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,449
leaks are not causing lags

  • Set Dragon_UnitGroup = (Units within Dragon_DmgRange of TempPoint001 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of Dragon_Trained[Loop_A_Interger])) Equal to True) and (((Matching unit) is alive) Equal to True)))
filter units using If then else!

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • MUI Equal to 0
  • Then - Actions
  • Trigger - Turn off (This trigger)
you check it every 0.03 seconds? :goblin_wtf:

  • Unit - A unit Finishes training a unit
what if I want to create a dragon but that's not the event I want?

what will happen if I create 10 dragons? maybe my PC will be blue-screened x.X

your spell[?] need more configurations
 
Level 25
Joined
May 11, 2007
Messages
4,651
Does this work?
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)

I'm pretty sure that you have to change it to water elemental or something, IF I remember correctly.
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
I'm 100% sure that the lag is caused by the amount of units you create every 0.03 seconds (dummies - the effect of dragon). Try to increase the periodic time to 0.50 or what ever (not saying that it must be like that)
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
Its the amount of units you create for the trail of the dragon. you create 33 a second, you don't remove them in game, only kill, meaning that it still exists, make a trigger to remove them after they get killed. This doesn't fully clear the leak, but a great part of it.
 
leaks are not causing lags

  • Set Dragon_UnitGroup = (Units within Dragon_DmgRange of TempPoint001 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of Dragon_Trained[Loop_A_Interger])) Equal to True) and (((Matching unit) is alive) Equal to True)))
filter units using If then else!

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • MUI Equal to 0
  • Then - Actions
  • Trigger - Turn off (This trigger)
you check it every 0.03 seconds? :goblin_wtf:

  • Unit - A unit Finishes training a unit
what if I want to create a dragon but that's not the event I want?

what will happen if I create 10 dragons? maybe my PC will be blue-screened x.X

your spell[?] need more configurations



well now you can have 10 dragonss yay..
i had add for new event (spell)
a little bit more configuration

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • MUI Equal to 0
  • Then - Actions
  • Trigger - Turn off (This trigger)
you check it every 0.03 seconds? :goblin_wtf:

  • Set Dragon_UnitGroup = (Units within Dragon_DmgRange of TempPoint001 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of Dragon_Trained[Loop_A_Interger])) Equal to True) and (((Matching unit) is alive) Equal to True)))
filter units using If then else!


how to fix this?
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
You do not need to do a trigger such as

Unit Dies
Unit-type is x
Remove X from game

You need to just go to the OE and set the dummy to Can't Raise, Does not Decay. That causes it to be removed on its own.
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
Variables generated with the variable editor can quickly cause problems if they share the same name.
That's the reason we want you to choose unique and uniform variables names for your submissions. Please also label variables like "MUI" into Dragon_MUI. Btw a 3 char identifier DRA_ would be enough.
Example:
- Your spell uses the variable name "MUI".
- Another spell uses the variable name "MUI".
- An users imports both spells --> Imported variables get created.
- "MUI" does already exist --> not created a second time.
- "MUI" is used over both resource and will casues malfunction.

Don't remove the dummy from the game. "Can't raise, does not decay" deals with it.
Why do your dummies have the human inventory ability?

You want to get rid of all kind of laggs/spikes (I didn't experience them while testing)
-> Create the tail as a whole and move it along with the head.
 
  • Custom script: call RemoveLocation(udg_DRA_TempPoint00)
^This line is you accidently made two times in your "Trained" trigger. Also in same trigger you could store TriggeringUnit into a variable to prevent more function calls.

In your "Walk" trigger you don't need this "And - All (Conditions)" block.

If dragon gets order to stop or to hold position it moves staight until it gets out of map and game crashes.

If I order the dragon to move to a larger distance, it stops after short distance and begins circeling again.
It's sucky that you need to spam orders to move the dragon to wanted place. :s

Move following into your de-index part:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DRA_MUI Equal to 0
    • Then - Actions
      • Trigger - Turn off (This Trigger)
    • Else - Actions
  • [/stable]
No need to check it each time.

You use SetUnitX/Y for dragon. Thats ok, but you should check that it wont get out of map. First it may bug as mentioned before, and secondly it looks strange, you can test it yourself.

You should improve the description and icon in object editor.

  • Set DRA_UnitGroup = (Units within DRA_DmgRange of DRA_TempPoint001 matching ((((Matching unit) is A Building) Equals False) and ((((Matching unit) belongs to an enemy of (Owner of DRA_Trained[DRA_Loop_A_Interger])) Equals True) and (((Matching unit) is
  • alive) Equals True))))
I would pick all units in range, set PickedUnit to a variable and then filter it. It's easier to read.

Dragon looks very cool in game, I like it much. Would be cool if you could add configuration if dragon can damage buildings or not, and I don't like it very much that you create so much units periodically.
 
Variables generated with the variable editor can quickly cause problems if they share the same name.
That's the reason we want you to choose unique and uniform variables names for your submissions. Please also label variables like "MUI" into Dragon_MUI. Btw a 3 char identifier DRA_ would be enough.
Example:
- Your spell uses the variable name "MUI".
- Another spell uses the variable name "MUI".
- An users imports both spells --> Imported variables get created.
- "MUI" does already exist --> not created a second time.
- "MUI" is used over both resource and will casues malfunction.

Don't remove the dummy from the game. "Can't raise, does not decay" deals with it.
Why do your dummies have the human inventory ability?

You want to get rid of all kind of laggs/spikes (I didn't experience them while testing)
-> Create the tail as a whole and move it along with the head.

  • Custom script: call RemoveLocation(udg_DRA_TempPoint00)
^This line is you accidently made two times in your "Trained" trigger. Also in same trigger you could store TriggeringUnit into a variable to prevent more function calls.

In your "Walk" trigger you don't need this "And - All (Conditions)" block.

If dragon gets order to stop or to hold position it moves staight until it gets out of map and game crashes.

If I order the dragon to move to a larger distance, it stops after short distance and begins circeling again.
It's sucky that you need to spam orders to move the dragon to wanted place. :s

Move following into your de-index part:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DRA_MUI Equal to 0
    • Then - Actions
      • Trigger - Turn off (This Trigger)
    • Else - Actions
  • [/stable]
No need to check it each time.

You use SetUnitX/Y for dragon. Thats ok, but you should check that it wont get out of map. First it may bug as mentioned before, and secondly it looks strange, you can test it yourself.

You should improve the description and icon in object editor.

  • Set DRA_UnitGroup = (Units within DRA_DmgRange of DRA_TempPoint001 matching ((((Matching unit) is A Building) Equals False) and ((((Matching unit) belongs to an enemy of (Owner of DRA_Trained[DRA_Loop_A_Interger])) Equals True) and (((Matching unit) is
  • alive) Equals True))))
I would pick all units in range, set PickedUnit to a variable and then filter it. It's easier to read.

Dragon looks very cool in game, I like it much. Would be cool if you could add configuration if dragon can damage buildings or not, and I don't like it very much that you create so much units periodically.

If I don't create unit periodicly then what else can I do?
Moving all the unit seems outside of my triggering level O.O
 
Nah I am sure you can do it, you made this which is quite epic. It is quite easy to do the next step and if it works then it might be better for less lag.

Basically you make dummy unit variables to move the tail/body of the dragon instead of constantly making leaks/creating units then killing them.
 

Attachments

  • showhowdrag.w3x
    31.3 KB · Views: 71
Going to have to be some complex math because I haven't even been able to figure out how to even get a tail to work with that.

BPower it'd be nice if you stepped in showing a tutorial of some sort since it is what you suggested otherwise I don't think this guy will be able to figure it out because I am having quite the difficulty myself.
 
If you want it to deal damage just use a damage detection system and use the damage area action with an specific amount (by example 0.10 universal spell damage) then detect it via damage detection and alterate the damage for the amount you want, you can even add ratios for a hero, this could be an awesome hero if it had a kick ass protrait.

BTW it is not a chinese dragon until it makes a zigzag move; therefore you could make it loose height and gain it periodicaly.
 
Top