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 havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  4. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  5. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  6. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  7. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  8. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  9. 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.

Making a spell in vJASS - Practice Session 1

Discussion in 'JASS/AI Scripts Tutorials' started by Flame_Phoenix, Jan 21, 2009.

  1. Cheezeman

    Cheezeman

    Joined:
    Aug 19, 2008
    Messages:
    437
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Oh my f**king God. I've been waiting for this since... early april?
    Only 3 weeks to go for the start of the new tutorial.
     
  2. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Then check my project xD

    Thx for the comments btw =P
     
  3. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,167
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Really like this tutorial. Problem: It does not introduce to structs, while they are the best to use at making spells. The whole tutorial is very well written, and I will dl it surely.
     
  4. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    I don't get your point, structs rock for making spells.
    As for the rest, it is not a problem. Struct usage is meant to be covered for lesson 2. In lesson 2 I will also introduce the user to timers as well, and I plan to teach him a few tricks with timers.
    I may also give a "little smell" about modularity =P

    However lesson 2 will take it's time, I will only start making it after day 17 July, the date of (hopefully) my last exam.

    Still, thx for your comment =D
     
  5. onisaiyan808

    onisaiyan808

    Joined:
    Sep 1, 2007
    Messages:
    242
    Resources:
    1
    Spells:
    1
    Resources:
    1
    I have a question. Is the Init function where the Event is?
     
  6. Cheezeman

    Cheezeman

    Joined:
    Aug 19, 2008
    Messages:
    437
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Yep, kind of. InitTrig_ can be compared to Events in GUI, just that you can do alot more with InitTrig_.
     
  7. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Good answer. rep++

    I am working on my second tutorial BUT ... I can't find a decent program to write it ... does anyone know a better program then notepad or notepad++ that indicates when the page laterals is over?
     
  8. Vulcano

    Vulcano

    Joined:
    Mar 8, 2009
    Messages:
    335
    Resources:
    1
    Maps:
    1
    Resources:
    1
    i don't know what page laterals are (english is not my main language). But u can try OpenOffice.org (almost same as office but it's free)
     
  9. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    I know about open office... however it is a main distro for Linux and not Windows =S
     
  10. Vulcano

    Vulcano

    Joined:
    Mar 8, 2009
    Messages:
    335
    Resources:
    1
    Maps:
    1
    Resources:
    1
    it works fine on my windows vista
     
  11. FRAN

    FRAN

    Joined:
    Dec 24, 2008
    Messages:
    1
    Resources:
    0
    Resources:
    0
    nice tuto... i like it... T_T
     
  12. You Win

    You Win

    Joined:
    Jul 20, 2005
    Messages:
    113
    Resources:
    0
    Resources:
    0
    First of all thanks for the tutorial.
    Question:
    I don't understand how it is MUI when you put it as global for non-constant variables. Can you explain that? thanks
     
  13. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    MUI -> Multi unit instanceable. It basicaly means that your spell can be cast by more than 1 unit at the same time without blowing your computer.

    As for the global, happens that the wc3 engine runs using something called threads. A thread is a very low level mechanism that can execute an action or part of an action. Wc3 engine can not run 2 threads at the same time.
    Because we are using the globals groups instantly (meaning we don't use them over time) wc3 engine will run the code 1 thread at a time, thus keeping your spell MUI.
    A simple way of understand what happens that might work is this: You can use global variables such as groups to make your spell MUI as long as you do NOT involve those global variables in ANY time depending mechanisms such as waits. I am not using any time mechanism associated to the global variable, so it is MUI. Also, notice that I try to do all my group code very quickly and very close. All code is imperative and I have no useless instructions in the middle, this also helps.

    I hope you understand why the spell is MUI.
     
  14. You Win

    You Win

    Joined:
    Jul 20, 2005
    Messages:
    113
    Resources:
    0
    Resources:
    0
    Oh ok... thanks for the explanation, I get what you mean =)

    But what if I wanted to use Sleep function? I will have to use the local way which will cause a lot of lags? Is there any alternative way of doing this which will reduce the lag and leak?
     
  15. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    If you use a Sleep function (that is a wait) and a global variable your spell will not be MUI.The problem with sleeps is that they are inaccurate and cause other problems (i can post a link to a thread in wc3c about that if you need). You can use timers instead of TriggerSleepAction, however they are harder to use for most new coders.
     
  16. You Win

    You Win

    Joined:
    Jul 20, 2005
    Messages:
    113
    Resources:
    0
    Resources:
    0
    As far as I know if we use timer, we will be needing another event in another trigger right?
     
  17. Cheezeman

    Cheezeman

    Joined:
    Aug 19, 2008
    Messages:
    437
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    The Magic of Jass: CreateTimer(), StartTimer() and GetExpiredTimer()
    With these you'll need only one event which starts a timer, rather than resumes a timer-event.
    I think Phoenix can help you further with them if you got questions ;)
     
  18. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    to use timers... timers are complex, if you want to use them you will need to use an outisde system and make your spell dependant on that system. I recommend the TimerUtils. It has 3 flavors and you can pick the one you find best.

    I was going to make a 2nd tutorial about timers ... but unfortunately it was not good enough and I never submitted it.
     
  19. You Win

    You Win

    Joined:
    Jul 20, 2005
    Messages:
    113
    Resources:
    0
    Resources:
    0
    Well at first I was planning on using a loop with a sleep function inside which will make a timer. Can you please show me an example by making a skill using timer also? When you are free that is.

    Anyway, I notice that normal WE can't run vJass, and the programs you provide is it the latest version? As in 1.24b?
     
  20. Cheezeman

    Cheezeman

    Joined:
    Aug 19, 2008
    Messages:
    437
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    v5d is the latest as far as I know. Wc3c is a respected site and if you wish to extend your jass knowledge I recommend it over hive.