Dodge in Lua files
#1
Wrench 
Hello Ladies & Gentleman!

I've been searching through the *.lua files for several days. I can't find any clues on how the game checks if you Dodge or not.
My guess was it is somewhere in the playerdamage.lua but I didn't find anything besides this:

Code:
    if dodge_roll < dodge_value then
        if attack_data.damage > 0 then
            self:_send_damage_drama(attack_data, 0)
        end

        self:_call_listeners(damage_info)
        self:play_whizby(attack_data.col_ray.position)
        self:_hit_direction(attack_data.attacker_unit:position())

        self._next_allowed_dmg_t = Application:digest_value(pm:player_timer():time() + self._dmg_interval, true)
        self._last_received_dmg = attack_data.damage

        managers.player:send_message(Message.OnPlayerDodge)

        return
    end


But it seems like this isn't what I'm searching for. Because I tried to print something to the BLT log if the player did dodge, but nothing happened! :O
Also tried some other things in the playerdamage.lua, no luck!
I'm fed up with searching through code & tiptoeing in the dark. I need an Adult right now! [Image: emoticon_happy.png]
Really hope someone got an answer, every little bit helps!

Thanks in advance!

Cheers!
Reply
#2
If you're doing this because you want to modify dodge values/chances on a conditional basis, then instead of hooking directly onto whatever function actually calculates dodging in-game your best bet would instead be to hook onto PlayerManager:skill_dodge_chance() - most custom perk decks that have a conditional dodge bonus effect, such as Offyerrocker's Baba Yaga perk deck and my own melee dodge perk deck, do this.

However, if you're looking to have a specific function that runs whenever a player dodges, then I can't really help you because I'm pretty bad at Lua. My best guess would be that, if the function that actually calculates dodge isn't in playerdamage.lua, it's probably in playerstandard.lua or something similar, and if it's not there, then I'm out of guesses. That "Message.OnPlayerDodge" bit in the code snippet you posted makes me think that OVERKILL probably has a function somewhere in playermanager.lua that runs whenever a player dodges which you could probably hook onto all the same, but that's just me spitballing.

For future reference, you should *probably* join the MWS Discord server for smaller-scale help requests - most of the people we have that would actually be able to answer your question (e.g. Offyerrocker, Hoppip, Solo Queue Pixy) are far more active on there than they are in these forums. Not like you're doing anything wrong by posting here, it's just that you're going to get faster and probably better help if you ask over there than if you ask here.
signature text
Reply
#3
(04-16-2019, 06:46 PM)carl ruins everything Wrote: If you're doing this because you want to modify dodge values/chances on a conditional basis, then instead of hooking directly onto whatever function actually calculates dodging in-game your best bet would instead be to hook onto PlayerManager:skill_dodge_chance() - most custom perk decks that have a conditional dodge bonus effect, such as Offyerrocker's Baba Yaga perk deck and my own melee dodge perk deck, do this.

However, if you're looking to have a specific function that runs whenever a player dodges, then I can't really help you because I'm pretty bad at Lua. My best guess would be that, if the function that actually calculates dodge isn't in playerdamage.lua, it's probably in playerstandard.lua or something similar, and if it's not there, then I'm out of guesses. That "Message.OnPlayerDodge" bit in the code snippet you posted makes me think that OVERKILL probably has a function somewhere in playermanager.lua that runs whenever a player dodges which you could probably hook onto all the same, but that's just me spitballing.

For future reference, you should *probably* join the MWS Discord server for smaller-scale help requests - most of the people we have that would actually be able to answer your question (e.g. Offyerrocker, Hoppip, Solo Queue Pixy) are far more active on there than they are in these forums. Not like you're doing anything wrong by posting here, it's just that you're going to get faster and probably better help if you ask over there than if you ask here.

I'm not into modifying values! :)
It's rather playing a function if the player dodged! Just as you said! Also thanks for the answers, I'm thinking about joining the server! Because if you say faster & better help, that's a win but I'm kinda shy! xD
I'm gonna look into all the player/manager stuff & see what I can find in the meantime! Even if it's not there, a closer look isn't a bad Idea maybe I missed something! :D

Thanks for the answer & the information about the discord!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)