Jump to content

Recommended Posts

Yea, I think the title is pretty self exploratory.

But that's not why im making this thread.

i need help with making weirdobob, and out of ALL the things, he wanted to be like willow, but with explosions. i tried lookng at willow's coding, and then realized "this is like looking into her guts" for some reason, tried some things and then failed with the game saying "V IS A NUMBER VALUE DUR."

and the log is NOT helping.

like.

at all.

 

Noon Fish with company.zip

 

log.txt

Link to comment
Share on other sites

  • Developer

Guessing that you somehow managed to say inst.components.explosivedamage=0 instead of inst.components.Idunnowhatcomponentyouadded.explosivedamage=0.

 

Sure enough, in weirdo prefab:

 

inst.components.explosivedamage = 0

 

instead of inst.components.explosivebug.explosivedamage=0

 

(you also don't add that component, for what it's worth)

Link to comment
Share on other sites

Guessing that you somehow managed to say inst.components.explosivedamage=0 instead of inst.components.Idunnowhatcomponentyouadded.explosivedamage=0.

 

Sure enough, in weirdo prefab:

 

inst.components.explosivedamage = 0

 

instead of inst.components.explosivebug.explosivedamage=0

 

(you also don't add that component, for what it's worth)

then how do i get him to gain sanity from explosions?

ihavenoideawhattheheckimdoingorevensaying

 

edit: line works, now MY character is causing trouble!

double edit: it said it's expecting ')' somewhere in my coding. prob my failed attempt at making my character gain sanity while using icestaffs and loose more sanity using firestaffs

 

Noon Fish with company.zip

log.txt

Edited by The Noon Fish
Link to comment
Share on other sites

still trying to get weirdobob to be immune to explosions, because the code buzaiboi gave doesnt work for some reason (i might be blind here or something, idk)and it still says that v is a number value, but instead of entityscript.lua it's mainfunctions.lua

 

omg im so blind on lua coding plz send halp

Noon Fish with company.ziplog.txt

Link to comment
Share on other sites

Your AddPrefabPostInit on noonfish has syntax errors. And if you fix them, then when you try playing as the mage, the error that comes up is that AddPrefabPostInit is defined in the mod environment, not the global one.

 

I'm gonna look at the explosions now, you should go one by one character. :razz:

 

Update:

AddComponentPostInit("combat", function(self)	local old = self.GetAttacked	function self:GetAttacked(attacker, damage, weapon)		if self.inst.prefab == "weirdo" and attacker.components.explosive then			old(self, attacker, 0, weapon)		else			old(self, attacker, damage, weapon)		end	endend)

in modmain.lua for explosion damage immunity.

Edited by DarkXero
Link to comment
Share on other sites

Your AddPrefabPostInit on noonfish has syntax errors. And if you fix them, then when you try playing as the mage, the error that comes up is that AddPrefabPostInit is defined in the mod environment, not the global one.

 

I'm gonna look at the explosions now, you should go one by one character. :razz:

 

Update:

AddComponentPostInit("combat", function(self)	local old = self.GetAttacked	function self:GetAttacked(attacker, damage, weapon)		if self.inst.prefab == "weirdo" and attacker.components.explosive then			old(self, attacker, 0, weapon)		else			old(self, attacker, damage, weapon)		end	endend)

in modmain.lua for explosion damage immunity.

 

thanks m8.

now time to try to get my character to gain sanity from using ice staffs, but loses more sanity from fire staffs

Link to comment
Share on other sites

AddPrefabPostInit("icestaff", function(inst)	local old = inst.components.weapon.onattack	inst.components.weapon.onattack = function(inst, attacker, target)		old(inst, attacker, target)		if attacker and attacker.prefab == "noonfish" and attacker.components.sanity then			attacker.components.sanity:DoDelta(6) -- Total: 5, with -1 from old		end	endend)AddPrefabPostInit("firestaff", function(inst)	local old = inst.components.weapon.onattack	inst.components.weapon.onattack = function(inst, attacker, target)		old(inst, attacker, target)		if attacker and attacker.prefab == "noonfish" and attacker.components.sanity then			attacker.components.sanity:DoDelta(-4) -- Total: -5, with -1 from old		end	endend)

In modmain.lua.

Link to comment
Share on other sites

