Fancy_Fox_Pers Posted February 7, 2017 Share Posted February 7, 2017 Does anyone know why my "pet beefalo" makes the game crash when it attacks? It essentially uses the old beefalo file and a custom brain (before you could ride it) but the new stategraph (since I did not duplicate that one at the time). The log says: [00:01:19]: [string "scripts/components/combat.lua"]:659: attempt to perform arithmetic on local 'basedamage' (a table value) LUA ERROR stack traceback: scripts/components/combat.lua:659 in (method) CalcDamage (Lua) <621-664> scripts/components/combat.lua:821 in (method) DoAttack (Lua) <776-850> scripts/stategraphs/SGBeefalo.lua:465 in (field) fn (Lua) <465-465> scripts/stategraph.lua:568 in (method) UpdateState (Lua) <536-580> scripts/stategraph.lua:607 in (method) Update (Lua) <599-627> scripts/stategraph.lua:125 in (method) Update (Lua) <109-148> scripts/update.lua:209 in () ? (Lua) <150-223> Attached files client_log.txt beefalofollower.lua followerbrain.lua Alternatively, if you knew a better way to befriend Beefalos, that would be very welcome (without having to domesticate/make a copy of the prefab files like I did) Link to comment https://forums.kleientertainment.com/forums/topic/73888-crash-when-pet-attacks/ Share on other sites More sharing options...
Lumina Posted February 7, 2017 Share Posted February 7, 2017 I found this code : if weapon ~= nil then --No playermultiplier when using weapons basedamage = weapon.components.weapon.damage or 0 playermultiplier = 1 else basedamage = self.defaultdamage playermultiplier = playermultiplier and self.playerdamagepercent or 1 if self.inst.components.rider ~= nil and self.inst.components.rider:IsRiding() then local mount = self.inst.components.rider:GetMount() if mount ~= nil and mount.components.combat ~= nil then basedamage = mount.components.combat.defaultdamage basemultiplier = mount.components.combat.damagemultiplier bonus = mount.components.combat.damagebonus end local saddle = self.inst.components.rider:GetSaddle() if saddle ~= nil and saddle.components.saddler ~= nil then basedamage = basedamage + saddle.components.saddler:GetBonusDamage() end end end return basedamage * (basemultiplier or 1) * (multiplier or 1) * playermultiplier * pvpmultiplier + (bonus or 0) end In combat.lua Maybe it's related to the fact that beefalo (normal) could have special modificator (modifiers ? things that modify the value of "basedamage") and your code still have part of this and it make crash because it can't properly calculate the value ? Not sure... Good luck anyway ! Link to comment https://forums.kleientertainment.com/forums/topic/73888-crash-when-pet-attacks/#findComment-864619 Share on other sites More sharing options...
alainmcd Posted February 7, 2017 Share Posted February 7, 2017 Line 91 in your beefalofollower.lua: inst.components.combat:SetDefaultDamage(TUNING.BEEFALO_DAMAGE) TUNING.BEEFALO_DAMAGE is (now) a table, look at tuning.lua (lines 580-586 in the main branch, lines 581-587 in the beta). Link to comment https://forums.kleientertainment.com/forums/topic/73888-crash-when-pet-attacks/#findComment-864620 Share on other sites More sharing options...
Fancy_Fox_Pers Posted February 7, 2017 Author Share Posted February 7, 2017 52 minutes ago, alainmcd said: Line 91 in your beefalofollower.lua: inst.components.combat:SetDefaultDamage(TUNING.BEEFALO_DAMAGE) TUNING.BEEFALO_DAMAGE is (now) a table, look at tuning.lua (lines 580-586 in the main branch, lines 581-587 in the beta). Perfect! Fixed it, thanks! Link to comment https://forums.kleientertainment.com/forums/topic/73888-crash-when-pet-attacks/#findComment-864643 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now