• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Making this MUI

Status
Not open for further replies.
Level 8
Joined
Apr 30, 2009
Messages
338
So here is my Frozen Orb spell; it finally works - for player 1. Right now I have it set up so I would have to have the "Activation" trigger turn on one of twelve identical triggers based on what player cast the spell:

This activates when the spell is cast:
  • Frozen Orb CAST
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Frozen Orb (Sorceress 1)
    • Actions
      • Set FrozenOrbPlayer[(Player number of (Triggering player))] = (Triggering player)
      • Set FrozenOrbLevel[(Player number of (Triggering player))] = (Level of (Ability being cast) for (Triggering unit))
      • Set FrozenOrbCasterLoc[(Player number of (Triggering player))] = (Position of (Triggering unit))
      • Set FrozenOrbTargetLoc[(Player number of (Triggering player))] = (Target point of ability being cast)
      • Set FrozenOrbTravelAngle[(Player number of (Triggering player))] = (Angle from FrozenOrbCasterLoc[(Player number of (Triggering player))] to FrozenOrbTargetLoc[(Player number of (Triggering player))])
      • Unit - Create 1 Dummy_FrozenOrb for (Triggering player) at FrozenOrbCasterLoc[(Player number of (Triggering player))] facing FrozenOrbTravelAngle[(Player number of (Triggering player))] degrees
      • Set FrozenOrb[(Player number of (Triggering player))] = (Last created unit)
      • Unit - Add a 3.01 second Generic expiration timer to FrozenOrb[(Player number of (Triggering player))]
      • Set FrozenOrbBoltAngle[(Player number of (Triggering player))] = FrozenOrbTravelAngle[(Player number of (Triggering player))]
      • Set FrozenOrbLoc[(Player number of (Triggering player))] = FrozenOrbCasterLoc[(Player number of (Triggering player))]
      • Set FrozenOrbTime[(Player number of (Triggering player))] = 0.00
      • Trigger - Turn on Frozen Orb EFFECTS 01 <gen>
This is the periodic trigger that fires the effects, there will be 12 of these; one for each player, unless I can do it some other way:

  • Frozen Orb EFFECTS 01
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FrozenOrbTime[1] Less than or equal to 3.00
        • Then - Actions
          • Set FrozenOrbLoc[1] = (FrozenOrbLoc[1] offset by 15.00 towards FrozenOrbTravelAngle[1] degrees)
          • Set FrozenOrbBoltTargetLoc[1] = (FrozenOrbLoc[1] offset by (565.00 + (35.00 x (Real(FrozenOrbLevel[1])))) towards FrozenOrbBoltAngle[1] degrees)
          • Unit - Move FrozenOrb[1] instantly to FrozenOrbLoc[1]
          • Unit - Create 1 Dummy_Sorceress for Player 1 (Red) at FrozenOrbLoc[1] facing FrozenOrbBoltAngle[1] degrees
          • Set FrozenOrbBoltCaster[1] = (Last created unit)
          • Unit - Add a 0.25 second Generic expiration timer to FrozenOrbBoltCaster[1]
          • Unit - Set level of Frozen Orb Bolt Visual (Dummy) for FrozenOrbBoltCaster[1] to 1
          • Unit - Create 1 Dummy_FrozenOrb_Target for Player 1 (Red) at FrozenOrbBoltTargetLoc[1] facing FrozenOrbBoltAngle[1] degrees
          • Set FrozenOrbBoltTarget[1] = (Last created unit)
          • Unit - Add a 0.25 second Generic expiration timer to FrozenOrbBoltTarget[1]
          • Unit - Order FrozenOrbBoltCaster[1] to Neutral - Firebolt FrozenOrbBoltTarget[1]
          • Unit - Create 1 Dummy_Sorceress for Player 1 (Red) at FrozenOrbLoc[1] facing FrozenOrbBoltAngle[1] degrees
          • Set FrozenOrbDamageCaster[1] = (Last created unit)
          • Unit - Set level of Frozen Orb Damage (Dummy) for FrozenOrbDamageCaster[1] to FrozenOrbLevel[1]
          • Unit - Hide FrozenOrbDamageCaster[1]
          • Unit - Add a 0.25 second Generic expiration timer to FrozenOrbDamageCaster[1]
          • Unit - Order FrozenOrbDamageCaster[1] to Undead Dreadlord - Carrion Swarm (FrozenOrbLoc[1] offset by 500.00 towards FrozenOrbBoltAngle[1] degrees)
          • Set FrozenOrbBoltAngle[1] = (FrozenOrbBoltAngle[1] + 15.00)
          • Set FrozenOrbTime[1] = (FrozenOrbTime[1] + 0.03)
        • Else - Actions
          • Trigger - Turn off (This trigger)
          • Set FrozenOrbTime[1] = 0.00
