1. Triumph has risen from these uncharted shores. The 34th Modeling Contest Results are out!
    Dismiss Notice
  2. Awaken what lies in the heart of your swarm. The 17th Techtree Contest has arrived!
    Dismiss Notice
  3. The Hive Workshop is launching its first HD modelling contest. How HD should it be?
    Dismiss Notice
  4. Check out the Staff Job Openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Hook. No hooking, but stunning (JASS)

Discussion in 'World Editor Help Zone' started by maxodors, Feb 20, 2021.

  1. maxodors

    maxodors

    Joined:
    Feb 9, 2021
    Messages:
    26
    Resources:
    0
    Resources:
    0
    Here it is
     

    Attached Files:

  2. HerlySQR

    HerlySQR

    Joined:
    Jun 26, 2020
    Messages:
    829
    Resources:
    0
    Resources:
    0
    Ok, I for a strange reason, when I edit your map it happens a very strange bug so I can't test it well; in your code, sorry but I can't find the mistakes, but I told you that you have to reindex even the stuff in the hashtables, like this:
    Code (vJASS):

    set i=1
    loop
        exitwhen i>TG_Counter[TG_Index]
        call SaveUnitHandle(Hash, TG_Loop_Int, i, LoadUnitHandle(Hash, TG_Index, i))
        set i=i+1
    endloop
     
     
    Last edited: Feb 24, 2021 at 11:58 PM
  3. maxodors

    maxodors

    Joined:
    Feb 9, 2021
    Messages:
    26
    Resources:
    0
    Resources:
    0
    Thank you. You helped a lot already. I hope someone else can help me with other points.
     
  4. HerlySQR

    HerlySQR

    Joined:
    Jun 26, 2020
    Messages:
    829
    Resources:
    0
    Resources:
    0
    You're welcome. Well for the multiple instance stun you have an option, use a unit indexer or a hashtable and do
    Code (vJASS):

    //When the unit is stunned
    set Stunners_Number[GetUnitUserData(<Unit stunned>)]=Stunners_Number[GetUnitUserData(<Unit stunned>)]+1 //This is if you use a unit indexer
    call SaveInteger(Table,1,GetHandleId(<Unit stunned>),LoadInteger(Table,1,GetHandleId(<Unit stunned>))+1) //This is if you use a hashtable
    if <Saved integer>==1 then
        //Stun unit
    endif

    ...

    //Stop the stun
    set <Saved integer>=<Saved integer>-1
    if <Saved integer>==0 then
        //Remove stun
    endif
     

    And you don't have to reindex it when the instance is done.
     
  5. maxodors

    maxodors

    Joined:
    Feb 9, 2021
    Messages:
    26
    Resources:
    0
    Resources:
    0
    Anyone can help with the remaining problems?
     
  6. HerlySQR

    HerlySQR

    Joined:
    Jun 26, 2020
    Messages:
    829
    Resources:
    0
    Resources:
    0
    Do you reffer the others than the stack the stun?
     
  7. maxodors

    maxodors

    Joined:
    Feb 9, 2021
    Messages:
    26
    Resources:
    0
    Resources:
    0
    I refer to others.

    Regarding your stun proposition. I do not really understand your solution. Would this allow to stuns run independently of each other? In general, in my map, I want stuns to override each other. However, as this is not a stun, I want it to have its own timer.
     
  8. HerlySQR

    HerlySQR

    Joined:
    Jun 26, 2020
    Messages:
    829
    Resources:
    0
    Resources:
    0
    Ok, I don't understand you, what do you mean with override each other?
     
  9. maxodors

    maxodors

    Joined:
    Feb 9, 2021
    Messages:
    26
    Resources:
    0
    Resources:
    0
    I mean the latest stun takes priority.
     
  10. HerlySQR

    HerlySQR

    Joined:
    Jun 26, 2020
    Messages:
    829
    Resources:
    0
    Resources:
    0
    And that means?...
     
  11. maxodors

    maxodors

    Joined:
    Feb 9, 2021
    Messages:
    26
    Resources:
    0
    Resources:
    0
    I think this a system for stuns which is in wc3 already. Unit A cast a stun on a Target for 3 sec. Then Unit B cast a stun for 2 sec. The target will get 2 sec stun.

    I want it to be like explained here:
    How does Crowd Control stack with each other?

    Unit A cast a stun that has 2 sec. Then Unit B cast a stun that has 3 sec. Every stun has its own timer.
     
  12. HerlySQR

    HerlySQR

    Joined:
    Jun 26, 2020
    Messages:
    829
    Resources:
    0
    Resources:
    0
    If is that, so you don't have to do nothing.