System Status

tooltiperror

Super Moderator
Reaction score
231
It has nothing to do with habit. It's for readability, and consistency.

JASS:

struct __foo_struct

    integer int

    method foo_method ...
        set int=0
    endmethod

endstruct


Now, [ljass]set int=0[/ljass] makes no sense, because there are no variables called int, just [ljass]this.int[/ljass].
 

luorax

Invasion in Duskwood
Reaction score
67
When you compile the script, both versions will become the same script, so it doesn't really matter.
Also yes, using "this" makes the script a bit more readable, also, it depends on the user. Someone likes it, someone doesn't.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Feature suggestion - unit inventory properties: inventory size, can use items, can pick up items, can drop items...
I think this better suits a snippet a few lines long - it's one ability, and the "Set inventory size" would probably inline to SetUnitAbilityLevel for the inventory ability, or close to it.. hm.


JASS:
//! runtextmacro BuffType("StunBuff")
    //! runtextmacro SetBuffName("Stun Buff")
    //! runtextmacro SetBuffAlignment("NEGATIVE")
    //! runtextmacro SetBuffTooltip("This unit is stunned; it can't do anything.")
    //! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNLoad.blp")
//! runtextmacro BuffStruct()
    method onApply takes nothing returns nothing
        call Status[this.unit].addStun()
    endmethod
    method onRemove takes nothing returns nothing
        call Status[this.unit].removeStun()
    endmethod
//! runtextmacro EndBuff()


Just call the next:

JASS:
call StunBuff.create(<YOUR UNIT>).destroyTimed(<YOUR TIME>)


That will work. But you'll need the BuffStruct too.
Flawless Victory! :D

<3 BuffStruct.

Of course, adding the overhead swirly effect is a nice thing to do as well, inside the onApply and onRemove methods. :)
 

Laiev

Hey Listen!!
Reaction score
188
Jesus4Lyf, some friend have a question but don't want to ask, so here it go..

call Status.addStun()
call Status.addStun()
call Status.removevStun()

will remove just one instance of the stun or all?
 

luorax

Invasion in Duskwood
Reaction score
67
JASS:
// Stun
        private integer stunLevel
        method addStun takes nothing returns nothing
            set this.stunLevel=this.stunLevel+1
            if this.stunLevel&gt;0 then
                static if not PERMENANTLY_REVEAL then
                    call UnitShareVision(this.unit,DUMMY_CASTER_OWNER,true)
                endif
                call IssueTargetOrderById(thistype.dummyCaster,OID_STUN,this.unit)
                static if not PERMENANTLY_REVEAL then
                    call UnitShareVision(this.unit,DUMMY_CASTER_OWNER,false)
                endif
            endif
        endmethod
        method removeStun takes nothing returns nothing
            set this.stunLevel=this.stunLevel-1
            if this.stunLevel==0 then
                call UnitRemoveAbility(this.unit,BUFF_STUN)
            endif
        endmethod
        method isStunned takes nothing returns boolean
            return this.stunLevel&gt;0
        endmethod


I think that will remove only one. If you call it two times, your "this.stunLevel" will be 2, one "call Status.removevStun()" will remove 1, while the stun'll be removed at 0.
 

tooltiperror

Super Moderator
Reaction score
231
Do I have to remove all the textmacros after compiling once, or is it like smart?
 

Weep

Godspeed to the sound of the pounding
Reaction score
401
I think this better suits a snippet a few lines long - it's one ability, and the "Set inventory size" would probably inline to SetUnitAbilityLevel for the inventory ability, or close to it.. hm.
A 56 level ability (3 booleans and inventory 0-6 spaces), a struct to track settings, and possibly some code to facilitate preserving items, if changing inventory levels is like changing inventory abilities?
 

DuelPlayer

Member
Reaction score
21
If I use the BuffStruct with Status to make timed stun, then there will be 2 buff when the unit is stunned isnt it??
Then how do i make it 1 buff only?
 

luorax

