Jump to content

Some help with a character mod?


Recommended Posts

i'm currently making a character mod and i have all the animations done, the only problem is with coding, as i am sort of new to lua

the character is supposed to be an error, so they don't exactly work right, what i'm intending to happen is

incapability to speak, kinda like a ghost, so whenever speaking it will say one of a few lines

temperature works backwards- for instance an endothermic fire will make them heat up and a regular fire will make them cool down, during the summer they need warm stuff to prevent freezing and in the winter they need summer stuff to prevent overheating, when at max wetness, they overheat and you know, basically temperature works backwards

start with a random item- not from a list, like any random item, just there, any item from the whole game in their inventory when they start, like completely unpredictable (this one isn't necessary)

so if anyone who knows how to code this could help that would be great

Link to comment
Share on other sites

local rand_sayings =
{
  "string1",
  "string2",
  "string3",
}

local function rand_talk(inst)
    return rand_sayings[math.random(#rand_sayings)]
end

--Put this in your common_postinit
inst.components.talker.mod_str_fn = rand_talk

This covers the talking at least.

Edited by DarkKingBoo
Link to comment
Share on other sites

9 hours ago, DarkKingBoo said:

local rand_sayings =
{
  "string1",
  "string2",
  "string3",
}

local function rand_talk(inst)
    return rand_sayings[math.random(#rand_sayings)]
end

--Put this in your common_postinit
inst.components.talker.mod_str_fn = rand_talk

This covers the talking at least.

could you tell me where this would go? like which file it goes in, does it replace the entire speech file? (oh yeah i'm using the extended sample character thing, in case that helps)

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