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

[Solved] Remove effect after x seconds

Status
Not open for further replies.
Level 4
Joined
Jan 17, 2018
Messages
112
Hi all,

I don't know the custom script things, so how would I go about removing a lightning effect after x period of time?

  • Nuke
    • Events
      • Unit - A unit enters Region 032 <gen>
    • Conditions
    • Actions
      • Camera - Pan camera for (Owner of (Triggering unit)) to (Center of Region 033 <gen>) over 0.00 seconds
      • Unit Group - Pick every unit in (Units in Region 033 <gen>) and do (Actions)
        • Loop - Actions
          • Wait 3.00 seconds
          • Lightning - Create a Chain Lightning - Primary lightning effect from source (Random point in Region 033 <gen>) to target (Center of Region 033 <gen>)
          • Lightning - Create a Chain Lightning - Primary lightning effect from source (Random point in Region 033 <gen>) to target (Center of Region 033 <gen>)
          • Unit - Kill (Picked unit)
I read in trigger posts "custom script : remove...." and I don't know or can find how to do that part
 
Level 12
Joined
Dec 11, 2014
Messages
662
When you create it you gotta store it in an array or somewhere you can keep track of it.

  • Lightning - Create a Mana Burn lightning effect from source Source to target Target
  • Set Lightning[Number] = (Last created lightning effect)
Then turn on a loop

  • Events
    • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set Timer[Number] = (Timer[Number] + 0.03)
      • -------- - --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Timer[Number] Greater than or equal to 0.30
        • Then - Actions
          • Lightning - Destroy Lightning[Number]
          • Set Timer[Number] = 0.00
          • Trigger - Turn off (This trigger)
This is just an example to give you an idea, it probably won't look exactly like this
 
Level 4
Joined
Jan 17, 2018
Messages
112
I made a TimedLightning system a while back but it was jass I think.

I would suggest making a timer -> destroy timer on expiration. I think it is better than a loop.
Though it might require a jass line or two to do properly.

Better in what sense? Lower loading time at launch of map?
 
Level 12
Joined
Jun 12, 2010
Messages
413
You can use one of these systems to do what you want:

[GUI-friendly] Timer System
Delayed Action 1.5a

The first one basically allows you to use JASS timers with GUI, allowing you to have as many timers as you need at any given moment. The second one works more like what DaneTheBeast suggested, it reduces a number periodically until it reaches zero and executes the trigger. It also allows you to have as many "timers" (reducing numbers) as you need.

The abscence of timers is really onet of the worst aspects of GUI, since they are extremely useful. So using either one of these systems should help you in the future.
 
Status
Not open for further replies.
Top