PSMD Scripting
This page lists snippets of LUA code that can be used to achieve various tasks.
In examples below, the placeholder "[string]" can be replaced with an integer equal to the ID of the desired string resource or with a short inline string. When using an inline string, only certain characters will be displayed in game (meaning no spaces separating words). Because of this, it is recommended to use string resources when possible.
Harmony Scarf Evolution
CHARA:PreLoadHeroPartnerFinalEvlolution() CUT:Load(SymCut("m15_120_06")) SOUND:PlayBgm(SymSnd("BGM_EVE_HENSHIN"), Volume(256)) SOUND:FadeInEnv(SymSnd("SE_EVT_FINAL_EV_BACK_LP"), TimeSec(0.5), Volume(128)) CUT:Play() CUT:Wait() CUT:Destroy() CAMERA:SetSisaAzimuthDifferenceVolume(Volume(1.5)) CAMERA:SetSisaRateVolume(Volume(1)) TASK:Sleep(TimeSec(0.5)) CAMERA:SetEye(SymCam("CAMERA_00")) CAMERA:SetTgt(SymCam("CAMERA_00")) CAMERA:SetFovy(SymCam("CAMERA_00")) SCREEN_A:WhiteIn(TimeSec(0.5), false)
Select Chain
WINDOW:SelectStart() -- The values in each WINDOW:SelectChain are customizable. -- If so many are added that they do not all fit on the screen, pressing up and down will wrap around what's visible, and left and right will swap pages WINDOW:SelectChain([string], 0) WINDOW:SelectChain([string], 1) WINDOW:SelectChain([string], 2) WINDOW:DefaultCursor(0) -- Can be set to any value already set; in this case, 0, 1, or 2 local id = WINDOW:SelectEnd(MENU_SELECT_MODE.DISABLE_CANCEL) -- TODO: Add your own logic to respond to `id` WINDOW:CloseMessage()
Basic Player/Partner Species Change
Written by psy_commando. Mis-spelt variables are references to variables from seikakushindan.lua (the starting sequence script).
repeat WINDOW:CloseMessage() WINDOW:SysMsg("Select _ Pokemons ?(Menu#2)") WINDOW:SelectStart() WINDOW:SelectChain("Done", 0) WINDOW:SelectChain("Set Hero pkid", 1) WINDOW:SelectChain("Set Partner pkid", 2) WINDOW:DefaultCursor(0) local id = WINDOW:SelectEnd(MENU_SELECT_MODE.DISABLE_CANCEL) if id == 1 then WINDOW:SysMsg( "--- Changing _ Hero _ pokemon _ id ---" ) local oldpokemonid = SymAct("HERO"):GetIndex() local menu = MENU:CreateNumericMenuWindow(ScreenType.A) menu:SetLayoutRect(Rectangle(96, 80, 132, 84)) menu:SetPlace(3) menu:SetDigit(3) menu:SetStartNum(initval) menu:SetType(NUM_MENU_TYPE.TYPE_DIGIT_ON) menu:SetTextOffset(24, 40) function menu:decideAction() charname = self:GetSettingData() GROUND:SetHero(charname, 0) CHARA:ReloadHeroPartner() self:Close() end function menu:cancelAction() charname = oldpokemonid GROUND:SetHero(charname, 0) CHARA:ReloadHeroPartner() self:Close() end menu:Open() menu:SetCaption("Pokemon ID") MENU:SetFocus(menu) MENU:WaitClose(menu) elseif id == 2 then WINDOW:SysMsg( "--- Changing _ Partner _ pokemon _ id ---" ) local oldpokemonid = SymAct("HERO"):GetIndex() local menu = MENU:CreateNumericMenuWindow(ScreenType.A) menu:SetLayoutRect(Rectangle(96, 80, 132, 84)) menu:SetPlace(3) menu:SetDigit(3) menu:SetStartNum(initval) menu:SetType(NUM_MENU_TYPE.TYPE_DIGIT_ON) menu:SetTextOffset(24, 40) function menu:decideAction() pertnername = self:GetSettingData() GROUND:SetPartner(pertnername, 0) CHARA:ReloadHeroPartner() self:Close() end function menu:cancelAction() pertnername = oldpokemonid GROUND:SetPartner(pertnername, 0) CHARA:ReloadHeroPartner() self:Close() end menu:Open() menu:SetCaption("Pokemon ID") MENU:SetFocus(menu) MENU:WaitClose(menu) end until id == 0
Portrait Face Types
In PSMD, a Pokémon's portrait comes in multiple varieties, each with different facial expressions. These varieties are referred to as "face types."
In dialogue, the shown portrait's face type is determined by the script, such as below:
WINDOW:DrawFace(20, 88, SymAct("HERO"), FACE_TYPE.NORMAL)
Changing the face type in the script is simple, but it can also be changed in the middle of a dialogue message.
For example, including \B202 inside of a message will change the current portrait to the pain face type.
Not every Pokémon portrait comes in every face type. Most Pokémon only get normal, happy, and pain face type portraits.
Below is a table of the 20 face types the first evolution starters have.
Face Type | \B2xx | Description, Additional Notes |
---|---|---|
FACE_TYPE.NORMAL | \B200 | Smiling |
FACE_TYPE.HAPPY | \B201 | Happy eyes, mouth open |
FACE_TYPE.PAIN | \B202 | Head tilted downward, eyes shut, sweatdrop |
FACE_TYPE.ANGRY | \B203 | Angry eyes, frowning, EKG pattern background |
FACE_TYPE.THINK | \B204 | Head tilted to the side, frowning slightly |
FACE_TYPE.SAD | \B205 | Sad eyes, frowning slightly |
FACE_TYPE.WEEP | \B206 | Profusely weeping, tears flying everywhere, mouth open |
FACE_TYPE.SHOUT | \B207 | Eyes shut, mouth open as if shouting, radial stripes background |
FACE_TYPE.TEARS | \B208 | Sparkly eyes, tears on cheeks |
FACE_TYPE.DECIDE | \B209 | Angry eyes, frowning slightly |
FACE_TYPE.GLADNESS | \B20A | Arms raised, happy eyes, mouth open, happy-lines(?) background |
FACE_TYPE.EMOTION | \B20B | Sparkly eyes, mouth open, overall amazed/excited |
FACE_TYPE.SURPRISE | \B20C | Mouth open wide, sweatdrop, radial zigzag background |
FACE_TYPE.FAINT | \B20D | Dizzy eyes, off balance, sweatdrop, mouth open |
FACE_TYPE.RELIEF | \B20E | Head tilted downward, eyes shut, sweatdrop, mouth open as if sighing |
FACE_TYPE.CATCHBREATH | \B20F | Sweatdrop, mouth open, overall somewhat surprised |
FACE_TYPE.SPECIAL01 | \B210 | Sleeping portrait from GTI. Only GTI starters have this face type. |
FACE_TYPE.SPECIAL02 | \B211 | Like Normal, but with a slight frown. |
FACE_TYPE.SPECIAL03 | \B212 | Like Pain, but with left eye open, no sweatdrop, some Pokés grit their teeth |
FACE_TYPE.SPECIAL04 | \B213 | Head held high, smiling, overall proud |
There are more special face types past special04, but they are aren't available for the first evolution starters.
Credits
psy_commando for writing several samples and for pioneering PSMD script editing. evandixon for further research.
Edited by Gemzo
Recommended Comments
There are no comments to display.