AddPrefabPostInit("icestaff", function(inst)	local old = inst.components.weapon.onattack	inst.components.weapon.onattack = function(inst, attacker, target)		old(inst, attacker, target)		if attacker and attacker.prefab == "noonfish" and attacker.components.sanity then			attacker.components.sanity:DoDelta(6) -- Total: 5, with -1 from old		end	endend)AddPrefabPostInit("firestaff", function(inst)	local old = inst.components.weapon.onattack	inst.components.weapon.onattack = function(inst, attacker, target)		old(inst, attacker, target)		if attacker and attacker.prefab == "noonfish" and attacker.components.sanity then			attacker.components.sanity:DoDelta(-4) -- Total: -5, with -1 from old		end	endend)

In modmain.lua.

 

*writes a different functional version*

*refreshes page*

*sees this*

*300% done*

thank you.

it's way cleaner then having a copy of the staff.lua and what not i guess.

Link to comment
Share on other sites

can someone please tell me if there's something wrong with this slice of coding?

 


AddPrefabPostInit("tallbidnest", function(inst)if not picker.components.inventory and picker:HasTag("tallbirdtamer") and picker.components.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.HEAD) and picker.components.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.HEAD).prefab == "featherhat" and picker.prefab == "weirdo" thenv.components.combat:SuggestTarget(picker)endendend)

 

also how do i make it look like coding instead of it being copy pasted?

Edited by The Noon Fish
Link to comment
Share on other sites

Click the "<>" button in the post options and enter your code there.

 

1) It says tallbidnest.

2) There is no picker variable in the tallbirdnest prefab

3) There is no v variable defined anywhere

4) The if has an end, the function has an end, and then there is another extra end, that is not needed.

5) I'm really confused as what you want to do there.

Link to comment
Share on other sites

Click the "<>" button in the post options and enter your code there.

 

1) It says tallbidnest.

2) There is no picker variable in the tallbirdnest prefab

3) There is no v variable defined anywhere

4) The if has an end, the function has an end, and then there is another extra end, that is not needed.

5) I'm really confused as what you want to do there.

im trying to get tallbirds to be ok with wierdoob stealing their eggs and be non agressve towards him in general when he's wearing the featherhat.

i looked at the "bee nice" mod for an example and kinda tried doing the same, but with tallbirds

 

edit:

also thanks

Edited by The Noon Fish
Link to comment
Share on other sites

AddPrefabPostInit("tallbirdnest", function(inst)

local old = inst.components.pickable.onpickedfn

inst.components.pickable.onpickedfn = function(inst, picker)

if picker.prefab == "weirdo" then

inst.AnimState:PlayAnimation("nest")

inst.components.childspawner.noregen = true

inst:DoTaskInTime(0, StartNesting)

else

old(inst, picker)

end

end

end)

AddPrefabPostInit("featherhat", function(inst)

local old = inst.components.equippable.onequipfn

inst.components.equippable.onequipfn = function(inst, owner)

if owner.prefab == "weirdo" then

owner:AddTag("tallbird")

end

old(inst, owner)

end

local old2 = inst.components.equippable.onunequipfn

inst.components.equippable.onunequipfn = function(inst, owner)

if owner.prefab == "weirdo" then

owner:RemoveTag("tallbird")

end

old2(inst, owner)

end

end)

Link to comment
Share on other sites

AddPrefabPostInit("tallbirdnest", function(inst)	local old = inst.components.pickable.onpickedfn	inst.components.pickable.onpickedfn = function(inst, picker)		if picker.prefab == "weirdo" then			inst.AnimState:PlayAnimation("nest")			inst.components.childspawner.noregen = true			inst:DoTaskInTime(0, StartNesting)		else			old(inst, picker)		end	endend)AddPrefabPostInit("featherhat", function(inst)	local old = inst.components.equippable.onequipfn	inst.components.equippable.onequipfn = function(inst, owner)		if owner.prefab == "weirdo" then			owner:AddTag("tallbird")		end		old(inst, owner)	end	local old2 = inst.components.equippable.onunequipfn	inst.components.equippable.onunequipfn = function(inst, owner)		if owner.prefab == "weirdo" then			owner:RemoveTag("tallbird")		end		old2(inst, owner)	endend)

 