Questions:

I am planning to convert the second "Effects" triggers to Jass and use local variables - do you see any leaks right now? I tried to save every unit, location, etc as a UDG in this spell so when I turn it into custom text I won't have leaks.

Is there a better way to make this MUI, besides having a "branching" thing in the first trigger that says something like:

If owner of casting unit = player 1, turn on trigger Effects 01
If owner of casting unit = player 2, turn on trigger Effects 02
If owner of casting unit = player 3, turn on trigger Effects 03
If owner of casting unit = player 4, turn on trigger Effects 04
... etc
 
Level 8
Joined
Apr 30, 2009
Messages
338
Are these timers exact to very low values (0.01), and not retarded like the Wait command?

And really just need to be MPI, since it's an AOS with 1 hero per player.

Also, is "Player Number" the same as "Player Index?" I read somewhere that index starts at 0 and goes to 11, and number goes from 1 to 12, but I couldn't find "get player index" anywhere.
 
Level 8
Joined
Apr 30, 2009
Messages
338
So using JASS timers I could do this with any player without having to have 2 triggers?
 
Level 9
Joined
Nov 4, 2007
Messages
933
Correct, you probably mean a trigger with a periodic event and the other trigger which intitiates the trigger with the periodic event, using timers inside a loop will let you do it in one.
 
Level 8
Joined
Apr 30, 2009
Messages
338
Yeah thats exactly what I want. I just need the loop to be able to execute in very small intervals.

I have only heard of these timers before, is there a good tutorial on using them around here?

So I would need the following variables

JASS:
local player castplay (to create dummy units for)

local location targloc (to find the angle the spell is fired at)
local location orbloc (to set the position of the orb as it moves every 0.03s)
local location boltloc (to create a dummy unit that the ice bolt fires at)

local unit cast (to get the level of the orb)
local unit orb (the orb with locust and a cool model)
local unit boltcast (the dummy on the orb that fires an ice bolt at bolttarg)
local unit bolttarg (target of the ice bolt projectile effect)

local integer olev (to assign ability level to the dummy units)

local real orbangle (the angle which the orb travels at)
local real iceboltangle (the angle which varies over time that determines the direction of each icebolt)
local real orbtime (ends trigger after orb exists for 3.00s)

I have only heard of these timers before, is there a good tutorial on using them around here?
 
Level 6
Joined
Jul 25, 2005
Messages
221
...Why do you want to convert a GUI user into a JASS user. Agreed, making spells MUI is easy with JASS, but that means you'll have to learn new things, like structs, attaching values to handles etc.
But, you don't HAVE to, there are several ways to make GUI spells MUI, and here's one I like:
http://www.hiveworkshop.com/forums/f279/dynamic-values-storage-121558/
Simply put, each instance of the spell is stored in an array and then loops it through if an instance exists, and loops all instances at the same time. Pretty much the same way you do with vJASS structs.

Good luck, whatever way you choose, I'm just bringing up the alternatives.

Keep it simple, and don't bite off more than you can chew.
 
Status
Not open for further replies.
Top