What will affect the damage caused by pets


Recommended Posts

Looking through the files, I found that base_damage and scale both affect NPC attacks.
But Scale is a property of multiple iterations, so that I can't understand it at all.

I tried to use pet:GetAspect("base_damage"):DeltaMax(6) to modify the pet's damage.

Link to comment
Share on other sites

Link to comment
Share on other sites

pet:GetAspect("health"):DeltaMax( TRAIN_HEALTH_INCREASE )
pet:ModifyCombatStrength( 1 )
pet.support_negotiation = pet.trained_support_negotiation
pet:GenerateLocTable()

This is the code for training pet. Maybe that helps?

(They really should make a function to train pets. The code is literally copied and pasted everywhere.)

Link to comment
Share on other sites

50 minutes ago, RageLeague said:

  

这是训练宠物的代码。也许有帮助吗?

(他们确实应该提供训练宠物的功能。该代码实际上是复制并粘贴到任何地方的。)


In fact, the real effect of the second line of code is to increase the monster's display star rating, not to increase the damage. By studying the source code, global variables: fighter scale and temporary variables: Base damage and BUFF_SCALE will affect the pet's battle process.
Now I have two questions. The first point is how to make my mod file overwrite the official file. The second point is that I cannot modify the above two temporary variables while saving.

Link to comment
Share on other sites

I thought the combat strength might modify the base damage, but apparently not.

It seems that base_damage is an attribute associated with an npc card, not a npc. And BUFF_SCALE only affects how much defense an npc gains.

You can't override official files with mod files, but because of the properties of lua, you can easily modify existing methods by assigning a new function to a method.

For example, this is the code I used to modify the method Negotiation.Negotiator:InitBehaviour():

Negotiation.Negotiator.InitBehaviour = function(self)
    -- Override function here.
end

If you want to refer to the old function, assign the old function to a local variable and call the old function using that variable. Otherwise it might cause infinite recursion.

Link to comment
Share on other sites

How can I set two global variables to store BUFF_SCALE AND BASE DAMAGE, so as to avoid the loss of temporary variables every time I leave the game. Not only storage, but also how to enter the correct value into BUFF AND after the game is reloaded DAMAGE.In fact, when the battle is not started, these two variables are nil.
The following picture is my imagination, in fact I can only set BUFF and DAMAGE instead of adding and subtracting.

image.png

image.png

Link to comment
Share on other sites

function Agent:Save()
    local data =
    {
        def = self.def,
        guid = self.guid,
        seed = self.seed,
        money = self.money,
        money_gained = self.money_gained,

        location = self.location,
        location_role = self.location_role,

        nameid = self.nameid,
        custom_names = self.custom_names,
        agent_buckets = self.agent_buckets,
        species = rawget( self, "species" ),
        gender = rawget( self, "gender" ),

        hair_colour = rawget( self, "hair_colour" ),
        voice_actor = rawget( self, "voice_actor" ),
        skin_colour = rawget( self, "skin_colour" ),
        hair_colour = rawget( self, "hair_colour" ),
        build = rawget( self, "build" ),
        head = rawget( self, "head" ),

        removed = self.removed,
        death_data = self.death_data,
        alias = self.alias,

        brain = self.brain,
        plax_slot_id = self.plax_slot_id,
        plax_name = self.plax_name,

        combat_strength_modifier = self.combat_strength_modifier,
        support_negotiation = self.support_negotiation,
        fight_scale = self.fight_scale,
        in_hiding = self.in_hiding,
        death_item_override = self.death_item_override,
        death_money_override = self.death_money_override,
    }

    if self.aspects and self.aspects ~= table.empty then
        data.aspects = self.aspects
    end

    if self.quest_membership and next(self.quest_membership) then
        data.quest_membership = self.quest_membership
    end
    if self.memory and next(self.memory) then
        data.memory = self.memory
    end
    if self.memory_negotiation and next(self.memory_negotiation) then
        data.memory_negotiation = self.memory_negotiation
    end

    if next(self.tags) then
        data.tags = self.tags
    end

    return data
end

This is the code for saving agent. Based on this code, you can add like a custom aspect that can store the power increase. Or like add some tags to the agent, idk.

Link to comment
Share on other sites

4 hours ago, RageLeague said:

function Agent:Save()
    local data =
    {
        def = self.def,
        guid = self.guid,
        seed = self.seed,
        money = self.money,
        money_gained = self.money_gained,

        location = self.location,
        location_role = self.location_role,

        nameid = self.nameid,
        custom_names = self.custom_names,
        agent_buckets = self.agent_buckets,
        species = rawget( self, "species" ),
        gender = rawget( self, "gender" ),

        hair_colour = rawget( self, "hair_colour" ),
        voice_actor = rawget( self, "voice_actor" ),
        skin_colour = rawget( self, "skin_colour" ),
        hair_colour = rawget( self, "hair_colour" ),
        build = rawget( self, "build" ),
        head = rawget( self, "head" ),

        removed = self.removed,
        death_data = self.death_data,
        alias = self.alias,

        brain = self.brain,
        plax_slot_id = self.plax_slot_id,
        plax_name = self.plax_name,

        combat_strength_modifier = self.combat_strength_modifier,
        support_negotiation = self.support_negotiation,
        fight_scale = self.fight_scale,
        in_hiding = self.in_hiding,
        death_item_override = self.death_item_override,
        death_money_override = self.death_money_override,
    }

    if self.aspects and self.aspects ~= table.empty then
        data.aspects = self.aspects
    end

    if self.quest_membership and next(self.quest_membership) then
        data.quest_membership = self.quest_membership
    end
    if self.memory and next(self.memory) then
        data.memory = self.memory
    end
    if self.memory_negotiation and next(self.memory_negotiation) then
        data.memory_negotiation = self.memory_negotiation
    end

    if next(self.tags) then
        data.tags = self.tags
    end

    return data
end

This is the code for saving agent. Based on this code, you can add like a custom aspect that can store the power increase. Or like add some tags to the agent, idk.

emmm, Like this : function Agent:Save(BUFF_SCALE) or function Agent:Save() local data ={Buff=BUFF_SCALE} ? 

Sorry for taking so much time from you to answer my questions. Thank you very much

Link to comment
Share on other sites

7 hours ago, BlueJIN said:

emmm, Like this : function Agent:Save(BUFF_SCALE) or function Agent:Save() local data ={Buff=BUFF_SCALE} ? 

Sorry for taking so much time from you to answer my questions. Thank you very much

This is the function the game calls when it tries to save an agent. So what you want to do is override this function so that it includes the buff scale of the agent, and also override the load function so it reads the buff scale of the agent.

Link to comment
Share on other sites

8 minutes ago, RageLeague said:

这是游戏尝试保存代理时调用的函数。因此,您要做的是覆盖此函数,以便它包括代理的buff比例,还覆盖load函数,以读取代理的buff比例。


After many experiments, I found that base damage and BUFF scale are the attributes that affect all ordinary NPCs, so I decided to cancel the changes and write new pet attributes to overwrite the original pet attributes. This seems to be the most effective method at present.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.