Jump to content

Recommended Posts

I have decided to simplify my character due to this being my first time modding, and some tasks being out of my leauge, so I scrapped the nightmare vision and blindness, and I will increase the penalties for being in the day. However, if in the future, if my character ever gets popular enough, I will consider overhauling the character so that my original idea will come to fruition. Any coding I received help on will stay into the character. If there is anything I need to change, then I would love to know. Coding help is appreciated.

Don't Starve Together Character - Wayne

Wayne is a 18 year old young man who was recently kidnapped while driving his way to college to be experimented on. Nightmare fuel has been surgically inserted into his arms. The Nightmare fuel had an effect on his entire body. Causing his body to change. His body is actually an incomplete experiment, in which nightmare fuel was supposed to be comprising most of his body, however, Wayne managed to escape from his tormentors through the florid postern (or the real world counterpart of the florid postern, I don’t know what specifically it is called). He took one of the surgeons lives in the process of escaping.

Physical Description: Wayne's arms have Nightmare fuel surgically inserted to his arms, causing his whole body to react to it. His arms have turned completely black, and have swollen. Stitches can be seen going all the way through the top of his arms. His hair has also turned black, which used to be brown. The rest of his skin, aside from arms, have turned grey. Wayne is wearing a patient's gown, and some sweatpants that match the patient gown's pattern. Other than that, he is a normal young adult. Wayne likes to keep his hair messy, and at jaw length.

Personality:  Wayne has neurosis (a relatively mild mental illness that causes him to be easily stressed, but to be out of touch with reality) due to him being experimented on and due his different body. This doesn't mean that Wayne is a coward, it just means that Wayne tends to overreact to things. This includes him breaking into rants/strings-of-insults about something he is upset over to Wayne losing his mind over a deerclops (which is understandable). Wayne also has depression, also due to him being experimented on, sometimes referring to his time of being experimented on. Wayne is a bit of a hothead, but not to the point where he explodes in anger frequently. Wayne occasionally likes to make jokes or quips whenever he is calm. He thinks his altered body is a curse, and he disdains the nightmare fuel inside his arms and the nightmare fuel coursing through his blood and veins. Wayne especially hates nightmare creatures, showing a strong hate towards them. Wayne doesn't like to think about how he murdered someone while trying to escape the lab he was in, and is hesitant when he is fighting a murderer. Wayne will feel guilty whenever he chops down trees or when he murders a rabbit. His favorite food is Creamy Potato Purée. (Food item crafted with 2 potatoes, 1 garlic, 1 misc that is not meat or twigs. Heals 20 health, 37.5 hunger, 33 sanity).

Wayne's Stats: (may need to be readjusted)

175 health

150 hunger

130 Sanity

  • Can extract the nightmare fuel from his veins

  • Night Vision

  • More efficient during night, crippled during day (defense loss, lower speed, ect)

  • Neurotic (more sanity loss from fighting, wormholes, etc) except during night, which none is lost)

  • Will be severely crippled when his sanity reaches zero, (defense weakness, lower attack power, etc)

