Eusong Posted May 4, 2019 Share Posted May 4, 2019 I'm making a custom character that, when he reads a certain book, gains a x3 damage multiplier. All the other changes to his character that occur when the book is read apply, except the damage modifier. Example: What should happen: Before reading the book, a spider takes 10 punches to kill. After reading, it takes 4. What does happen: Before reading the book, a spider takes 10 punches to kill. After reading, it still takes 10. This is what the code looks like. reader:DoTaskInTime(3, function() reader.sanitytask = reader:DoPeriodicTask(1, function() reader.components.sanity:SetPercent(0) end) reader.soundsname = "wendy" reader.components.talker.colour = Vector3(0, 0, 0) reader.components.talker:Say("GRIMA'S POWER STRENGTHENS ME!") reader.components.combat.damagemultiplier = 3 reader:ListenForEvent("onattackother", OnHenryAttack) reader:AddTag("evil") end) Sanity task properly functions, his voice successfully changes to wendy's, his dialogue color successfully changes, he says the quote, the onattackother event happens, and he gets the evil tag, but the damage multiplier doesn't effect him at all. If anyone can take a look and figure out what's wrong, I'll be forever grateful. Knowing me it's probably something stupidly small but I just can't seem to figure it out. Link to comment Share on other sites More sharing options...
Ultroman Posted May 4, 2019 Share Posted May 4, 2019 There is no such variable as "damagemultiplier" in the DS combat component. There's a playerdamagepercent, though. Link to comment Share on other sites More sharing options...
Eusong Posted May 4, 2019 Author Share Posted May 4, 2019 There isn't...? But...that's the variable Wolfgang uses in DS to change his damage output. o_O I'll try playerdamagepercent when I get back to my computer. Link to comment Share on other sites More sharing options...
Ultroman Posted May 4, 2019 Share Posted May 4, 2019 You have been hit by the difference between original DS and the newer code in the DLCs. In the original DS and RoG, the "damagemultiplier" variable is present, but in SW and Hamlet they instead use inst.components.combat:AddDamageModifier() In order for your mod to be compatible with both DS / RoG and SW / Hamlet, you have to make two versions of the code, and use the appropriate one depending on which version of the game is running, OR just indicate in the modinfo.lua which versions the mod is compatible with. Link to comment Share on other sites More sharing options...
Eusong Posted May 4, 2019 Author Share Posted May 4, 2019 Oooh, ok. ....Still kinda confused but I'll work with it, lol. I'll let you know if it works once I get back to my compy. Link to comment Share on other sites More sharing options...
Eusong Posted May 4, 2019 Author Share Posted May 4, 2019 Added this to the code and it works like a charm if IsDLCEnabled(CAPY_DLC) or IsDLCEnabled(PORKLAND_DLC) then reader.components.combat:AddDamageModifier("evil", 3) else reader.components.combat.damagemultiplier = 3 end Thank you so much! Link to comment Share on other sites More sharing options...
Ultroman Posted May 5, 2019 Share Posted May 5, 2019 Perfect! Good job I would probably save the results of IsDLCEnabled(CAPY_DLC) and IsDLCEnabled(PORKLAND_DLC) in some local variables, to avoid calling them all the time. Just remember to remove the damage modifier again. Link to comment Share on other sites More sharing options...
Recommended Posts
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.