by Apeirogon » Sat Feb 24, 2018 4:12 am
When I say "dont rewrite virtual functions" I mean "DONT TOUCH IT AT ALL, and left it pure and innocent as it was".
Like, I want make monster that remember all actors that hit it, pushing it into array "thing that I hate!!!!ONEONE", and pick target to chase from it depending of how much damage each of this actors inflict to it. Like, if caco inflict 30 damage to cyberdemon, imp 44 and player 12, cyberdemon first seek and destroy imp, then caco and only then player. Of course only if some one hit cyberdemon, while he chase player/dont have any target yet.
This can be easily, well....relatively easy, done with overiding damage mobj virtual. But it only works only for this cyberdemon/all actors that inherit from this base actor.
If I want do this for monster from other mod I need copy-paste code from my mod or change inheritance tree in other mod to make it inherit from my "monster base class".
I try do so using inventory items, give out each monster "thing that I hate" token/mark using spawn event handler, but they can get access to owners virtual functions "owner.super.damagemobj (paramethers)".
I focused on pointers, in case if this cant be done exactly as I want, save pointers and damage, to at least have monster that act "You hit me!? DIE!! And you hit me?! DIE!!! And you! And you! Oooo.... I see you come back from dead... I still remeber what you did last summer five minutes ago!!! DIE!!".
Maybe I should write this in first post...but this just example that I came up with one minutes ago...
When I say "dont rewrite virtual functions" I mean "DONT TOUCH IT AT ALL, and left it pure and innocent as it was".
Like, I want make monster that remember all actors that hit it, pushing it into array "thing that I hate!!!!ONEONE", and pick target to chase from it depending of how much damage each of this actors inflict to it. Like, if caco inflict 30 damage to cyberdemon, imp 44 and player 12, cyberdemon first seek and destroy imp, then caco and only then player. Of course only if some one hit cyberdemon, while he chase player/dont have any target yet.
This can be easily, well....relatively easy, done with overiding damage mobj virtual. But it only works only for this cyberdemon/all actors that inherit from this base actor.
If I want do this for monster from other mod I need copy-paste code from my mod or change inheritance tree in other mod to make it inherit from my "monster base class".
I try do so using inventory items, give out each monster "thing that I hate" token/mark using spawn event handler, but they can get access to owners virtual functions "owner.super.damagemobj (paramethers)".
I focused on pointers, in case if this cant be done exactly as I want, save pointers and damage, to at least have monster that act "You hit me!? DIE!! And you hit me?! DIE!!! And you! And you! Oooo.... I see you come back from dead... I still remeber what you did [s]last summer[/s] five minutes ago!!! DIE!!".
Maybe I should write this in first post...but this just example that I came up with one minutes ago...