Jump to content

Recommended Posts

mercury.lua
Hi,
I've attached my LUA file here to ask for some help with this mod, I am currently trying to make him immune to thorns and fix the goop issue.

The goop function somewhat works. However, sometimes he drops goops that cannot be picked up (or examined). This isn't so bad except that when you're placing items or structures down it will get in the way, the only way to fix this is to refresh the game. I've tried looking online for similar problems but I cannot get them to work. 

the immunity to getting prickled does not work at all, I've tried digging into to cactus, spikey bushes and bramble armour code files but nothing seems to work. I've even tried looking for similar mods with this function but I couldn't find any.

Just as an extra note, this mod is pretty outdated as well (I remembered I had it and wanted to get back into making characters) But there's no crashes with it, there's just minor bugs that I would like to get fixed. These would be nice to fix, but are not my priority right now.
When he gets hit, he drops goops and will shrink -- This function works well.
The more he shrinks the slower (maybe weaker too?) he gets -- This doesn't work, it only works when he dies and gets revived, but eating removes this penalty and I'm not sure what I did wrong.
Freezes and overheats faster -- not fully tested but I think I got the freezing faster one to work?? (needs more testing)

I am not an expert on LUA, If anyone can have a look and tell me the issue I will really appreciate it, thanks for for reading!

Edited by Bunnyash
Link to comment
Share on other sites

As for you first issue, the component periodicspawner should be added to the master_postinit. You don't want to have it on the client, it only needs to be on the server. That's why you will have some goops that you can't pick up, as those only exist on the client and not on the server.

The problem with the immunity to thorns is that the game checks if one of your equips has the tag bramble_resistant and not the player itself.

You could try to circumvent it with something like this:

Spoiler

AddComponentPostInit("inventory",function(self)
	local old_EquipHasTag = self.EquipHasTag
	self.EquipHasTag = function(self,tag,...)
		if tag == "bramble_resistant" then
			if self.inst:HasTag(tag) then
				return true
			end
		end
		return old_EquipHasTag(self,tag,...)
	end
end)

 

Add this to the modmain and it should work.

For you issue with the shrinking, I don't know what the problem is there, you could try addind print statements to your functions and see when which function is called and which values for example your scale and speed variables get, this will help you pinpoint where something breaks. I'm also not sure if calling SetScale will work if you call it from the server, as this is something that needs to be set on the client and server normally. You may need to use a netvar to pass the new scale value to the client so that it knows how small the character should be.

Your freezing that you added is only if you get attacked for example by deerclops and get frozen, this makes it so that you don't freeze as fast as normally. You can set those with the component temperature.

Overheating is easy, you can set inst.components.temperature.overheattemp = 60 (for example)
Freezing is not easily changed but you can set inst.components.temperature.inherentinsulation = -80 for example to make it so that other insulation effects won't work as well as they normally do.

  • Thanks 1
Link to comment
Share on other sites

4 hours ago, Monti18 said:

As for you first issue, the component periodicspawner should be added to the master_postinit. You don't want to have it on the client, it only needs to be on the server. That's why you will have some goops that you can't pick up, as those only exist on the client and not on the server.

The problem with the immunity to thorns is that the game checks if one of your equips has the tag bramble_resistant and not the player itself.

You could try to circumvent it with something like this:

  Hide contents


AddComponentPostInit("inventory",function(self)
	local old_EquipHasTag = self.EquipHasTag
	self.EquipHasTag = function(self,tag,...)
		if tag == "bramble_resistant" then
			if self.inst:HasTag(tag) then
				return true
			end
		end
		return old_EquipHasTag(self,tag,...)
	end
end)

 

Add this to the modmain and it should work.

For you issue with the shrinking, I don't know what the problem is there, you could try addind print statements to your functions and see when which function is called and which values for example your scale and speed variables get, this will help you pinpoint where something breaks. I'm also not sure if calling SetScale will work if you call it from the server, as this is something that needs to be set on the client and server normally. You may need to use a netvar to pass the new scale value to the client so that it knows how small the character should be.

Your freezing that you added is only if you get attacked for example by deerclops and get frozen, this makes it so that you don't freeze as fast as normally. You can set those with the component temperature.

Overheating is easy, you can set inst.components.temperature.overheattemp = 60 (for example)
Freezing is not easily changed but you can set inst.components.temperature.inherentinsulation = -80 for example to make it so that other insulation effects won't work as well as they normally do.

Hi! thanks so much for the reply!
everything worked first try! Although I believe I did put the goop codes in the right place before and it didn't work, I may have done it wrong somehow? The shrinking I have no idea, an old friend put that in there for me I no longer have contact with, so it's all confusing to me.
thanks so much for the help! I also noticed you do commissions for this sort of stuff?? I'm pretty interested to know the details as I got more character mods.
thanks again! :)
 

  • Like 1
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...