Jump to content

Making characters hurt!


Willowson

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
Share on other sites

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()
Link to comment
Share on other sites

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. 

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