Jump to content

Recommended Posts

Yep, I'm making a mod where ye can play as good ol' Donkey Kong.

 

I need some help scripting him so he talks like a gorilla, using a table of strings which he randomly picks from instead of a speech file, akin to Wilbur

Y'know so he just makes gorilla noises.

 

I've tried looking at how Wilbur talks, but it's hardcoded into the stringutil, and making a new script with the same code and tagging it for DK didn't seem to work.

 

Been trying to use this code, but it doesn't seem to work...

 

Spoiler

function GetSpecialCharacterString(character) --describe text override for dong
    character = string.lower(character)
    if character == "donkeykong"==true then
		--return TUNING_DONKEYKONG.DONKEYKONG_SPEECH[math.random(#TUNING.DONKEYKONG_SPEECH)]
		return     {    "Woo hoo hoo!",    "Ah ah!",    "Eeeeeheee!",    "Oooh ah oh?",    "Feature Length!",    "Expand Dong!",    "Cool!",    "Okay!",    "Hee!",    "Eughhh!",    "Huh?",    "Yeah...",    "Mrrghhhhh!",    "Eh ehem ugh eh eh eh!",    "Oh hoo...",    "Ronkey rong!",    "Oooh ooh oah OOOH!",    "Wow!",    }[math.random(#    {    "Woo hoo hoo!",    "Ah ah!",    "Eeeeeheee!",    "Oooh ah oh?",    "Feature Length!",    "Expand Dong!",    "Cool!",    "Okay!",    "Hee!",    "Eughhh!",    "Huh?",    "Yeah...",    "Mrrghhhhh!",    "Eh ehem ugh eh eh eh!",   "Oh hoo...",    "Ronkey rong!",    "Oooh ooh oah OOOH!",    "Wow!",    })]
		end
end

 

What can I do to get the ol' Dong to start talking like a gorilla?

 

and if you can, make sure or provide equivalent so the table will also work for his DST version

donkeykongshipwrecked2.zip

Edited by 1337gamer15
22 hours ago, 1337gamer15 said:

What can I do to get the ol' Dong to start talking like a gorilla?

Well, you kinda got it.

You returned a table instead of a string.

And your override broke the old function, because it didn't save the old value anywhere.

local kong_sayings = {
	"Woo hoo hoo!", "Ah ah!", "Eeeeeheee!", "Oooh ah oh?", "Feature Length!", "Expand Dong!", "Cool!",
	"Okay!", "Hee!", "Eughhh!", "Huh?", "Yeah...", "Mrrghhhhh!", "Eh ehem ugh eh eh eh!", "Oh hoo...",
	"Ronkey rong!", "Oooh ooh oah OOOH!", "Wow!",
}

local _GetSpecialCharacterString = GLOBAL.GetSpecialCharacterString
GLOBAL.GetSpecialCharacterString = function(character, ...)
	character = string.lower(character)
	return (character == "donkeykong" and kong_sayings[math.random(#kong_sayings)]) or _GetSpecialCharacterString(character, ...)
end

Now, if the entity prefab is donkeykong, the character variable should be donkeykong.

Which returns a random pick from the kong_sayings table.

 

This should be compatible for DS, RoG, SW, and DST.

The only time GetSpecialCharacterString changes is in SW, for Wilbur.

(Those new function arguments are captured with the ellipsis ... in the function name.)

 

Wilbur has a string constructed randomly, for stuff except bananas.

He always says the same for bananas: " 'Nanas! "

But that's a Shipwrecked addition that has to be ported to the other versions.

It can be done if you want to, of course.

That seems to have worked!

 

One last task remains however...

How do i make him gain sanity from eating raw and cooked cave bananas in DST, I used some code from Wilbur which works in non-dst, but I need to know how to get it working for his DST version.

8 minutes ago, 1337gamer15 said:

How do i make him gain sanity from eating raw and cooked cave bananas in DST, I used some code from Wilbur which works in non-dst, but I need to know how to get it working for his DST version.

For non-DST, Wilbur code requires

inst:ListenForEvent("oneatsomething", oneat)

For DST, the event should be

inst:ListenForEvent("oneat", oneat)

 

Thanks, that works too.

 

EXPANSION COMPLETE

 

now, while we're still here, I wanna know for another 2 characters of mine, how do make make the sanity aura of things different for those characters in particular? Y'know for ophidiophobia, and the other one I plan will not lose any sanity from ghosts or evil flowers (aurawise, picking and eating will still cause sanity loss) What will work for non and DST?

24 minutes ago, 1337gamer15 said:

now, while we're still here, I wanna know for another 2 characters of mine, how do make make the sanity aura of things different for those characters in particular? Y'know for ophidiophobia, and the other one I plan will not lose any sanity from ghosts or evil flowers (aurawise, picking and eating will still cause sanity loss) What will work for non and DST?

local SanityAuraValue = {
	ghost = TUNING.SANITYAURA_MED,
	flower_evil = TUNING.SANITYAURA_SMALL,
}

local MAX_RAD = TUNING.SANITY_EFFECT_RANGE
local NO_TAGS = {"FX", "NOCLICK", "DECOR", "INLIMBO"}

local function sanity_fn(inst)
	local x, y, z = inst.Transform:GetWorldPosition()
	local ents = TheSim:FindEntities(x, y, z, MAX_RAD, nil, NO_TAGS)
	local aura_delta = 0
	for i, v in ipairs(ents) do
		local delta = SanityAuraValue[v.prefab]
		if delta then
			local distsq = inst:GetDistanceSqToInst(v)
			aura_delta = aura_delta + delta / math.max(1, distsq)
		end
	end
	return aura_delta
end

inst.components.sanity.custom_rate_fn = sanity_fn

Should be a universal solution.

Notice in the table how I assign positive values to ghost prefab and evil flower prefab, so that the total aura becomes 0.

The insanity aura of deerclops and other monsters remain untouched.

Picking and eating remain unaffected.

Edited by DarkXero
10 minutes ago, 1337gamer15 said:

Kinda works, it's causing her to gain sanity when standing very close to those prefabs though...

Do you have a

inst.components.sanity.neg_aura_mult = "something"

anywhere?

 

That may be reducing the evil flower sanity aura (and all other negative auras).

So if you want to use it, and also my code, multiply the SanityAuraValue values by that something.

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