• 🏆 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] This trigger gt any leaks?or will make game lag?

Status
Not open for further replies.
Level 3
Joined
Mar 28, 2010
Messages
42
  • Shuriken Effect
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 28, do (Actions)
        • Loop - Actions
          • Set Shuriken_point = (Shuriken_area offset by 560.00 towards ((Real((Integer A))) x 15.00) degrees)
          • Unit - Create 1 Shuriken for (Owner of ShurikenCaster) at Shuriken_point facing Shuriken_area
          • Set ShurikenDummy[(Integer A)] = (Last created unit)
          • Unit - Add ShurikenAbility[(Level of Shuriken for ShurikenCaster)] to ShurikenDummy[(Integer A)]
          • Unit - Add a 1.50 second Generic expiration timer to ShurikenDummy[(Integer A)]
          • Custom script: call RemoveLocation (udg_Shuriken_point)
This trigger gt any leaks?or will make game lag?
 
Level 13
Joined
Sep 13, 2010
Messages
550
It not leaks but if you will not remove those units it will lagg a lot after a time

Edit: Every 1 second you create unit for 1.5 second so after 10 mins( 600 secs ) there will be 600*28*( 1.5 - 1 ) = 8400!!!!!! units on the map...
 
Level 3
Joined
Mar 28, 2010
Messages
42
It not leaks but if you will not remove those units it will lagg a lot after a time

Edit: Every 1 second you create unit for 1.5 second so after 10 mins( 600 secs ) there will be 600*28*( 1.5 - 1 ) = 8400!!!!!! units on the map...

if wan to remove need how to edit???

I don't get why you set (Last created unit) to variable since it will expire in 1.5 sec anyways so you cant do much with it.


Long way to goooo.
Adding expiration timer fixs that problem.

adding expiration timer...to other trigger for remove units?
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
@nightwalkerg You can leave 1.5 sec expiration, no problem

@geries Man, what are you talking about?
Expiration timer by itself times unit's life, enables to play death animation and unit will be removed like normal dead unit with time. Ofcourse spamming 28 isn't good especialy if he doesnt disable trigger from time to time but if its dummy unit (with no model) expiration timer removes it instantly.
 
Level 3
Joined
Mar 28, 2010
Messages
42
  • Shuriken
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shuriken
    • Actions
      • Set ShurikenCaster = (Casting unit)
      • Set Shuriken_area = (Position of ShurikenCaster)
      • Trigger - Turn on Shuriken Effect <gen>
      • Wait 6.00 seconds
      • Trigger - Turn off Shuriken Effect <gen>
      • Custom script: call RemoveLocation (udg_Shuriken_area)
  • Shuriken Effect
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 24, do (Actions)
        • Loop - Actions
          • Set Shuriken_point = (Shuriken_area offset by 560.00 towards ((Real((Integer A))) x 15.00) degrees)
          • Unit - Create 1 Shuriken for (Owner of ShurikenCaster) at Shuriken_point facing Shuriken_area
          • Set ShurikenDummy[(Integer A)] = (Last created unit)
          • Unit - Add ShurikenAbility[(Level of Shuriken for ShurikenCaster)] to ShurikenDummy[(Integer A)]
          • Custom script: call RemoveLocation (udg_Shuriken_point)
      • Wait 0.50 seconds
      • For each (Integer A) from 1 to 24, do (Actions)
        • Loop - Actions
          • Unit - Remove ShurikenDummy[(Integer A)] from the game
if i change like this...is it ok???
 
Last edited:
Level 26
Joined
Mar 19, 2008
Messages
3,140
Remove the Wait from trigger above and use real variable to store duration:
  • Set Duration = 6.00
And by the may, using location this way is risky, better refer to Caster unit itself:
  • Shuriken
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shuriken
    • Actions
      • Set ShurikenCaster = (Casting unit)
      • Set Duration = 6.00
      • Trigger - Turn on Shuriken Effect <gen>
Now in the loop:
  • Shuriken Effect
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All conditions are true) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Duration Greater than 0
        • Then - Actions
          • Set Duration = Duration - 1.00
          • Set Shuriken_area = (Position of ShurikenCaster)
          • For each (Integer A) from 1 to 28, do (Actions)
            • Loop - Actions
              • Set Shuriken_point = (Shuriken_area offset by 560.00 towards ((Real((Integer A))) x 15.00) degrees)
              • Unit - Create 1 Shuriken for (Owner of ShurikenCaster) at Shuriken_point facing Shuriken_area
              • Set ShurikenDummy[(Integer A)] = (Last created unit)
              • Unit - Add ShurikenAbility[(Level of Shuriken for ShurikenCaster)] to ShurikenDummy[(Integer A)]
              • Unit - Add a 1.50 second Generic expiration timer to ShurikenDummy[(Integer A)]
              • Custom script: call RemoveLocation (udg_Shuriken_point)
          • Custom script: call RemoveLocation (udg_Shuriken_area)
        • Else - Actions
          • Trigger - Turn off (This trigger)
If you want to make this trigger MUI let me know.
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
If you would be using empty model for dummy unit (since it's just created to cast one spell - it's appearance is not needed). To do that go to Object Editor, find given dummy unit and in Art - Model enter ".mdl" (without "").

By the way, I have forgotten that you do not require array variable for unit, use non array one.
If you really want to do that using unit removal, use:
  • Shuriken Effect
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All conditions are true) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Duration Greater than 0
        • Then - Actions
          • Set Duration = Duration - 1.00
          • Set Shuriken_area = (Position of ShurikenCaster)
          • For each (Integer A) from 1 to 28, do (Actions)
            • Loop - Actions
              • Set Shuriken_point = (Shuriken_area offset by 560.00 towards ((Real((Integer A))) x 15.00) degrees)
              • Unit - Create 1 Shuriken for (Owner of ShurikenCaster) at Shuriken_point facing Shuriken_area
              • Set ShurikenDummy = (Last created unit)
              • Unit - Add ShurikenAbility[(Level of Shuriken for ShurikenCaster)] to ShurikenDummy
              • Trigger - Run init <gen> (ignoring conditions)
              • Custom script: call RemoveLocation (udg_Shuriken_point)
          • Custom script: call RemoveLocation (udg_Shuriken_area)
        • Else - Actions
          • Trigger - Turn off (This trigger)
  • init
    • Events
    • Conditions
    • Actions
      • Custom script: local unit u = udg_ShurikenDummy
      • Custom script: call TriggerSleepAction(1.5)
      • Custom script: call RemoveUnit(u)
      • Custom script: set u = null
 
Level 3
Joined
Mar 28, 2010
Messages
42
this one
 

Attachments

  • Untitled.png
    Untitled.png
    139.2 KB · Views: 72
Status
Not open for further replies.
Top