Israphelite Posted September 25, 2017 Share Posted September 25, 2017 (edited) So I'm making a character based off the ancient torch wielder. I have all the sprites and basic stats finished but I want her to be able to have clockworks be neutral to her and have her be able to make a tragic torch that scares off hallucinations and damages them when they get in it's light radius. I know this is a lot, but I would really appreciate it if somebody could help. Thank you. Edited September 25, 2017 by Israphelite Link to comment Share on other sites More sharing options...
Israphelite Posted September 25, 2017 Author Share Posted September 25, 2017 By the way this is for DST Link to comment Share on other sites More sharing options...
. . . Posted September 25, 2017 Share Posted September 25, 2017 beautiful Link to comment Share on other sites More sharing options...
Israphelite Posted September 25, 2017 Author Share Posted September 25, 2017 Just now, SuperDavid said: beautiful ??? Link to comment Share on other sites More sharing options...
Toros Posted September 25, 2017 Share Posted September 25, 2017 (edited) The sanity from raw meat being negated is pretty simple with a CustomOnEatFn that restores sanity when you eat those raw meats equivalent to what you'd normally lose. There are more complex implmentations but a quick check to make sure your sanity isn't going to hit the zero lower limit before jumping up higher than it started removes the only edge case for strange behavior. For the clockworks the way I'd do it is give her the ability to craft broken clockworks (relatively cheaply due to the later gear cost), which can be given gears to make them allies. This seems a more reasonable implementation balance wise than clockworks being neutral or allies normally (you wouldn't expect maxwell's clockworks to be friendly) and is the easiest way to implement this perk. Klei probably wouldn't want you to be using the official tragic torch skin on a custom item, but given your spriting abilities making something new with a white flame would be what I recommend. The spell function "scaring" away the shadows/nightmares would be a little difficult to implement since they don't have a state where they flee like say, pigs or bunnies. One option would be to simply remove() shadow and nightmare monsters nearby without having them drop nightmare fuel. It would achieve a very similar effect in the end (maybe have it spawn an fx too when it removes them). Overall though it seems a pretty reasonable thing to implement and I'd be willing to help with the first two parts. Edited September 25, 2017 by Toros Spelling Link to comment Share on other sites More sharing options...
Israphelite Posted September 25, 2017 Author Share Posted September 25, 2017 Thanks, but I don't know how to do those things. I'd like your help though. Could you make some lines of code and then tell me where to paste them? Link to comment Share on other sites More sharing options...
Israphelite Posted September 25, 2017 Author Share Posted September 25, 2017 28 minutes ago, Toros said: The sanity from raw meat being negated is pretty simple with a CustomOnEatFn that restores sanity when you eat those raw meats equivalent to what you'd normally lose. There are more complex implmentations but a quick check to make sure your sanity isn't going to hit the zero lower limit before jumping up higher than it started removes the only edge case for strange behavior. For the clockworks the way I'd do it is give her the ability to craft broken clockworks (relatively cheaply due to the later gear cost), which can be given gears to make them allies. This seems a more reasonable implementation balance wise than clockworks being neutral or allies normally (you wouldn't expect maxwell's clockworks to be friendly) and is the easiest way to implement this perk. Klei probably wouldn't want you to be using the official tragic torch skin on a custom item, but given your spriting abilities making something new with a white flame would be what I recommend. The spell function "scaring" away the shadows/nightmares would be a little difficult to implement since they don't have a state where they flee like say, pigs or bunnies. One option would be to simply remove() shadow and nightmare monsters nearby without having them drop nightmare fuel. It would achieve a very similar effect in the end (maybe have it spawn an fx too when it removes them). Overall though it seems a pretty reasonable thing to implement and I'd be willing to help with the first two parts. Thanks, but I don't know how to do those things. I'd like your help though. Could you make some lines of code and then tell me where to paste them? Link to comment Share on other sites More sharing options...
Toros Posted September 25, 2017 Share Posted September 25, 2017 52 minutes ago, Israphelite said: Thanks, but I don't know how to do those things. I'd like your help though. Could you make some lines of code and then tell me where to paste them? The first and simplest task is mostly just a block of code in the character lua file and a line in the master postinit function. The line in the postinit would be: inst.components.eater:SetOnEatFn(OnEat) and the block of code that should be above it with the other functional blocks would be something like: local function OnEat(inst, food) --check for sanity being above 0 goes here if food and ((food.prefab == "meat") or (food.prefab == "plantmeat") or (food.prefab == "smallmeat") or (food.prefab == "smallmeat")) then inst.components.sanity:doDelta(10) end --end if you have the previous check in place end Link to comment Share on other sites More sharing options...
Israphelite Posted September 25, 2017 Author Share Posted September 25, 2017 Ugh, still too complicated for me. Sorry, I'm a idiot. Can you just like, put a simple code in that negates sanity loss from raw meats and lichen? I'll be able to post it in the two folders then and I can move on from there. Link to comment Share on other sites More sharing options...
Israphelite Posted September 25, 2017 Author Share Posted September 25, 2017 Here, let me send you the files and maybe you can put the codes in and send them back? I'll credit you as a author for the mod if you can do it. Maybe add the whole "not aggroing to clockworks thing" too? I'm a big noob when it comes to coding but I can get the basics done. Sorry for the trouble. I should be able to make the torch by myself. Instead of scaring the nightmare creatures, I'll just have it do massive damage to them. wollax.lua wollax_none.lua modmain.lua Link to comment Share on other sites More sharing options...
spideswine Posted September 26, 2017 Share Posted September 26, 2017 11 hours ago, Toros said: The spell function "scaring" away the shadows/nightmares would be a little difficult to implement since they don't have a state where they flee like say, pigs or bunnies. Isn't this EXACTLY what was discussed here? AddBrainPostInit("nightmarecreaturebrain", function(self) GLOBAL.table.insert(self.bt.root.children, 1, GLOBAL.RunAway(self.inst, "scarydoctor", 5, 8)) end) Just replace "scarydoctor" with whatever tag you want added when you equip the new torch, and it should work... I think. Link to comment Share on other sites More sharing options...
Israphelite Posted September 26, 2017 Author Share Posted September 26, 2017 (edited) Seems simple enough. I'll use that on the torch thing once I get to it. More focused on making the clockworks neutral to my character though. Thanks though! I really appreciate the help! Edited September 26, 2017 by Israphelite Link to comment Share on other sites More sharing options...
spideswine Posted September 26, 2017 Share Posted September 26, 2017 local function REEE(inst) if inst.components.combat and inst.components.combat.targetfn then local _onstartdrying = inst.components.combat.targetfn local function onstartdrying(inst) return _onstartdrying(inst) and (((not _onstartdrying(inst):HasTag("bearded")) or nil) and _onstartdrying(inst)) end inst.components.combat.targetfn= onstartdrying end end AddPrefabPostInit("bishop", REEE) This should hopefully make things neutral to things with the "bearded" tag(so change that tag to some tag your character will have), add the last line to any other prefab you want neutral to you, currently it's for the bishop, so for the rook add: AddPrefabPostInit("rook", REEE) Link to comment Share on other sites More sharing options...
Israphelite Posted September 26, 2017 Author Share Posted September 26, 2017 5 hours ago, spideswine said: local function REEE(inst) if inst.components.combat and inst.components.combat.targetfn then local _onstartdrying = inst.components.combat.targetfn local function onstartdrying(inst) return _onstartdrying(inst) and (((not _onstartdrying(inst):HasTag("bearded")) or nil) and _onstartdrying(inst)) end inst.components.combat.targetfn= onstartdrying end end AddPrefabPostInit("bishop", REEE) This should hopefully make things neutral to things with the "bearded" tag(so change that tag to some tag your character will have), add the last line to any other prefab you want neutral to you, currently it's for the bishop, so for the rook add: AddPrefabPostInit("rook", REEE) Agh, I hate to have keep asking stuff but which prefabs and stuff do I paste this in? My character's lua? A new document? The bishop's .brain? I'm so sorry. I'm a hassle. Link to comment Share on other sites More sharing options...
spideswine Posted September 26, 2017 Share Posted September 26, 2017 The mod main Link to comment Share on other sites More sharing options...
Israphelite Posted September 26, 2017 Author Share Posted September 26, 2017 (edited) Good news, I got it working! Now I just need to get her to be immune to sanity loss from meat. I got some help from a friend. I managed to make the clockworks passive by going in the LUA file for my character and pasting inst:AddTag("chess") under the master_postinit Edited September 26, 2017 by Israphelite Link to comment Share on other sites More sharing options...
. . . Posted September 26, 2017 Share Posted September 26, 2017 If you want your character to not take Sanity penalty from raw meat then put this inside YOURCHARACTER.lua inside the master_postinit Spoiler inst.components.eater.Eat_orig = inst.components.eater.Eat function inst.components.eater:Eat(food) if food and food.components.edible and food.components.edible.foodtype == FOODTYPE.MEAT and self:CanEat(food) then if food.components.edible.sanityvalue < 0 then food.components.edible.sanityvalue = 0 end end return inst.components.eater:Eat_orig(food) end Link to comment Share on other sites More sharing options...
spideswine Posted September 26, 2017 Share Posted September 26, 2017 4 minutes ago, SuperDavid said: If you want your character to not take Sanity penalty from raw meat then put this inside YOURCHARACTER.lua inside the master_postinit Hide contents inst.components.eater.Eat_orig = inst.components.eater.Eat function inst.components.eater:Eat(food) if food and food.components.edible and food.components.edible.foodtype == FOODTYPE.MEAT and self:CanEat(food) then if food.components.edible.sanityvalue < 0 then food.components.edible.sanityvalue = 0 end end return inst.components.eater:Eat_orig(food) end Well this has been bothering me for a while, so I'd greatly appreciate it if you answered it, but what would happen if he placed it in common_postinit instead? Just what exactly is the difference if you place something before if not TheWorld.ismastersim then return inst end compared to after it? what happens if you place it in the wrong place? Link to comment Share on other sites More sharing options...
. . . Posted September 26, 2017 Share Posted September 26, 2017 1 minute ago, spideswine said: Well this has been bothering me for a while, so I'd greatly appreciate it if you answered it, but what would happen if he placed it in common_postinit instead? Just what exactly is the difference if you place something before if not TheWorld.ismastersim then return inst end compared to after it? what happens if you place it in the wrong place? It's a bunch of stuff to do with servers & clients communicating with eachother & clients & server don't all share the same stuff for example only the server has access to components while clients don't, but I don't really know about a lot so I can't really answer your question unfortunately , sorry ! Link to comment Share on other sites More sharing options...
Lumina Posted September 26, 2017 Share Posted September 26, 2017 28 minutes ago, spideswine said: Just what exactly is the difference if you place something before if not TheWorld.ismastersim then return inst end compared to after it? what happens if you place it in the wrong place? All people that are client of the server will crash if the code contains things that should be server side only (usually, component). Link to comment Share on other sites More sharing options...
spideswine Posted September 26, 2017 Share Posted September 26, 2017 1 minute ago, Lumina said: All people that are client of the server will crash if the code contains things that should be server side only (usually, component). Ok, first of all: thanks. Second: what If I add something like a tag(which is generally added prior to the mastersim check) only after the mastersim check, what would happen then? Link to comment Share on other sites More sharing options...
Lumina Posted September 26, 2017 Share Posted September 26, 2017 1 minute ago, spideswine said: Second: what If I add something like a tag(which is generally added prior to the mastersim check) only after the mastersim check, what would happen then? I guess (but i'm not sure) that the tag will work only for the player hosting the server (if there is one), creating bug and stuff not working properly. Link to comment Share on other sites More sharing options...
Israphelite Posted September 26, 2017 Author Share Posted September 26, 2017 Does this apply to lichens also? Durians are pretty boring so I don't care if they take sanity away. 37 minutes ago, spideswine said: Well this has been bothering me for a while, so I'd greatly appreciate it if you answered it, but what would happen if he placed it in common_postinit instead? Just what exactly is the difference if you place something before if not TheWorld.ismastersim then return inst end compared to after it? what happens if you place it in the wrong place? Link to comment Share on other sites More sharing options...
spideswine Posted September 26, 2017 Share Posted September 26, 2017 (edited) 5 minutes ago, Lumina said: I guess (but i'm not sure) that the tag will work only for the player hosting the server (if there is one), creating bug and stuff not working properly. the thing is I've added tags...and components to prefabs post init(addprefabpostinit), without refering to the mastersim and they all worked out fine, both with me hosting/others hosting. I'm just really confused about that thing at this point. Edited September 26, 2017 by spideswine Link to comment Share on other sites More sharing options...
Israphelite Posted September 26, 2017 Author Share Posted September 26, 2017 Oops meant to send your line of code that allows my character to eat meat safely. 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