• 🏆 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!

[vJASS] Interface questions

Status
Not open for further replies.
Level 11
Joined
Apr 6, 2008
Messages
760
Hi, i have a question about interfaces first time im working with them and i realised one thing.

look here

JASS:
interface Interfaces

real HP

endinterface

JASS:
struct SomeSystem

Interfaces F

    static method create takes Interfaces F returns thistype
        local thistype this = thistype.allocate()

        set this.F = F
  
        return this
    endmethod
    

    static method callback takes nothing returns nothing
        //Stuff to get the correct Struct instance

        set this.F.HP = this.F.HP - 1 //What will happen if the Spell dont have the real HP?

        if this.F.HP <= 0 then //What will happen here?
        else
        endif
endstruct

JASS:
struct SomeSpell extends Interfaces

SomeSystem SS

    static method create takes nothing returns thistype
        local thistype this = thistype.allocate()

        set this.SS = SomeSystem.create(this)
  
        return this
    endmethod

endstruct

So as you can see in the spell there is no real 'HP', what will happen when i try to mix with that in the system (Check the callback function)?
 
Status
Not open for further replies.
Top