1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The reforging of the races is complete. Come see the 14th Techtree Contest Results.
    Dismiss Notice
  4. It's time to choose your horse in the race - the 32nd Modeling Contest Poll is up!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Multi-Instancible GUI Spell Making

Discussion in 'Trigger (GUI) Editor Tutorials' started by wyrmlord, May 26, 2007.

  1. Dracula

    Dracula

    Joined:
    Jun 26, 2005
    Messages:
    511
    Resources:
    1
    Maps:
    1
    Resources:
    1
    hmm read alll those til when you explain stacks, which i dont really get, i dont really get what i was reading, i use MUI triggers and i use wait too, but then i dont know how the local variables will work, you said they only work in triggers that doesnt has other functions, and if/then/else are very useful trigger. normally i dont use looping, when i dont understand how a trigger works, its hard to find whats the problem when incounter a bug, so i mostly just copy and paste to repeat the stuff i need.

    well i must say am not really good at triggers, i didnt get much you said.
     
  2. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    I agree 100% with Dracula. The stack system you are trying to explain may be very good, but it is explained in an horrible way. You only give 1 simple example, and you don't explain how the system works globally. I really think you should improve that stack system section of your tutorial because no1 really understands it.

    And i am learning JASS and MUI, i am an expert at GUI. I have to agree with Dracula.

    Another thing, you MUI system does not work properly.... at least it doesn't work in the spell i am learing from Daelin:
    • Seduce
      • Seduce
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Seduce
      • Actions
        • Custom script: local unit udg_SeducedUnit
        • Custom script: local player udg_SeducedPlayer
        • Set SeducedPlayer = (Owner of (Target unit of ability being cast))
        • Set SeducedUnit = (Target unit of ability being cast)
        • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Casting unit)) and Change color
        • Wait 0.10 seconds
        • Wait until ((SeducedUnit has buff Seduce ) Equal to False), checking every 0.10 seconds
        • Unit - Change ownership of SeducedUnit to SeducedPlayer and Change color
        • Set SeducedUnit = No unit
        • Set SeducedPlayer = (Matching player)


    The spell DOES work, however, when i add your codes it just fails everyting. Something is wrong.

    another thing is that you probably are setting you local variables in a wrong way:

    Code (vJASS):
    function Trig_Seduce_Conditions takes nothing returns nothing
    local unit Caster = GetSpellAbilityUnit
    endfunction


    or

    Code (vJASS):
    function Trig_Seduce_Conditions takes nothing returns nothing
    local unit Caster
    set Caster = GetSpellAbilityUnit
    endfunction


    According to one of you JASS tutorials people should declare variables like this. However i am new in JASS so, i think it would be wise for me not to question your knowledge about JASS, because let's face it, you are the professional here wyrmlord. I am just trying to help and i think something is wrong in your tutorial.
     
    Last edited: Aug 14, 2007
  3. CoffinPuppet

    CoffinPuppet

    Joined:
    Oct 7, 2007
    Messages:
    61
    Resources:
    3
    Models:
    3
    Resources:
    3
    Well Pheonix, you mustn't declare that like that. Later on you can save up 1 line if you say something like:
    set local Caster = GetTriggeringUnit
    ----------------------------------
    Wymlord, just a quick Question:
    Is there a way of making Local Variables work in Loops, UnitGroups?
    For example something like this:
    Code (vJASS):
    set local integer NumberofObjects = 6
    set local real Angle = 360.00/(integer(NumberofObjects))
    set local real Distance = 100.00
    set local unit Target = GetTargetUnit

    Then make a GUI Loop:
    • Loops Trigger
    • For Each integer from 1 to NumberofObjects do Actions
      • -Loop
    • Set local location[IntegerA] = at Target in a distance of Distance towards Angle*(Real(IntegerA))

    (Don't remember the Function for the PolarPoint Function in JASS, since I'm a GUIer :p)
     
  4. Razorbrain

    Razorbrain

    Joined:
    Aug 18, 2006
    Messages:
    1,165
    Resources:
    1
    Maps:
    1
    Resources:
    1
    to make local variables work in a loop, you would have to make a Custom Loop
     
  5. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    it is easy to use locals in loops ... just convert it to jass ... nothing easier.
     
  6. Razorbrain

    Razorbrain

    Joined:
    Aug 18, 2006
    Messages:
    1,165
    Resources:
    1
    Maps:
    1
    Resources:
    1
    that is what i was refering too
     
  7. wyrmlord

    wyrmlord

    Joined:
    Oct 13, 2005
    Messages:
    252
    Resources:
    5
    Tools:
    1
    Maps:
    1
    Tutorials:
    3
    Resources:
    5
    Actually, you'll just need a few lines of JASS to create a JASS loop in GUI. Here's how it'd work:
    • Loop
      • Events
      • Conditions
      • Actions
        • Set variable = 0
        • Custom script: loop
        • Custom script: exitwhen udg_variable == 7
        • -------- Put some code here. Local variables are allowed. --------
        • Set variable = (variable + 1)
        • Custom script: endloop


    The "loop" statement tells Warcraft 3 that you're beginning a loop. When the code reaches the "endloop" statement, it will return to the "loop" statement and continue the loop. Now, the exitwhen line is fairly simple. You need some way to tell Warcraft 3 when to exit the loop hence "exitwhen".Following the exitwhen statement is a boolean expression.

    Boolean means true or false. For the boolean expression, you're able to enter either a boolean variable (udg_myBoolean) or a comparison such as "udg_myVar == 6". When comparing two terms, you're able to use a variety of different symbols to represent different logical expressions. Here are some:
    Code (vJASS):
    udg_someInteger > 5 // Returns true if the integer is greater than 5
    udg_someInteger >= 5 // Returns true if the integer is greater than or equal to 5
    //
    //
    udg_someInteger < 5 // Returns true if the integer is less than 5
    udg_someInteger <= 5 // Returns true if the integer is less than or equal to 5
    //
    //
    udg_someInteger == 5 // Returns true if the integer is equal to 5. Keep in mind that you must use a "==" instead of a "="
    udg_someInteger != 5 // Returns true if the integer is not equal to 5
    //
    //
    // == and != can be used to compare other values that are not numbers such as units or players like so:
    udg_someUnit != udg_someOtherUnit   // Returns true if someUnit is not someOtherUnit. This refers to a specific unit, not a unit type
    //
    //
    //In addition to these expressions, we also have 3 others:
    //
    //
    udg_someInteger == 5 or udg_someInteger < 3   // Returns true if the integer is equal to 5 or less than 3
    //
    //
    udg_someInteger > 0 and udg_someInteger < 10  // Returns true if the integer is greater than 0 and less than 10
    //
    //
    not udg_someInteger > 5     // While this isn't the best example, will return true if the integer is not greater than 5
    //
    // These expressions can be combined in many ways, here's an example:
    //
    not( udg_someInteger == 4 or udg_someInteger == 5 )    // Returns true if the integer is not equal to 4 and not equal to 5.
    //
    // Notice the parenthesis, they are used just like in math. First, the values inside the parenthesis are compared before moving outside of them.


    Sorry for the extra "//" between lines, but otherwise the returns were ignored and it was all squeezed together. I hope this makes sense, but if it doesn't please ask questions.
     
  8. ban-lord

    ban-lord

    Joined:
    May 26, 2007
    Messages:
    204
    Resources:
    2
    Models:
    1
    Tutorials:
    1
    Resources:
    2
    Nice tutorial, but sadly, I PHAIL!

    I get thousands of errors when I add that code into it, but I guess it might be since I'm using loops...>_>
     
  9. CoffinPuppet

    CoffinPuppet

    Joined:
    Oct 7, 2007
    Messages:
    61
    Resources:
    3
    Models:
    3
    Resources:
    3
    Thats cool ^^ Now to Unit groups... Is it possible to make some JASS Lines in Unit Groups, without having it malfunction?
     
  10. wyrmlord

    wyrmlord

    Joined:
    Oct 13, 2005
    Messages:
    252
    Resources:
    5
    Tools:
    1
    Maps:
    1
    Tutorials:
    3
    Resources:
    5
    When picking every unit in a unit group, a separate function is called. You'll be able to create locals inside of the "pick every unit..." loop, but you cannot use locals from outside of it and vise-versa.
     
  11. KaiserG

    KaiserG

    Joined:
    Feb 12, 2008
    Messages:
    207
    Resources:
    0
    Resources:
    0
    really very helpful guide on how to declare and use local variables with GUI... thanks! +REP
     
  12. BagOfChips

    BagOfChips

    Joined:
    Sep 10, 2006
    Messages:
    187
    Resources:
    0
    Resources:
    0
    Looked helpful but I get errors when I do it.