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

[Trigger] How would i make this mui..?

Status
Not open for further replies.
Okay so when i do cast this with more than one unit it explodes and damages the one that casted it second... heres the triggers

  • Spirit Bomb
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spirit Bomb
    • Actions
      • Set CO_SpiritCaster[(Player number of (Owner of (Casting unit)))] = (Casting unit)
      • Set CO_SpiritCastPoint[1] = (Target point of ability being cast)
      • Set CO_SpiritTerrain = (Terrain type at (Target point of ability being cast))
      • Unit - Pause CO_SpiritCaster[(Player number of (Owner of (Casting unit)))]
      • Unit - Add Fly to CO_SpiritCaster[(Player number of (Owner of (Casting unit)))]
      • Unit - Remove Fly from CO_SpiritCaster[(Player number of (Owner of (Casting unit)))]
      • Animation - Play CO_SpiritCaster[(Player number of (Owner of (Casting unit)))]'s spell animation
      • Animation - Change CO_SpiritCaster[(Player number of (Owner of (Casting unit)))]'s animation speed to 10.00% of its original speed
      • Unit - Create 1 Spirit Bomb for (Owner of CO_SpiritCaster[(Player number of (Owner of (Casting unit)))]) at (Position of CO_SpiritCaster[(Player number of (Owner of (Casting unit)))]) facing (Facing of CO_SpiritCaster[(Player number of (Owner of (Casting unit)))]) degrees
      • Set CO_SpiritBomb = (Last created unit)
      • Unit - Add Fly to CO_SpiritBomb
      • Unit - Remove Fly from CO_SpiritBomb
      • Animation - Change CO_SpiritCaster[(Player number of (Owner of (Casting unit)))] flying height to 260.00 at 500.00
      • Animation - Change CO_SpiritBomb flying height to 500.00 at 500.00
      • Floating Text - Create floating text that reads Give me your energy... above CO_SpiritCaster[(Player number of (Owner of (Casting unit)))] with Z offset 0.00, using font size 10.00, color (50.00%, 50.00%, 100.00%), and 10.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
      • Wait 0.50 seconds
      • Animation - Change CO_SpiritBomb's size to (200.00%, 200.00%, 200.00%) of its original size
      • Wait 0.50 seconds
      • Animation - Change CO_SpiritBomb's size to (300.00%, 300.00%, 300.00%) of its original size
      • Wait 0.50 seconds
      • Floating Text - Create floating text that reads Spirit... above CO_SpiritCaster[(Player number of (Owner of (Casting unit)))] with Z offset 0.00, using font size 10.00, color (50.00%, 50.00%, 100.00%), and 10.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Animation - Change CO_SpiritBomb's size to (400.00%, 400.00%, 400.00%) of its original size
      • Wait 0.50 seconds
      • Animation - Change CO_SpiritBomb's size to (500.00%, 500.00%, 500.00%) of its original size
      • Wait 0.50 seconds
      • Floating Text - Create floating text that reads BOMB! above CO_SpiritCaster[(Player number of (Owner of (Casting unit)))] with Z offset 0.00, using font size 10.00, color (50.00%, 50.00%, 100.00%), and 10.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Unit - Order CO_SpiritBomb to Move To ((Position of CO_SpiritCaster[(Player number of (Owner of (Casting unit)))]) offset by 1000.00 towards (Facing of CO_SpiritCaster[(Player number of (Owner of (Casting unit)))]) degrees)
      • Unit - Add a 2.00 second Generic expiration timer to CO_SpiritBomb
      • Wait 1.99 seconds
      • Special Effect - Create a special effect at (Position of CO_SpiritBomb) using NuclearExplosion.mdx
      • Animation - Change CO_SpiritCaster[(Player number of (Owner of (Casting unit)))] flying height to 0.00 at 500.00
      • Unit - Unpause CO_SpiritCaster[(Player number of (Owner of (Casting unit)))]
      • Animation - Change CO_SpiritCaster[(Player number of (Owner of (Casting unit)))]'s animation speed to 100.00% of its original speed
      • Unit - Cause CO_SpiritBomb to damage circular area after 0.00 seconds of radius 700.00 at (Position of CO_SpiritBomb), dealing 500.00 damage of attack type Spells and damage type Normal
      • Destructible - Pick every destructible within 700.00 of (Position of CO_SpiritBomb) and do (Destructible - Kill (Picked destructible))
