Jump to content

Recommended Posts

As the title states, I need a little help making my character hurt, a.k.a. "do_rain_sparks" much like wx78. I have an idea where the code goes and where it comes from but even still the game crashes upon opening.

 

This is what I've got: willowson.lua

willowson_smoke.lua

 

both of which I have placed within the "scripts, prefabs" folder. 

 

Any ideas as to why this isn't working?

 
Link to comment
https://forums.kleientertainment.com/forums/topic/51276-making-characters-hurt/
Share on other sites

@Willowson This is why. :b

 

Edit: In your log.

willowson/modmain.lua:3: '}' expected (to close '{' at line 1) near '"willowson_smoke"'

Check line 3-4, you're missing a closing bracket.

doing that only seems to have crashed the game ;3; maybe I did something wrong?

so i would need to find code from DS in order for this to work?

Yes.  Although it's not as simple as just copy/pasting code.  Just having a function called "dorainsparks" dosen't actually mean that your character will spark in the rain.  That would be like carving a wooden boat and then expecting it to find a body of water and float across it by itself.  You'll notice that in the DS version of WX's prefab file, it sets up a PeriodicTask to constantly check for rain:

inst:DoPeriodicTask(1/10, function() dorainsparks(inst, 1/10) end)

The DST version handles this completely differently in ways that DS doesn't support at all.

 

On a similar note, in willowson_smoke.lua, the code...

if not TheWorld.ismastersim then   return instend

is very DST specific.  There is no TheWorld.ismastersim in DS, because all sims are master sims.  There's not even a TheWorld.  You only have to deal with TheSim. 

 

This also has no meaning in DS:

inst.entity:AddNetwork()
Edited by Corrosive

Yes.  Although it's not as simple as just copy/pasting code.  Just having a function called "dorainsparks" dosen't actually mean that your character will spark in the rain.  That would be like carving a wooden boat and then expecting it to find a body of water and float across it by itself.  You'll notice that in the DS version of WX's prefab file, it sets up a PeriodicTask to constantly check for rain:

inst:DoPeriodicTask(1/10, function() dorainsparks(inst, 1/10) end)

The DST version handles this completely differently in ways that DS doesn't support at all.

 

On a similar note, in willowson_smoke.lua, the code...

if not TheWorld.ismastersim then   return instend

is very DST specific.  There is no TheWorld.ismastersim in DS, because all sims are master sims.  There's not even a TheWorld.  You only have to deal with TheSim. 

 

This also has no meaning in DS:

inst.entity:AddNetwork()

 

Hmm I get your point. For now, I've removed both codes and moved the files until I can find the correct coding for don't starve. I think when I was looking through game files I was maybe in DST folder rather than the DS folder. I'll give my lines another check and see how they turn out. Thanks for letting me know about those, had no clue they were so different. 

 

 

are you missing a comma? ,

yes I was. That seemed to have fixed it. I can at least run the mod now. 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...