Jump to content

Mod not working on multiplayer, please help!


Recommended Posts

So I've pretty much completed my mod, it runs single player fine, I've given a friend the mod file and they've put it in their mod folder and the game runs fine for them when I host a server and us two play together.

 

Then when I put my custom weapon 'chainsword' in the player inventory, the game crashes, there's apparently an error in line 265 of the modmain.lua, regarding my custom weapon. Everything else works fine but there's a problem with loading the weapon. The weapon loads when I play alone. Please help!

 

wrexcharactermod.zip

Link to comment
Share on other sites

So I've pretty much completed my mod, it runs single player fine, I've given a friend the mod file and they've put it in their mod folder and the game runs fine for them when I host a server and us two play together.

 

Then when I put my custom weapon 'chainsword' in the player inventory, the game crashes, there's apparently an error in line 265 of the modmain.lua, regarding my custom weapon. Everything else works fine but there's a problem with loading the weapon. The weapon loads when I play alone. Please help!

 

attachicon.gifwrexcharactermod.zip

 

So as I assume your mod works fine on Don't Starve (or ROG) but not on DS Together. That's normal. DS and DST aren't literraly the same. Suggesting searching forums for differences between DS and DST codes. Or - also handy way - download a mod of someone else which has version for DS and DST. And compare differences in the code. 

 

For example: in DS you put recipe in character.lua. In DST you put recipes in modmain.lua. See? 

Link to comment
Share on other sites

@Foxrai this mod was made using a character template specifically for Don't starve together so it's a coding issue I think.

 

@DarkXero Yeah I don't code so good, I'm doing a programming course at university, and last year for the coursework everyone else had nice neat code with classes and I had one main block of code with thousands of lines  :hopelessness:  So, I have to put all 'component' related stuff from the character prefab and modmain into the weapon prefab? Just copy all that over after the 'World' thing? Any code with the word 'component' in it right?

Link to comment
Share on other sites

@Foxrai this mod was made using a character template specifically for Don't starve together so it's a coding issue I think.

 

@DarkXero Yeah I don't code so good, I'm doing a programming course at university, and last year for the coursework everyone else had nice neat code with classes and I had one main block of code with thousands of lines  :hopelessness:  So, I have to put all 'component' related stuff from the character prefab and modmain into the weapon prefab? Just copy all that over after the 'World' thing? Any code with the word 'component' in it right?

 

This is your problem.

wEKAfRk.png

 

What is wrong with this? Nothing if you're a host, but if you're a client you do not have components. What does this mean? It crashes.

 

How do we solve it? By adding the following code before the components code:

 

if not TheWorld.ismastersim then    return instend 

Link to comment
Share on other sites

Sorry for the late reply, I gave up on this mod but saw you posted a fix and I've just tried it with my mate and it WORKS! Thank you so much @DarkXero ! I tried doing what you recommended @Kzisor but I couldn't do it! Wow thanks so much for all the help you've given me throughout this project, can't believe it works!

Link to comment
Share on other sites

@DarkXero Yeah I don't code so good, I'm doing a programming course at university, and last year for the coursework everyone else had nice neat code with classes and I had one main block of code with thousands of lines  :hopelessness:  So, I have to put all 'component' related stuff from the character prefab and modmain into the weapon prefab? Just copy all that over after the 'World' thing? Any code with the word 'component' in it right?

Don't feel so bad, some of us started out that way too.  I remember in my programming course back in high-school I was the same way.

 

The thing is you can only get better the more you do it, my original code was a gigantic mess, but once I learned how it worked and what I can do better, I try to make sure my code is as clean and neat as possible.

 

Granted, I'm nowhere near on DarkXero's level, everything he does is neat and tidy including his forum posts.

 

Example:

* Attached Files
 

straight to the point everytime.

Link to comment
Share on other sites

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
 Share

×
  • Create New...