there is no words to show you how much i love you

(in a friend like way >_>)

Link to comment
Share on other sites

local function sanityfn(inst)	local x,y,z = inst.TransformGetWorldPosition()	local ents = TheSim:FindEntities(x,y,z, {"explosion"})	for k,v in pairs(ents)do		if v.components.explosive and v.components.explosive.onexplode then do			local sz = TUNING.SANITYAURA_TINY			end		end	end	end

this doesn't work for some reason, but it doesn't make the game crash ._.

im trying to get weirdo to gain sainty from explosions.

kinda like willow, with the fire bug and all,

but idk

Link to comment
Share on other sites

That doesn't work because:

1) TransformGetWorldPosition is nothing.

2) Gunpowder exploding or anything exploding like slurtle slime do not get a "explosion" tag while exploding.

3) If v.components.explosive.onexplode then makes you go to the next thing if the function onexplode exists, not if it runs.

4) sz is just a value, a number, there is nothing modifying sanity.

5) There is a do after the then of the if, there should be none.

6) There is an extra end, that somehow doesn't crash you, I assume it's because of the do.

 

That is a trainwreck.

 

How close should weirdo be to gain sanity? On top? Near? Away? On the edge of the screen?

Link to comment
Share on other sites

That doesn't work because:

1) TransformGetWorldPosition is nothing.

2) Gunpowder exploding or anything exploding like slurtle slime do not get a "explosion" tag while exploding.

3) If v.components.explosive.onexplode then makes you go to the next thing if the function onexplode exists, not if it runs.

4) sz is just a value, a number, there is nothing modifying sanity.

5) There is a do after the then of the if, there should be none.

6) There is an extra end, that somehow doesn't crash you, I assume it's because of the do.

 

That is a trainwreck.

 

How close should weirdo be to gain sanity? On top? Near? Away? On the edge of the screen?

 

sorry about that. im still a noob at this kinda of stuff.

he should be near it to gain sanity, like willow.

Link to comment
Share on other sites

Well, Willow has to be really close to the fire, as in stepping on it.

Weirdo may be immune to explosions, but he's not immune to the ignition fire of them. That's why I ask.

 

I will put him very close then, but not over the fire.

Link to comment
Share on other sites

Well, Willow has to be really close to the fire, as in stepping on it.

Weirdo may be immune to explosions, but he's not immune to the ignition fire of them. That's why I ask.

 

I will put him very close then, but not over the fire.

 

i wasn't aware of that (since i rarely play as her)

thereisnowordsforhowgreatfuliamomg

plz dont hate me for being a noob at everything ;-;

Link to comment
Share on other sites

AddComponentPostInit("explosive", function(self)

local old = self.OnBurnt

function self:OnBurnt()

local x, y, z = self.inst.Transform:GetWorldPosition()

local ents = TheSim:FindEntities(x, y, z, 5, {"player"}, {"playerghost"})

for _, v in pairs(ents) do

if v.prefab == "weirdo" then

v.components.sanity:DoDelta(10)

end

end

old(self)

end

end)

Link to comment
Share on other sites

AddComponentPostInit("explosive", function(self)	local old = self.OnBurnt	function self:OnBurnt()		local x, y, z = self.inst.Transform:GetWorldPosition()		local ents = TheSim:FindEntities(x, y, z, 5, {"player"}, {"playerghost"})		for _, v in pairs(ents) do			if v.prefab == "weirdo" then				v.components.sanity:DoDelta(10)			end		end		old(self)	endend)

 

thankyousomuch.

Link to comment
Share on other sites

AddComponentPostInit("temperature", function(self)	local old = self.OnUpdate	function self:OnUpdate(dt, applyhealthdelta)		old(self, dt, applyhealthdelta)		if self.inst.prefab == "fish" and applyhealthdelta and self.current < 0 and self.inst.components.health then			self.inst.components.health:DoDelta(self.hurtrate*dt*1.5, true, "cold")		end	endend)

in modmain.

inst.components.sanity.custom_rate_fn = function(inst)	local rain_delta = TheWorld.state.israining and -1.5 * TUNING.DAPPERNESS_MED * TheWorld.state.precipitationrate or 0	local mydelta = -(rain_delta * 1.5)	return mydeltaend

In your master_postinit.

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