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
400
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
400
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: 375
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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