Invasion in Duskwood
Reaction score
67
1,
JASS:
//! runtextmacro BuffType(&quot;StunBuff&quot;)
    //! runtextmacro SetBuffName(&quot;&quot;)
    //! runtextmacro SetBuffAlignment(&quot;NEGATIVE&quot;)
    //! runtextmacro SetBuffTooltip(&quot;&quot;)
    //! runtextmacro SetBuffIcon(&quot;&quot;)
//! runtextmacro BuffStruct()
    method onApply takes nothing returns nothing
        call Status[this.unit].addStun()
    endmethod
    method onRemove takes nothing returns nothing
        call Status[this.unit].removeStun()
    endmethod
//! runtextmacro EndBuff()


If you call the next, you'll have two buffs, however the second one is going to be near invisible.

2, I couldn't understand it.
 

luorax

Invasion in Duskwood
Reaction score
67
But as I said (showed), if you set the icon of the buff to "" and set its name & description to "" too, then when you move your cursor over the buff, you'll see an empty window, or the icon and description of the buff before it. If you don't believe me just test it yourself.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Well, unfortunately, it is Status that should not show any buff, but Warcraft III will not allow it.
Jesus4Lyf, some friend have a question but don't want to ask, so here it go..

call Status.addStun()
call Status.addStun()
call Status.removevStun()

will remove just one instance of the stun or all?

It will remove one instance, ie. the unit will still be stunned. :)
Do I have to remove all the textmacros after compiling once, or is it like smart?
You must leave the textmacros in. :)
If I use the BuffStruct with Status to make timed stun, then there will be 2 buff when the unit is stunned isnt it??
Then how do i make it 1 buff only?
Go to the object editor, modify Storm Bolt, and use it with DummyCaster. If you are happy with the buff Status displays, you can just write a TimerUtils thing yourself to manage the stun's duration. Personally, I prefer to recommend just accepting the double buff for ease of code's sake. It's a Warcraft III limitation, as said before. :(
A 56 level ability (3 booleans and inventory 0-6 spaces), a struct to track settings, and possibly some code to facilitate preserving items, if changing inventory levels is like changing inventory abilities?
I've never really experienced a need for this. I'm not sure if it belongs in Status, or not... probably better on its own. :)
 

tooltiperror

Super Moderator
Reaction score
231
Can you add in pushing and pulling?

Although like knockback, it'd be nice to do inside Status since that already deals with managing units.

JASS:

Status[unit].push(integer force, real angle, boolean flag)     // &#039;Knockback&#039;
Status[unit].pull(integer force, real x, real y, boolean flag) // Pull to an angle


Pulling is like pushing, but with a location instead. Simplifies syntax.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Can you add in pushing and pulling?
And deal with collisions, friction, slope acceleration, multiple APIs, etc? Nah.

I thoroughly recommend BuffStruct/Timer32 for pushing/pulling effects. :thup:
It will take 2 minutes to write, and be exactly what you needed. :)

In practise, I could add [LJASS]Status[unit].addSlide(xPerSecond, yPerSecond)[/LJASS]. But it's lame because of things like collision detection and deceleration. Which would then require some other T32 struct to do checks anyway, so why not just add the two lines for movement there, too...
 

Laiev

Hey Listen!!
Reaction score
188
But as I said (showed), if you set the icon of the buff to "" and set its name & description to "" too, then when you move your cursor over the buff, you'll see an empty window, or the icon and description of the buff before it. If you don't believe me just test it yourself.
Better you change the desc/icon/name of buff of the Status things, not from the buff struct.

if you want to remove the buff things from buffstruct, you shoulnt use it
 

Weep

Godspeed to the sound of the pounding
Reaction score
401
Yes, unfortunately you will have the "Stunned" or whatever buff from Status as well... it is a Warcraft III limitation, unless you manually create the buffs, this cannot be avoided as far as I know. :)
I have for your consideration a way to stun without a buff, by stunning twice consecutively with spells having two different buffs. With stun, it seems to interact strangely rather than overwriting normally. I have not tested this extensively.

[edit] OMG, the new upload manager. :eek:
 

Attachments

  • Buffless Stun.w3x
    17.1 KB · Views: 362
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top