icantevenname Posted April 29, 2017 Share Posted April 29, 2017 Is it possible to increase a character's attack power as they go insane? And speaking of insanity, is it possible to totally drain a character's sanity when using a wormhole? Link to comment Share on other sites More sharing options...
CarlZalph Posted April 29, 2017 Share Posted April 29, 2017 @icantevenname inst:ListenForEvent( "sanitydelta", function(inst, data) inst.components.combat.damagemultiplier = (1.0-inst.components.sanity:GetPercent())*2.0+1.0 end ) From 1.0 to 3.0 damage at 100% sanity to 0% sanity. AddPrefabPostInit( "wormhole", function(inst) if not GLOBAL.TheWorld.ismastersim then return end local onActivate_old = inst.components.teleporter.onActivate inst.components.teleporter.onActivate = function(inst, doer, ...) if doer.prefab == "waxwell" then doer.components.sanity:SetPercent(0) end return onActivate_old(inst, doer, ...) end end ) With waxwell being your character's prefab. Link to comment Share on other sites More sharing options...
icantevenname Posted April 29, 2017 Author Share Posted April 29, 2017 (edited) 1 hour ago, CarlZalph said: @icantevenname inst:ListenForEvent( "sanitydelta", function(inst, data) inst.components.combat.damagemultiplier = (1.0-inst.components.sanity:GetPercent())*2.0+1.0 end ) From 1.0 to 3.0 damage at 100% sanity to 0% sanity. AddPrefabPostInit( "wormhole", function(inst) if not GLOBAL.TheWorld.ismastersim then return end local onActivate_old = inst.components.teleporter.onActivate inst.components.teleporter.onActivate = function(inst, doer, ...) if doer.prefab == "waxwell" then doer.components.sanity:SetPercent(0) end return onActivate_old(inst, doer, ...) end end ) With waxwell being your character's prefab. Thanks for the answer, but I can't use this now. Since the autocompiler isn't even compiling the character I'm working on. Can you or anyone you know help? Nevermind, somehow I made it work again. Edited April 29, 2017 by icantevenname Updating Link to comment Share on other sites More sharing options...
Lumina Posted April 29, 2017 Share Posted April 29, 2017 Probably someone could help. I suggest you to make a new topic with explaination of the problem, .zip of your mod and all that could be useful. And verify first if you can't solve the problem yourself. Usually problems of compiling are because you changed something the wrong way in the character template. One option is to save your work somewhere and use a clean character template so you can at least test the code. Anyway, when you ask very different things (like code and problem of compiling) it's better to do different topics. Link to comment Share on other sites More sharing options...
icantevenname Posted April 29, 2017 Author Share Posted April 29, 2017 1 minute ago, Lumina said: Probably someone could help. I suggest you to make a new topic with explaination of the problem, .zip of your mod and all that could be useful. And verify first if you can't solve the problem yourself. Usually problems of compiling are because you changed something the wrong way in the character template. One option is to save your work somewhere and use a clean character template so you can at least test the code. Anyway, when you ask very different things (like code and problem of compiling) it's better to do different topics. I'll keep that in mind. It's okay now, I managed to get it working. Link to comment 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