I know the spirit bomb needs to be an array but i dont know what i would set it as..
 
Level 8
Joined
Oct 28, 2007
Messages
435
Jip...just make it mui with local variables like this... First make your ariables non-array variables...

Then add the following at the start of your trigger
  • Actions
  • Custom Script - local unit udg_CO_SpiritCaster
  • Custom Script - local location udg_CO_SpiritCastPoint
  • Custom Script - local terraintype udg_CO_SpiritTerrain
  • Custom Script - local unit udg_CO_SpiritBomb

you can now leave the rest of your trigger how it currently is...

At the end just add the following (this just removes all the leaks)

  • Actions
  • Custom Script - set udg_CO_SpiritCaster=null
  • Custom Script - call RemoveLocation(udg_CO_SpiritCastPoint)
  • Custom Script - set udg_CO_SpiritCastPoint=null
  • Custom Script - set udg_CO_SpiritBomb=null
  • Custom Script - set udg_CO_SpiritTerrain=null
If it gives a compile error I messed up my variables...never used Terrain Type before....:confused:

Basically what I did is I created local variables with the same names as your global variables...local variables are looked at first...So you can still use your normal gui...but now you have local variables...Actually I would really advise you to read that tutorial...
 
Level 8
Joined
Oct 28, 2007
Messages
435
Have you tried it ... Because it DOES....(Sorry)...

Its an old trick....

JASS Syntax looks first at Local variables

Note I said he should add this at the beginning!

  • Actions
  • Custom Script - local unit udg_CO_SpiritCaster
  • Custom Script - local location udg_CO_SpiritCastPoint
  • Custom Script - local terraintype udg_CO_SpiritTerrain
  • Custom Script - local unit udg_CO_SpiritBomb
What this does is make local variables with the same names as his Globals...which cause the GLOBALS to be ignored and the trigger to use the LOCALS instead...Its a very old trick and very useful if you are a gui user and still want to use local variables...

I thought the tutorials linked was another tutorial....There was a tutorial on smart gui methods for making MUI spells here somewhere...but can't find it...
 
Level 9
Joined
Apr 3, 2008
Messages
700
What dis does is make local variables with the same names as his Globals...which cause the GLOBALS to be ignored and the trigger to use the LOCALS instead...

False.
1. Globals can't have the same names as locals if they were created in GUI variables editor.
Because they'll have "udg_" prefix, what means user-difined globals.
If you want to remove that prefix you have to create global variables on Jass.

2. I think that if 2 variables will get same names, both of them won't work, or editor will crash.
 
Level 8
Joined
Oct 28, 2007
Messages
435
Uhh note I named the veriables udg_"veriable name"...and you can do this.... I have done it several times before....

Wait I'll post a map... where I did it....

Edit: Here is a uber lame spell example.....
 

Attachments

  • YOU CAN DO IT!!!.w3x
    17 KB · Views: 45
Last edited:
Level 8
Joined
Oct 28, 2007
Messages
435
But locals can have the same name as globals. And that's what he's doing.

But I think you can only have 1 local with the same identifier as a global variable in a GUI trigger. All others won't work.

Sorry I had no idea you could only have one....I'll play around with the local variables to see if this is true...but beforehand I'm sorry... I was 100% sure you could do this but never had to use more than 1 local veriable in gui...since I never had the need to....so ... (man Gui sucks)


In the case that you can only use one LOCAL variable in a trigger as Eleandor said... I would suggest you make the spell then using only the one local variable which stores the orb...The location can then be obtained by getting the position of the orb... You can also store some data into the orb's custom value....It is possible if you want... I could write a basic function for you that allows you to store the any type of variable in the custom value of the orb...and then get it back later... (basically just Convert Handle to Int and Int to Handle or the like...) I would then store the caster of the spell on the orb...

If you want I could do this for you?
 
Last edited:
Status
Not open for further replies.
Top