The Noon Fish Posted November 1, 2015 Share Posted November 1, 2015 Hey, so uhi tried to make this mod for halloweenthat basically lets wilson and the gang(excluding woodie for obvious reasons) take on some characteristics of certain inhabitants of the Don't Starve universe, but i kinda hit a dead end with the listen for event thing that triggers it (i think)i should prob try finishig the first mod i made, but i kinda need this because my first mod also deals with the transformation thing. I had looked at Woodie's prefab, but i still seem to fail at this (i blame maxwell for this, because basically almost everything is his fault, right? right??)but right now im just focusing on wilson for this mod thing atmif anyone reading this could help me, i would be so happycode:Hallows monster night.zipthe only screenshot i have atm since i cant get wilson to transformTo Do list:Get Wilson to transformHave the transformation trigger on on how naughty you've beenWork on art a little (lot) bit moretry looking at a thing about code again Link to comment Share on other sites More sharing options...
Arkathorn Posted November 1, 2015 Share Posted November 1, 2015 Firstly, I advise you do not directly override the 'wilson.lua' file, and instead use 'AddPrefabPostInit' for all changes.Secondly, I suggest that you write a custom component, as opposed to using beaverness.Thirdly, you should probably add a switch to use 'TriggerKrampusTransformationRoG' when appropriate. Finally, the reason he is not transforming is that the contents of the table passed to 'TriggerKrampusTransformation' are different than you expect.--Pseudocodedata ={ inst = The prefab that was killed cause = A string stating the killer ("wilson")}Use 'data.inst.prefab' to check what was killed. Link to comment Share on other sites More sharing options...
The Noon Fish Posted November 1, 2015 Author Share Posted November 1, 2015 Gettttttt dunked on!oh Link to comment Share on other sites More sharing options...
pickleplayer Posted November 1, 2015 Share Posted November 1, 2015 Honestly I think you'd be fine working with the beaverness component. Some people forget that not everyone is good enough at coding to just up and "learn how to make custom components" on the fly. I tried to do that with my first mod and failed miserably. I'm pretty good with components now, but I found my own ways around stuff back then. You don't need to add a new state to do it with. but you can if you want.Your current method doesn't work because you don't have him transforming into anything. (I think)Don't try to use woodies method of coding for the transformation, it's pretty complicated Check out how I do the code for my character mod "Kaji". Kaji doesn't have any additional stategraph or component stuff (because I didn't know how to do it at the time), it's all done right in his character file. He also has transformations based on beaverness. (it was my first mod so the code is pretty messy and probably poorly written but it works and I commented it with explanations pretty well)http://steamcommunity.com/sharedfiles/filedetails/?id=516929231 here's a quick snippet I grabbed from his code since I have it open--HANDLES MOST OF THE ANIMATION STUFF WHEN KAJI ROARS, CUZ IT WAS TOO MESSY TO HAVE IT ALL IN ONE FUNCTION.local function RoarE(inst) --THERES EVEN SOME CAMERA SHAKE inst:DoTaskInTime(0.3, function(inst) TheCamera:Shake("FULL", 2, .02, 0.3) end) --Camera:Shake(type, duration, speed, scale) inst.SoundEmitter:PlaySound("soundroar/roargroup/roarevent") --THIS ONLY WORKS BECAUSE I ADDED CUSTOM SOUND BUT YOU COULD USE IN-GAME SOUNDS TOO inst.AnimState:SetBank("roary") inst.AnimState:SetBuild("roary") inst:SetStateGraph("SGroary") inst.Transform:SetScale(2.5,2.5,2.5) print("ROAR E")endyou wouldn't actually need to change stategraphs or builds, you would only need to change the bank because your character will be using the same stategraph and build as wilsonso you would just need inst.AnimState:SetBank("krampuswilson") (In mine there is another function that changes him back to his normal self after 2.5 seconds and stuff but you would have a different way of doing that I assume) Also don't forget to import your custom animations at the top of wilson.lua! otherwise his new animations will be invisible!Just add Asset( "ANIM", "anim/krampuswilson.zip" ), to the list of "local_assets" at the top of his page Link to comment Share on other sites More sharing options...
The Noon Fish Posted November 2, 2015 Author Share Posted November 2, 2015 Honestly I think you'd be fine working with the beaverness component. Some people forget that not everyone is good enough at coding to just up and "learn how to make custom components" on the fly. I tried to do that with my first mod and failed miserably. I'm pretty good with components now, but I found my own ways around stuff back then. You don't need to add a new state to do it with. but you can if you want.Your current method doesn't work because you don't have him transforming into anything. (I think)Don't try to use woodies method of coding for the transformation, it's pretty complicated Check out how I do the code for my character mod "Kaji". Kaji doesn't have any additional stategraph or component stuff (because I didn't know how to do it at the time), it's all done right in his character file. He also has transformations based on beaverness. (it was my first mod so the code is pretty messy and probably poorly written but it works and I commented it with explanations pretty well)http://steamcommunity.com/sharedfiles/filedetails/?id=516929231 here's a quick snippet I grabbed from his code since I have it open--HANDLES MOST OF THE ANIMATION STUFF WHEN KAJI ROARS, CUZ IT WAS TOO MESSY TO HAVE IT ALL IN ONE FUNCTION.local function RoarE(inst) --THERES EVEN SOME CAMERA SHAKE inst:DoTaskInTime(0.3, function(inst) TheCamera:Shake("FULL", 2, .02, 0.3) end) --Camera:Shake(type, duration, speed, scale) inst.SoundEmitter:PlaySound("soundroar/roargroup/roarevent") --THIS ONLY WORKS BECAUSE I ADDED CUSTOM SOUND BUT YOU COULD USE IN-GAME SOUNDS TOO inst.AnimState:SetBank("roary") inst.AnimState:SetBuild("roary") inst:SetStateGraph("SGroary") inst.Transform:SetScale(2.5,2.5,2.5) print("ROAR E")endyou wouldn't actually need to change stategraphs or builds, you would only need to change the bank because your character will be using the same stategraph and build as wilsonso you would just need inst.AnimState:SetBank("krampuswilson") (In mine there is another function that changes him back to his normal self after 2.5 seconds and stuff but you would have a different way of doing that I assume) Also don't forget to import your custom animations at the top of wilson.lua! otherwise his new animations will be invisible!Just add Asset( "ANIM", "anim/krampuswilson.zip" ), to the list of "local_assets" at the top of his page theres so much irony in this because i was looking at your mod to begin with(along with the "guy who takes the saying 'you are what you eat' too far" mod) EDIT: forgot to say that the new state is the transformation animation from DST (the one you see when you get a gift and use the new skin you got) unless the beaver transformation thing is already in the stategraph( because i did NOT see it. that or it was in front of my face and my eyes refused to see it) Link to comment Share on other sites More sharing options...
pickleplayer Posted November 3, 2015 Share Posted November 3, 2015 theres so much irony in this because i was looking at your mod to begin with(along with the "guy who takes the saying 'you are what you eat' too far" mod) EDIT: forgot to say that the new state is the transformation animation from DST (the one you see when you get a gift and use the new skin you got) unless the beaver transformation thing is already in the stategraph( because i did NOT see it. that or it was in front of my face and my eyes refused to see it) heh, well that's good cuz that's what I commented it for. So what exactly happens when you try and transform? Anything at all?Have you tried filling your code with print functions to see what parts of the code are being excecuted and what parts arent? Because at a glance, it looks like what you had should have at least played the transformation animation after killing a few animals. Oh I didn't notice you actually already had the swapping banks/builds set up until I looked back at it just now. Does BecomeKrampus(inst) run? If it's not running, try throwing this down in the wilson's file. Right above the line "inst:AddComponent("beard")"put thisinst:ListenForEvent("transform_werebeaver", BecomeKrampus)inst:ListenForEvent("transform_person", BecomeWilson)maybe that will work. If not, then maybe he isn't properly "becoming a werebeaver" Link to comment Share on other sites More sharing options...
The Noon Fish Posted November 3, 2015 Author Share Posted November 3, 2015 heh, well that's good cuz that's what I commented it for. So what exactly happens when you try and transform? Anything at all?Have you tried filling your code with print functions to see what parts of the code are being excecuted and what parts arent? Because at a glance, it looks like what you had should have at least played the transformation animation after killing a few animals. Oh I didn't notice you actually already had the swapping banks/builds set up until I looked back at it just now. Does BecomeKrampus(inst) run? If it's not running, try throwing this down in the wilson's file. Right above the line "inst:AddComponent("beard")"put thisinst:ListenForEvent("transform_werebeaver", BecomeKrampus)inst:ListenForEvent("transform_person", BecomeWilson)maybe that will work. If not, then maybe he isn't properly "becoming a werebeaver"well i tried thatdidn't workbut what i had for making it do delta isn't printing what i wrote, so it's obviously not workingbut i dont know what im doing wrong /);^;/)Hallows monster night.zip Link to comment Share on other sites More sharing options...
pickleplayer Posted November 3, 2015 Share Posted November 3, 2015 well i tried thatdidn't workbut what i had for making it do delta isn't printing what i wrote, so it's obviously not workingbut i dont know what im doing wrong /);^;/)Hallows monster night.zip Is "entity_death" the correct way of listening for creatures deaths? Kramped.lua just listens for "killed" and other stuff butYea I have no idea what's going on in TriggerKrampusTransformation or how it's getting called but instead of trying to replicate a custom component in the character's file. Why not just use the existing naughtiness meter? You can access your character's naughtiness level from the kramped component withinst.components.kramped.actions (at least I think it's actions. the only other variable in there is threshold and it's probably not that) so um try something like this in the character's file: inst:ListenForEvent( "killed", OnKillMurder) and then have the function like thislocal function OnKillMurder(inst) local murderlvl = inst.components.kramped.actions --HOPEFULLY THIS WONT CRASH THE GAME print("MURDER LEVEL =", murderlvl) --THIS IS JUST TO HELP DEBUGGING. IT SHOULD PRINT OUT THE VALUE WHEN YOU KILL SOMETHING inst.components.beaverness:DoDelta(murderlvl) --ADDS THE VALUE TO BEAVERNESS. --OH WAIT BUT THEN IT WILL JUST ADD ON THE SAME NUMBER PLUS ITSELF. BUT WHATEVER THAT CAN BE FIXED LATER print("BEAVERNESS =", inst.components.beaverness.current) --MORE DEBUGGING TO TELL YOU WHAT THE CURRENT BEAVERNESS ISend(okay so this isn't a permanent fix, but hey, we just need to make sure it works first) then, if we generously assume that all the beaverness-to-transformation code works, it should activate the transformation once your beaverness goes over 100. So tell me if it transforms Link to comment Share on other sites More sharing options...
The Noon Fish Posted November 3, 2015 Author Share Posted November 3, 2015 Is "entity_death" the correct way of listening for creatures deaths? Kramped.lua just listens for "killed" and other stuff butYea I have no idea what's going on in TriggerKrampusTransformation or how it's getting called but instead of trying to replicate a custom component in the character's file. Why not just use the existing naughtiness meter? You can access your character's naughtiness level from the kramped component withinst.components.kramped.actions (at least I think it's actions. the only other variable in there is threshold and it's probably not that) so um try something like this in the character's file: inst:ListenForEvent( "killed", OnKillMurder) and then have the function like thislocal function OnKillMurder(inst) local murderlvl = inst.components.kramped.actions --HOPEFULLY THIS WONT CRASH THE GAME print("MURDER LEVEL =", murderlvl) --THIS IS JUST TO HELP DEBUGGING. IT SHOULD PRINT OUT THE VALUE WHEN YOU KILL SOMETHING inst.components.beaverness:DoDelta(murderlvl) --ADDS THE VALUE TO BEAVERNESS. --OH WAIT BUT THEN IT WILL JUST ADD ON THE SAME NUMBER PLUS ITSELF. BUT WHATEVER THAT CAN BE FIXED LATER print("BEAVERNESS =", inst.components.beaverness.current) --MORE DEBUGGING TO TELL YOU WHAT THE CURRENT BEAVERNESS ISend(okay so this isn't a permanent fix, but hey, we just need to make sure it works first) then, if we generously assume that all the beaverness-to-transformation code works, it should activate the transformation once your beaverness goes over 100. So tell me if it transformsit doesnt even print:T Link to comment Share on other sites More sharing options...
pickleplayer Posted November 3, 2015 Share Posted November 3, 2015 it doesnt even print:T Hm, that must mean the event listener isn't working. I guess "killed" isn't the correct event to listen for after all? try replacing it with "entity_death" like thisinst:ListenForEvent( "entity_death", OnKillMurder) and see if that prints anything. and if that STILL doesn't work, try "hungerdelta" and if THAT doesn't print anything then we know the problem lies somewhere else Link to comment Share on other sites More sharing options...
The Noon Fish Posted November 3, 2015 Author Share Posted November 3, 2015 Hm, that must mean the event listener isn't working. I guess "killed" isn't the correct event to listen for after all? try replacing it with "entity_death" like thisinst:ListenForEvent( "entity_death", OnKillMurder) and see if that prints anything. and if that STILL doesn't work, try "hungerdelta" and if THAT doesn't print anything then we know the problem lies somewhere else i tried chaging it to entity_death before, but that didn't worktried hungerdelta, but that didn't work eitherbut as i was looking through the stuff in N tools, i saw an event "onattackother"tried thatit still didn't print Link to comment Share on other sites More sharing options...
pickleplayer Posted November 3, 2015 Share Posted November 3, 2015 i tried chaging it to entity_death before, but that didn't worktried hungerdelta, but that didn't work eitherbut as i was looking through the stuff in N tools, i saw an event "onattackother"tried thatit still didn't print if hungerdelta didn't work then something else is going on. question; does anything print at all? like, are any changes even visible?Beause when I try and run the mod, no changes take place at all. Not even from the modmain. But that might just be on my end, because I've had problems like this before. Link to comment Share on other sites More sharing options...
The Noon Fish Posted November 3, 2015 Author Share Posted November 3, 2015 if hungerdelta didn't work then something else is going on. question; does anything print at all? like, are any changes even visible?Beause when I try and run the mod, no changes take place at all. Not even from the modmain. But that might just be on my end, because I've had problems like this before. NVM IT WORKSI FORGOT TO FIX THE NAME IN THE MODSETTINGSNOW HE JUST TURNS INVISIBLE AND THE SCREEN JUST SITS THERE Link to comment Share on other sites More sharing options...
Arkathorn Posted November 3, 2015 Share Posted November 3, 2015 NOW HE JUST TURNS INVISIBLE AND THE SCREEN JUST SITS THEREYeah, that's what happened for me when I was fiddling with it. Link to comment Share on other sites More sharing options...
pickleplayer Posted November 3, 2015 Share Posted November 3, 2015 NVM IT WORKSI FORGOT TO FIX THE NAME IN THE MODSETTINGSNOW HE JUST TURNS INVISIBLE AND THE SCREEN JUST SITS THERE What did you do to fix it? it'd be nice if I could get it working on my own computer But it's probably an animation error. So the animation doesn't show up properlythat means the "animover" event never happens (because there is no animation to begin with), and neither does "onexit" Oh hold on, SetBank should actually be set to wilson. inst.AnimState:SetBank("wilson") (or just don't change it in the first place and you won't need to set it back to wilson later) so change all of the banks back to wilson and that will probably fix it Link to comment Share on other sites More sharing options...
The Noon Fish Posted November 3, 2015 Author Share Posted November 3, 2015 Yeah, that's what happened for me when I was fiddling with it. What did you do to fix it? it'd be nice if I could get it working on my own computer But it's probably an animation error. So the animation doesn't show up properlythat means the "animover" event never happens (because there is no animation to begin with), and neither does "onexit" Oh hold on, SetBank should actually be set to wilson. inst.AnimState:SetBank("wilson") (or just don't change it in the first place and you won't need to set it back to wilson later) so change all of the banks back to wilson and that will probably fix it*INTERNAL SCREAMING* edit: here's the code Hallows monster night.zip Link to comment Share on other sites More sharing options...
pickleplayer Posted November 3, 2015 Share Posted November 3, 2015 2015-11-03_00001.jpg*INTERNAL SCREAMING* edit: here's the code Hallows monster night.zip wHAT HOLY HELL WHAT EVEN ISUh.. I got nothin... Did you maybe miss a bank? did you double check to make sure they're all wilson? Does it still look like that if you turn him back to wilson afterwards? Link to comment Share on other sites More sharing options...
The Noon Fish Posted November 3, 2015 Author Share Posted November 3, 2015 wHAT HOLY HELL WHAT EVEN ISUh.. I got nothin... Did you maybe miss a bank? did you double check to make sure they're all wilson? Does it still look like that if you turn him back to wilson afterwards? the thing is, that is what happens when i replaced all the banks to wilsonim not sure how to turn him back normally Link to comment Share on other sites More sharing options...
Arkathorn Posted November 4, 2015 Share Posted November 4, 2015 im not sure how to turn him back normallyThis is one of the reasons I think a component would be a better way to code it, you can call it's functions from other places (like the console). Link to comment Share on other sites More sharing options...
The Noon Fish Posted November 4, 2015 Author Share Posted November 4, 2015 This is one of the reasons I think a component would be a better way to code it, you can call it's functions from other places (like the console).well since i got the code in the wilson prefab to work, i can just mush the kramped and beaverness component together again Link to comment Share on other sites More sharing options...
pickleplayer Posted November 5, 2015 Share Posted November 5, 2015 With stuff like that I often just set up a DoTaskInTime function right in the characters main function and set it for like 10 seconds or something. You could have it do something like beaverness:DoDelta(-100) or activate the human transformation function or something. Link to comment Share on other sites More sharing options...
Arkathorn Posted November 5, 2015 Share Posted November 5, 2015 With stuff like that I often just set up a DoTaskInTime function right in the characters main function and set it for like 10 seconds or something.The issue being that this will break if you reload the game before the task is done. Link to comment Share on other sites More sharing options...
The Noon Fish Posted November 5, 2015 Author Share Posted November 5, 2015 ok i mushed the two components together kinda, and i think it works, but wilson still morphs into uhwhatever that wasnot sure how to fix that since the spriter file thing looks normal (i didn't arrange the images in the spriter file because i know that doesn't work) Link to comment Share on other sites More sharing options...
pickleplayer Posted November 7, 2015 Share Posted November 7, 2015 ok i mushed the two components together kinda, and i think it works, but wilson still morphs into uhwhatever that wasnot sure how to fix that since the spriter file thing looks normal (i didn't arrange the images in the spriter file because i know that doesn't work)Yea, the spriter files themselves look fine, I already checked through them.Hmm, see what happens if you transform him into one of the other characters instead of the krampuswilson. Try transforming him into Wendy or something and see if they still come out all mutilated Link to comment Share on other sites More sharing options...
The Noon Fish Posted November 7, 2015 Author Share Posted November 7, 2015 Yea, the spriter files themselves look fine, I already checked through them.Hmm, see what happens if you transform him into one of the other characters instead of the krampuswilson. Try transforming him into Wendy or something and see if they still come out all mutilatedno body should hear wendy sound like wilsonits kinda terrifyingbut she wasn't horribly mutilated so that's a plus i think 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.