Items: Custom Nightmare Amulet (Basically, nightmare amulet with infinite durability but greater sanity penalty (-5 per sec).

Bloody Nightmare Fuel: Ingredient for Custom Nightmare Amulet

How to play: Typically with experienced players, players tend to keep themselves insane in order to collect nightmare fuel from monsters, which is an important ingredient in most magical items. Being sane locks the player out from nightmare fuel, due to shadow monsters being the most reliable source of nightmare fuel. This could be dangerous since shadow monsters can be dangerous, and they are more likely to attack when someone is keeping their sanity low. With Wayne, Shadow Monsters are always available, therefore, nightmare fuel is always available. So for Wayne, it is encouraged to keep his sanity above zero. It is recommended to wear sanity restoring items. When fighting a giant boss, it is crucial to bring sanity refilling items, and to have someone help the player when fighting a boss. It is a good idea to carry a mandrake or a pan flute so you can put your enemies to sleep when fighting them.


 

Everything I need to do for this mod:

  • Start Coding for Character; What I need to code

    • Wayne’s Night Vision (Done, thank you AkaiKnight!!)

    • Wayne’s Health, Sanity, Hunger Stats (Done)

    • Wayne’s Insanity Weakness (Done)

    • Wayne’s Night/Day efficiency change (Done)

    • Sanity Penalites (Done)

    • Wayne's Custom Crafting

    • Voicelines for Wayne

    • A Voice for Wayne

    • Give Wayne a Favorite Food (Done)

  • Create all the character textures for Wayne
  • Code for items
  • Wayne's Custom Nightmare Amulet

  • Bloody Nightmare Fuel

Edited by Earthyburt
local function AtNight(inst)
  
  	if TheWorld.state.isnight then
    	inst.components.combat:SetAttackPeriod(number) --change 'number' with the vaule you want
    	inst.components.locomotor.walkspeed = number
    	inst.components.locomotor.runspeed = number
    
  		    inst.Light:Enable(true)
			inst.Light:SetRadius(18)
			inst.Light:SetFalloff(0.75)
			inst.Light:SetIntensity(.7)
			inst.Light:SetColour(70/255,230/255,12/170)
	
			inst.nightvisionIsEnabled = true
		else
    		if inst.nightvisionIsEnabled then
		
			inst.Light:Enable(false)
	
			inst.nightvisionIsEnabled = false
		end
    
  	end
end
    

put that in your character.lua

inst:WatchWorldState("isnight", AtNight)

and put that in master_postinit

this should give you night vision and efficiency you want

 

local function AtDay(inst)

	if TheWorld.state.isday then
		inst.components.health:DoDelta(-1) --you will lose 1 health
		else return
	end
end

i did not test that one but it should work too

and put this in your master_postinit

inst:WatchWorldState("isday", AtDay)
inst:DoPeriodicTask(5, AtDay) --this will do AtDay function per 5 sec so you will lose 1 health per 5 sec at day

Let me know if it crush

  • Thanks 1

 

Wait, I just realized that I put some code in the wrong place, disregard the comment about the game crashing, but the night vision didn't seem to work

 

Edited by Earthyburt
Wrong Location, but nightvision isn't working
13 hours ago, Earthyburt said:

It looks like that the night vision doesn't work when the world is set to all night. I don't mind this being an issue.

inst.Light:Enable(true)
	inst.Light:SetRadius(18)
	inst.Light:SetFalloff(0.75)
	inst.Light:SetIntensity(.7)
	inst.Light:SetColour(70/255,230/255,12/170)
	
	inst.nightvisionIsEnabled = true

delete all "AtNight" functions and just put that in your master_postinit

Also code for take more damage when your sanity is 0 and deal less damage when your sanity is 0

 

local function onattacked(inst)
	local _GetAttacked = inst.components.combat:GetAttacled
		inst.components.combat:GetAttacked = function(self, attacker, damage, ...)
			if attacker and inst.components.sanity == 0 and damage then
				damage = damage *1.5
			end
		return _GetAttacked(self, attacker, damage, ...)
	end
end

this in your character.lua

and this in master_postinit

inst:ListenForEvent("onhitother", function(inst)
	if inst.components.sanity == 0 then
		inst.components.combat.damagemultipler = 0.5
	else return
	end
end)
inst:ListenForEvent("attacked", onattacked)

let me know if it crush or not work

It looks like that the night vision doesn't work when the world is set to all night. I don't mind this being an issue.

 

It had crashed. On line 62, which was 

inst.components.combat:GetAttacked = function(self, attacker, damage, ...)
23 hours ago, AkaiNight said:

my bad

Hey, sorry about bugging you about this again, but that insanity weakness script still crashed my game. I hope I am not annoying you with this, but I am anxious that you aren't going to notice my problem if I don't notify you again. The code should be the same as the last one you had given me, but with the Attacled typo fixed

Edited by Earthyburt
56 minutes ago, Earthyburt said:

Hey, sorry about bugging you about this again, but that insanity weakness script still crashed my game. I hope I am not annoying you with this, but I am anxious that you aren't going to notice my problem if I don't notify you again. The code should be the same as the last one you had given me, but with the Attacled typo fixed

Sorry for late reply i am working on it atm. It works now but it continues to reply it (example: the first hit you get from a spider is 20(spiders basic damage) next one is 30 and nex one is 45...) here is the code if you want it anyway

local function onattacked(inst)
	local _GetAttacked = inst.components.combat.GetAttacked
		inst.components.combat.GetAttacked = function(self, attacker, damage, ...)
		if attacker and inst.components.sanity.current == 0  and damage then
			damage = damage * 1.5
		end
		return _GetAttacked(self, attacker, damage, ...)
	end
end

 

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