Jump to content

Maxwell Custom Intro Tutorial (SUPER EASY)


Recommended Posts

I am a wee lil bit tired of seeing thousands of lines being put to use for some stupid Maxwell Intro!

and I'm also tired of drinking the tears of the 100s that want my help to write code so they can have a custom intro! well LOOK NO FURTHER! here's the LOVELY code completely redone with some serious LOOPING magic to get the size down and writing intros will become SUPER EASY

 

You need to place all of the code into the modmain!

This is the actual intros! you can have any amount of quotes per world and it won't matter! you could have 1 or you could have 100 my loops are smart enough to handle it!

 

here's a small example of what you should do and how it works!

[1] = { --SANDBOX
    [1] = {1, "Hi!"}, --each quote's table will have 2 values!
    [2] = {2, "I'm Maxwell"}, --the number is how many seconds the quote will show!
    [3] = {3, "You will die now!"}, --the string is the quote itself...
    [4] = 4 --this last piece of the world's table will be Maxwells mood! 1=tux 2=coat 3=grumpy (it goes to 5)
}

GLOBAL.MOD_MAXWELL_INTROS = {

wod = { --replace wod with your character's name and if you have more than 1 character simply make a new table within the MOD_MAXWELL_INTROS table with all the same contents but name it the other character's prefab name! my loops can handle endless characters!
[1] = { --SANDBOX
[1] = {0, ""},
[2] = {0, ""},
[3] = {0, ""},
[4] = {0, ""},
[5] = {0, ""},
[6] = {0, ""},
[7] = {0, ""},
[8] = {0, ""},
[9] = {0, ""},
[10] = {0, ""},
[11] = 1
},
[2] = { --ADVENTURE_1
[1] = {0, ""},
[2] = {0, ""},
[3] = {0, ""},
[4] = {0, ""},
[5] = {0, ""},
[6] = {0, ""},
[7] = {0, ""},
[8] = {0, ""},
[9] = {0, ""},
[10] = {0, ""},
[11] = 1
},
[3] = { --ADVENTURE_2
[1] = {0, ""},
[2] = {0, ""},
[3] = {0, ""},
[4] = {0, ""},
[5] = {0, ""},
[6] = {0, ""},
[7] = {0, ""},
[8] = {0, ""},
[9] = {0, ""},
[10] = {0, ""},
[11] = 1
},
[4] = { --ADVENTURE_3
[1] = {0, ""},
[2] = {0, ""},
[3] = {0, ""},
[4] = {0, ""},
[5] = {0, ""},
[6] = {0, ""},
[7] = {0, ""},
[8] = {0, ""},
[9] = {0, ""},
[10] = {0, ""},
[11] = 1
},
[5] = { --ADVENTURE_4
[1] = {0, ""},
[2] = {0, ""},
[3] = {0, ""},
[4] = {0, ""},
[5] = {0, ""},
[6] = {0, ""},
[7] = {0, ""},
[8] = {0, ""},
[9] = {0, ""},
[10] = {0, ""},
[11] = 1
},
[6] = { --ADVENTURE_TWOLANDS
[1] = {0, ""},
[2] = {0, ""},
[3] = {0, ""},
[4] = {0, ""},
[5] = {0, ""},
[6] = {0, ""},
[7] = {0, ""},
[8] = {0, ""},
[9] = {0, ""},
[10] = {0, ""},
[11] = 1
},
[7] = { --ADVENTURE_5
[1] = {0, ""},
[2] = {0, ""},
[3] = {0, ""},
[4] = {0, ""},
[5] = {0, ""},
[6] = {0, ""},
[7] = {0, ""},
[8] = {0, ""},
[9] = {0, ""},
[10] = {0, ""},
[11] = 1
}
}
}

 

Now you are going to want a table with each and every one of your mod's characters! oh yeah... my loop's able to handle more than 1 character!

 

GLOBAL.ModCharacters = { "wod" } --replace wod with your character's prefab name! and add other prefab names for your other characters!


local P = GLOBAL.GetPlayer
local INT = GLOBAL.MOD_MAXWELL_INTROS
local tonumber = GLOBAL.tonumber
 
