• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

[Trigger] Question about periodic events

Status
Not open for further replies.
Level 8
Joined
Apr 30, 2009
Messages
338
Ok so this spell I am making, I am trying to make it MUI. What it does is this:

Caster casts it

A "storm" follows the caster around for 6 seconds and shoots a random bolt of lightning at the ground somewhere nearby every 0.16 seconds

I have it working in GUI, but it would only work one instance at a time. I am trying to make it MUI. My problem is this:

There is one trigger which assigns various GLOBAL VARIABLES when the spell is cast, and then turns on the periodic trigger.

The periodic trigger takes the globals and turns them into locals (so that the actual spell only uses global variables for a split second). The problem here is this trigger is "Every 0.16 seconds of game time" then "local unit C = udg_CASTER." This completely fucks up the reason for using locals, since the local will now change to the global every 0.16 seconds! Is there a way to assign locals in a trigger outside of the "every 0.16 seconds" event? Keep in mind, this trigger MUST fire bolts every 0.16 seconds, but the local variable nust not change every 0.16 seconds.

I have a really inefficient solution of having a separate, identical trigger and global arrays indexed to each player, but there must be some better way.
 
Level 9
Joined
Nov 4, 2007
Messages
931
You should probably post the trigger in question so we can see what is wrong with it, but I think that attempting to make a trigger MUI using globals and a periodic timer event are shaky at best, even incorporating some locals in it, you may have to use timers to get the trigger to function properly in MUI.
 
Level 8
Joined
Apr 30, 2009
Messages
338
Yeah that sucks. It is an AOS map, and that means that there could possibly be 10 heroes who cast this spell in any given game.

I will post the triggers soon.

Can I put a GUI trigger on this forum without having to type it out, from the editor somehow?

  • WHCast
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Writhing Hate
  • Actions
    • Set WHNumber = 0
    • Set WHLoc = (Position of (Triggering unit))
    • Set WHLev = (Level of (Ability being Cast) for (Triggering unit))
    • Set WHPlayer = (Owner of (Triggering Unit))
    • Trigger - Turn on WHEffect <gen>
  • WHEffects
  • Events
    • Time - Every 0.16 seconds of game time
  • Conditions
    • WHNumber Less than 36
  • Actions
    • Unit - Create 1 Dummy_WH for WHPlayer at (WHLoc offset by (Random real number between 0.00 and 500.00) towards (Random real number between 0.00 and 360.00) degrees) facing Default building facing degrees
    • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
    • Unit - Set level of WH_AOE of (Last created unit) to (WHLev)
    • Unit - Order (Last created unit) to Human Mountain King - Thunderclap
    • Sound - Play LightningBolt <gen> at 100.00% volume, located at WHLoc with Z offeset 1000.00
    • Special Effect - Create a special effect at (WHLoc) using Abilities\Spells\Other\Doom\DoomDeath.mdl
    • Special Effect - Destroy (Last created special effect)
    • Set WHNumber = (WHNumber + 1)
There are other effects that are in this for visual only (a bolt coming from the sky) which were excluded for clarity.

I know this leaks, I am waiting until I can use locals on this spell to deal with leaks.
 
Level 9
Joined
Nov 4, 2007
Messages
931
Yea, in the first line of your trigger in the trigger editor is ofcourse your trigger name, right click that and click 'Copy As Text' then you can paste the trigger as GUI inside the trigger tags as a post.
 
Level 9
Joined
Nov 4, 2007
Messages
931
Oh if its an AOS, at best all it has to be is PUI which can be done using periodic timers and turning your variables into arrays that use the player index's, so you won't need to use JASS, locals, or timers, I'm not really that great with making PUI spells using arrays, but if you want to find a good example of how to use them I'd look at Dark.Revenant's Battle Mage's map, sorry too lazy to add the link, hope that helps.
 
Status
Not open for further replies.
Top