• 🏆 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!
Chaosy
Reaction score
740

Profile posts Latest activity Postings Experience Albums Resources About Medals

  • I once believed GUI is good but trust me it is not; JASS is a new thing to you and that's why you find it hard. As a proof, I will use your function:


    function IsDestructableTree takes destructable d return boolean
    call IssueTargetOrder( ISD_dummy, "harvest", d )
    if GetUnitCurrentOrder(ISD_dummy) == String2OrderIdBJ("harvest") then
    return true
    endif
    return false
    endfunction


    As for your GUI one when converted to JASS:


    function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    endfunction

    function Trig_IsDestructableTree_Func002C takes nothing returns boolean
    if ( not ( GetUnitCurrentOrder(ISD_dummy) == String2OrderIdBJ("harvest") ) ) then
    return false
    endif
    return true
    endfunction

    function IsDestructableTree takes destructable d returns boolean
    call IssueTargetDestructableOrder( ISD_dummy, "harvest", d )
    if ( Trig_IsDestructableTree_Func002C() ) then
    call IssueImmediateOrderBJ( ISD_dummy, "stop" )
    return true
    else
    endif
    return false
    endfunction
    Return must be at the end of the function.
    1) your then actions have a function then the return line
    2) else actions not needed, remove the line outside the if statement

    If you want to learn more about your error then convert this to custom text and see how your function is missing its returns.

    p.s. GUI really, really, sucks.
    I guess you mean something like:

    function any_func takes nothing returns boolean b

    If so, then no it is not allowed, however you are not restricted with something like that:

    function another_func takes nothing returns boolean
    // some stuff
    return false
    endfunction
    you could possibly say:
    function integer_func takes integer i returns boolean
    // some stuff
    return i == 6
    endfunction
    Make the dummy invulnerable.

    Dummy and hashtable are quite general variable names. I recommend that you change them to something more descriptive like harvester and detecttreeht.

    Remove the Game - display text messages from the system, you could rather have them in a trigger example. The way 2 could also set a boolean, that you then check in the demo trigger, and there you can print the messages.
    I'm pretty sure you don't have to move the dummy. Just order it to harvest and the check the current order. If the order is "harvest", then it was a tree.
    Sorry for not being clear, I meant to say that Magtheridon96 in his review uses the other system, with the dummy unit.

    If you post both systems (the dummy harvester and the hashtable one) in one package, then the resource will most likely be approved. Users can then decide which system to use.
    No problem :) .If you like, you could also take a look at the tutorials on the site they could add something new as well.
    not exactly u, whats important is that what is between the " () " is of a unit type because when you made the function need an argument of unit type.

    Lets assume you have a paladin on the map (preplaced units takes a variable like that: gg_unit_Hpal_0001) so you could say:

    call restoreUnit(gg_unit_Hpal_0001)

    Now when this function is called the parameter u is set (equal to) gg_unit_Hpal_0001 so anything inside this function that uses u will actually be using gg_unit_Hpal_0001
    it is not taking random unit, you see the part in the function "unit u" is called an argument.

    when you say:

    function func1 takes unit u returns nothing

    this means that when you call this function you must put the right parameters which is unit.

    An example:


    function restoreUnit takes unit u returns nothing
    call SetUnitState(u, UNIT_STATE_LIFE, 500)
    endfunction
    Now, in another function


    function healingSpell_Actions takes nothing returns nothing
    call restoreUnit( GetSpellAbilityUnit() )
    endfunction
    as you can see in the previous function we called the top function by its right arguments, when the top function is called now its parameter u is set to GetSpellAbilityUnit() [which is the unit that the spell was cast on]
    what do you mean by "accept every unit but I want it to accept unit u only and nothing else"
    Wtf.. I wil re-send you the msg, please notify me if you don't get the map again. :eekani:
    libs are good for wrapping all your code inside something.
    You use functions inside them. Methods are used inside structs.

    In JASS, you can't call a function if it's declared under, so we need libraries to change the order of the functions :eek:

    library A requires B
    endlibrary
    library B
    endlibrary

    In this snippet, the library A requires the library B, so all the code inside B will be moved above the code inside A, allowing the map to compile correctly :D
    This class is aimed at GUIers mostly :D
    JASSers can still benefit because they might gain knowledge that they were not aware of :p
    structs just change the syntax of how your system is used, they don't add anything extra. I like to work in structs because they allow me to group up common functions/variables together. They also allow you to make some functions/fields private. This makes the system easier to lay out and debug : ).

    If you look at my systems, that's exactly how I use structs.

    Whenever you are doing instancing, you also want to use structs as they allow you to easily tie fields together with an instance =).

    Would you rather do set myVarForGroup[instance] = 5, or set groupInstance.var = 5?
    Sorry do not understand what you mean...

    If you read wikipedia you will find a local is stored on the thread stack rather than a global which is stored in the process heap. This means that once the stack frame is popped for a thread the locals and their values contained in it are lost.

    A global is a permanently allocated piece of the heap so will never lose its value. In the case of real programming languages where you have geniuine cocurrent threads then care has to be taken with globals to make sure values remain consistent between threads (such as atomic opperations). Both StarCraft II and WarCraft III do not have real cocurrent threads in their trigger engine and instead have virtual threads that are run sequentially of a single genuine thread so this is not a problem.
  • Loading…
  • Loading…
  • Loading…
  • Loading…
  • Loading…
  • Loading…
  • Loading…
Top