Completely Replacing In-game Systems?

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
I've been thinking of way to completely replace-and-rebuild the in-game systems (such as HP, mana, gold, combat, etc.), but I can't seem to actually figure out how.

Let's say, for example, I have the following:

JASS:
struct hero[10] // Let's just say we'll only use ten instances... 
    real mana
    real hp
    real damage
endstruct


How would I use that instead of the in-game systems?
 

Laiev

Hey Listen!!
Reaction score
188
well... u can bug the mana and life by setting hight value and then trigger new mana/life with some new bar/text around hero...

also.... u can't disable it i think :/
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
What exactly are you trying to achieve with your own versions of health, mana, gold, combat, etc., or what do you want to change, but still keep?

Are you wanting to keep the health bars for units? Are you wanting to keep the mana pools for units? Are you wanting to keep the mana cost values in the tooltips, etc?

Give us more information. There's a lot of work involved, especially in the combat and movement systems.
 

jrhetf4xb

Member
Reaction score
12
And why would you want to replace something that is already stable enough and will most probably fit your needs?
 

luorax

Invasion in Duskwood
Reaction score
67
Maybe he want's to use a custom rage system, or want to set hp available as spell cost, etc.
 

tooltiperror

Super Moderator
Reaction score
231
It would be rather easy tbh. It's just basic, really. Use Damage, AIDS, Heal, and maybe Timer32.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Tides of Blood is an good example, the coders code all stuffs, like missiles, spell system, etc.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
Sorry for the long wait in the reply. I've been in the car all day (14 hour drive. D: ), and completely forgot I posted this until now.

I'm looking to replace the internal systems, so I can hopefully use JASS to make a more accurate version (along with using structs to do things like unitVar.HP.SetMax(1000)).
I'd also like to do certain things with the attack system that might not be possible with the internal (such as preventing on unit from attacking another unless the other unit has a specific status which is attached using JASS).

@luorax,
I was considering a rage-like system for some units, but I didn't even think of using HP as a mana type for spells. Excellent idea.

@tooltiperror,
As much as I love having all these systems around that add as this wonderful abstraction, I'd like to use as little of them as possible, since I become dependant on the developer of the system to update it, add bug-fixes, new features, and improved stability, whereas if I wrote it, I'd know it's my own code, and therefor, should yell at myself.

@Darthfett,
I'd like to keep all the mana-bars and health-bars, but I realize that may not be possible.
All of the spells are going to be coded to work directly with a specifc unit's instance, so the mana-costs and such aren't going to be much of a problem (at least not yet. :D).
 

jrhetf4xb

Member
Reaction score
12
I still don't fully understand what's your main point but I'll give some advices.
Even if you don't want to use other people's resources, you should at least have a few since they can be really useful. For example, for your bars there is a very neat system at wc3c.net called TTBars which can replace perfectly your health/mana/whatever bars. For scripting custom attack missiles I personally use xemissile (recently posted again at wc3c.net) which allows me to do cool stuff like different projectile models.
Besides, you cannot fully avoid using the in-game systems - you're just going to name them differently but still use them. :)
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
For scripting custom attack missiles I personally use xemissile (recently posted again at wc3c.net)
Kenny's projectile library is lot's better.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
@jrhetf4xb,
Oh the systems are definitely useful, but like I said, I'd prefer to be able to work with the interals of the systems without having to completely rewrite the change to work with any new versions (along with a few other reasons).
 

Ashlebede

New Member
Reaction score
43
That's a lot of work, you'd have to figure most of it yourself.

You can use either custom value(UserData) or a hashtable to attach a struct to a unit.

JASS:
call SetUnitUserData(myUnit,UNIT_STRUCT.create())


You might want to use [ljass]EVENT_PLAYER_UNIT_ATTACKED[/ljass] to detect when a unit is attacked. You can then substract the attacking unit's damage from its struct to the attacked unit's hp from its struct... and trigger all spells. And whenever one of these happens, you can check the unit's struct [ljass]hp[/ljass] stat. If it is smaller than or equal to zero, you can [ljass]call KillUnit()[/ljass]. You might want to make a function or method to damage a unit.

JASS:
struct UNIT_STRUCT[10]
    real hp
    real mana
    real dmg

    unit u //I like to have a reference to the struct's unit
        method DamageUnit takes real dmg returns nothing
            set .hp = .hp-dmg
            if .hp<=0 then
                call KillUnit(.u)
                call this.destroy()
            endif
        endmethod

        method AttackUnit takes UNIT_STRUCT target returns nothing
            set target.hp = target.hp-.dmg
            if target.hp<=0 then
                call KillUnit(target.u)
                call target.destroy()
            endif
        endmethod
endstruct

function foo takes nothing returns nothing
    call MyUnitStruct.DamageUnit(100.)
    call MyUnitStruct.AttackUnit(MyOtherUnitStruct)
endfunction


For mana, just check when a spell is cast using [ljass]EVENT_PLAYER_UNIT_SPELL_CAST[/ljass] to remove some mana from the caster before the spell is used. If the user has enough mana left to cast the spell, then you can proceed. If not, you could interrupt by ordering the unit to stop.

JASS:
function MyFunc takes nothing returns nothing
    local UNIT_STRUCT s = GetUnitUserData(GetTriggerUnit())
    if s.mana<100 then
        call IssueImmediateOrder(GetTriggerUnit(),"stop")
    endif
endfunction


You might have to remove the ability from the unit and re-add it ; that would reset cooldown, though it probably doesn't trigger cooldown.

If you need help figuring out how to make any other stats, tell me.
 

tooltiperror

Super Moderator
Reaction score
231
Ash, again, AIDS would make that all easier.
 

Ashlebede

New Member
Reaction score
43
As much as I love having all these systems around that add as this wonderful abstraction, I'd like to use as little of them as possible, since I become dependant on the developer of the system to update it, add bug-fixes, new features, and improved stability, whereas if I wrote it, I'd know it's my own code, and therefor, should yell at myself.

Oh the systems are definitely useful, but like I said, I'd prefer to be able to work with the interals of the systems without having to completely rewrite the change to work with any new versions (along with a few other reasons).

That's out of the question. Want him to repeat the same thing a third time, tooltiperror, or are you going to help him?
 

tooltiperror

Super Moderator
Reaction score
231
His choice is illogical in the first place, because AIDS has not been know to bug, at all, and I have never run into any problems with, same with Damage. J4L's things are completely reliable.
 

Ashlebede

New Member
Reaction score
43
tooltiperror said:
you are assuming you need tools to do something, only because that is how you do it.

He knows best. See what I did there? I used your own point of view as an argument. :p

Anyways, Lyerae said he didn't want to use those systems, although he knew J4L put a lot of work in them and they are great, fully working and all.
 

D.V.D

Make a wish
Reaction score
73
Warcrafts attack and commands are all pretty much abilities that have different values for every unit based on the data attached to the unit. If you want to rewrite the damage system, you might want to remove wc3's attack ability(if you remove it, you can't add it back). The ID for the attack ability is 'atak' or something along those lines. THe move system in wc3 is better if you just didn't touch it as its probably quicker than anything you can make with jass(im not entirely sure but most maps start to lag a lot when a few hundred units are sliding were as in wc3, a few hundred units can be moving with very little lag).
 

Bribe

vJass errors are legion
Reaction score
67
Yeah, and pathing would be a concern each time the unit moved.
 

Ashlebede

New Member
Reaction score
43
It is probably best to keep the original movement system, indeed. The only reason I would see for replacing it would be having movespeed higher than 522, which would be actually useful only if it can go a lot higher than 522, and should only be triggered in those cases.
 
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