Jump to content

Hallows monster night


Recommended Posts

Hey, so uh

i tried to make this mod for halloween

that 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 atm

if anyone reading this could help me, i would be so happy

code:

Hallows monster night.zip

the only screenshot i have atm since i cant get wilson to transform

post-250258-0-78686500-1446343616_thumb.

To Do list:

Get Wilson to transform

Have the transformation trigger on on how naughty you've been

Work on art a little (lot) bit more

try looking at a thing about code again

 

Link to comment
Share on other sites

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

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")end

you 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 wilson

so 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

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")end

you 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 wilson

so 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

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 this

inst: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

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 this

inst: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 that

didn't work

but what i had for making it do delta isn't printing what i wrote, so it's obviously not working

but i dont know what im doing wrong /);^;/)

Hallows monster night.zip

Link to comment
Share on other sites

well i tried that

didn't work

but what i had for making it do delta isn't printing what i wrote, so it's obviously not working

but i dont know what im doing wrong /);^;/)

attachicon.gifHallows monster night.zip

 

Is "entity_death" the correct way of listening for creatures deaths? Kramped.lua just listens for "killed" and other stuff but

Yea 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 with

inst.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 this

local 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

Is "entity_death" the correct way of listening for creatures deaths? Kramped.lua just listens for "killed" and other stuff but

Yea 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 with

inst.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 this

local 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

it doesnt even print

:T

Link to comment
Share on other sites

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 this

inst: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

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 this

inst: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 work

tried hungerdelta, but that didn't work either

but as i was looking through the stuff in N tools, i saw an event "onattackother"

tried that

it still didn't print

Link to comment
Share on other sites

i tried chaging it to entity_death before, but that didn't work

tried hungerdelta, but that didn't work either

but as i was looking through the stuff in N tools, i saw an event "onattackother"

tried that

it 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

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 WORKS

I FORGOT TO FIX THE NAME IN THE MODSETTINGS

NOW HE JUST TURNS INVISIBLE AND  THE SCREEN JUST SITS THERE

Link to comment
Share on other sites

NVM IT WORKS

I FORGOT TO FIX THE NAME IN THE MODSETTINGS

NOW 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 properly

that 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

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 properly

that 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

post-250258-0-67630900-1446584934_thumb.

*INTERNAL SCREAMING*

 

edit: here's the code 

Hallows monster night.zip

Link to comment
Share on other sites

wHAT HOLY HELL WHAT EVEN IS

Uh.. 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 wilson

im not sure how to turn him back normally

Link to comment
Share on other sites

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

ok i mushed the two components together kinda, and i think it works, but wilson still morphs into

uh

whatever that was

not 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

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

no body should hear wendy sound like wilson

its kinda terrifying

but she wasn't horribly mutilated so that's a plus i think

Link to comment
Share on other sites

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.

×
  • Create New...