local function ModMaxwellIntro(inst)
local Maxtalk = inst.components.maxwelltalker.speeches
for k,v in pairs(GLOBAL.ModCharacters) do
if P().prefab == v then
local INTROS = {}
for o = 1,7 do
local S = INT[v][o][#INT[v][o]]
local D = 0
if o == 1 then
D = 0
elseif o > 1 then
D = 2
end
if S == 1 then
table.insert(INTROS, {
delay = D,
appearsound = "dontstarve/maxwell/disappear",
voice = "dontstarve/maxwell/talk_LP",
appearanim = "appear",
idleanim= "idle",
dialogpreanim = "dialog_pre",
dialoganim="dial_loop",
dialogpostanim = "dialog_pst",
disappearanim = "disappear",
disableplayer = true,
skippable = true
})
elseif S > 1 then
table.insert(INTROS, {
delay = D,
appearsound = "dontstarve/maxwell/appear_adventure",
voice = "dontstarve/maxwell/talk_LP_world"..S,
appearanim = "appear"..S,
idleanim = "idle"..S.."_loop",
dialogpreanim = "dialog"..S.."_pre",
dialoganim ="dialog"..S.."_loop",
dialogpostanim = "dialog"..S.."_pst",
disappearanim = "disappear"..S,
disableplayer = true,
skippable = true
})
end
for i = 1,(#INT[v][o] - 1) do
table.insert(INTROS[o], {
string = INT[v][o][2],
wait = INT[v][o][1]
})
end
end
Maxtalk.SANDBOX_1 = INTROS[1]
Maxtalk.ADVENTURE_1 = INTROS[2]
Maxtalk.ADVENTURE_2 = INTROS[3]
Maxtalk.ADVENTURE_3 = INTROS[4]
Maxtalk.ADVENTURE_4 = INTROS[5]
Maxtalk.ADVENTURE_TWOLANDS = INTROS[6]
Maxtalk.ADVENTURE_5 = INTROS[7]
end
end
end
 
AddPrefabPostInit("maxwellintro", ModMaxwellIntro)

Link to comment
Share on other sites

  • Developer

So, typing [2] will give Maxwell a coat?

 

Example:

 

[1] = { --SANDBOX
[1] = {1, "So, Walrus Man"},
[2] = {3, "You want to learn how to make me wear a coat?"},
[3] = {1, "Simple."},
[4] = {2, "Do you see the first number up there?"},
[5] = {2, "Before the big \"SANDBOX\" word?"},
[6] = {2, "That marks the \"world\" you're currently in right now."},
[7] = {2, "1, would be sandbox."},
[8] = {2, "2 would be adventure world 1."},
[9] = {3, "And the other numbers the other adventure worlds."},
[10] = {4, "The numbers before my quote are the seconds I'll take to say my quote."},

[11] = {4, "And the ones before the \"=\" define the order I'll be saying my quotes."},

[12] = {5, "This is my 12th quote, I'll take 5 seconds to say it and I'll say it while wearing my dapper coat."},

[13] = {3, "Now that you have learned the basics."},

[14] = {3, "Allow me to teach you what you wanted to know all along."},

[15] = {5, "After all my speech you should open a last speech value, like if I was actually going to speak."},

[16] = {3, "That'll be my form, the \"Maxwell\" I'll appear as."},

[17] = {5, "1 would be dapper me, 2 would be me wearing a coat! all you need is a plain old lonely number there and you'll be fine!"},

[18] = {3, "I should end my speech here, oh, and remember!"},

[19] = {3, "Find something to eat before night comes."},

[20] = 2

}

Link to comment
Share on other sites

Does this go into the modmain as well?

local P = GLOBAL.GetPlayer
local INT = GLOBAL.MOD_MAXWELL_INTROS
local tonumber = GLOBAL.tonumber
 
local function ModMaxwellIntro(inst)
local Maxtalk = inst.components.maxwelltalker.speeches
for k,v in pairs(GLOBAL.ModCharacters) do
if P().prefab == v then
local INTROS = {}
for o = 1,7 do
local S = INT[v][o][#INT[v][o]]
local D = 0
if o == 1 then
D = 0
elseif o > 1 then
D = 2
end
if S == 1 then
table.insert(INTROS, {
delay = D,
appearsound = "dontstarve/maxwell/disappear",
voice = "dontstarve/maxwell/talk_LP",
appearanim = "appear",
idleanim= "idle",
dialogpreanim = "dialog_pre",
dialoganim="dial_loop",
dialogpostanim = "dialog_pst",
disappearanim = "disappear",
disableplayer = true,
skippable = true
})
elseif S > 1 then
table.insert(INTROS, {
delay = D,
appearsound = "dontstarve/maxwell/appear_adventure",
voice = "dontstarve/maxwell/talk_LP_world"..S,
appearanim = "appear"..S,
idleanim = "idle"..S.."_loop",
dialogpreanim = "dialog"..S.."_pre",
dialoganim ="dialog"..S.."_loop",
dialogpostanim = "dialog"..S.."_pst",
disappearanim = "disappear"..S,
disableplayer = true,
skippable = true
})
end
for i = 1,(#INT[v][o] - 1) do
table.insert(INTROS[o], {
string = INT[v][o][2],
wait = INT[v][o][1]
})
end
end
Maxtalk.SANDBOX_1 = INTROS[1]
Maxtalk.ADVENTURE_1 = INTROS[2]
Maxtalk.ADVENTURE_2 = INTROS[3]
Maxtalk.ADVENTURE_3 = INTROS[4]
Maxtalk.ADVENTURE_4 = INTROS[5]
Maxtalk.ADVENTURE_TWOLANDS = INTROS[6]
Maxtalk.ADVENTURE_5 = INTROS[7]
end
end
end
 
AddPrefabPostInit("maxwellintro", ModMaxwellIntro)
 
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...