---------------------------------
-Added a sdpInventory(ID,"Item1","Item2","Item3",...) function to add the Items you want to the champ. For now
you can't add more than 1 item per inventoryslot (I'll change this later on)
-Added sdpGetNextChamp(), this function returns the first disabled champion slot. Returns 0 if none is found.
---
There are probably a few bugs since its written fully with nodepad++ without much testing so,
posting any bugs, requests or suggestions are appreciated and will help me a lot!
I. Instruction
What is SDP?
SDP allows you to change the basics of your party(stats,equipment,level etc) without knowing lua.
I want to make it easy to use for non-scripter and also powerful for scripters.
II. Installation
1. Copy&Paste the script below to a script_entity.
2. Set the things how you want it.
3. Done
4. For more complex things see the script section below.
III. Configuration
sdpEnable: This boolean enables(true) or disbales(false) this whole script. This could be usefull if you want to
use this script for testing your map but don't wanna use it for the normal player.
sdpUseDefaultOnly: If enabled(true), sdp will only run if the player uses the default party. (not custom made)
sdpDefaultSats: If this is enabled(true), this script will automatically sets the stats of the
party based of the race and class. (this doesn't work fully because changing vitallity/willpower doesn't affect health and energy.
Maybe a bug?)
sdpSetChamp(ID,ENABLE,LEVEL,NAME,RACE,CLASS,GENDER,PORTRAIT)
ENABLE - Enables(true) or disables(false) the champion. (boolean)
LEVEL - Sets the level of the champion. (number)
NAME - Changes the name of the Champion (string)
RACE - Changes the race: "Human", "Minotaur" or "Lizardman". (string)
CLASS - Changes the class: "Fighter", "Rogue" or "Mage". (string)
GENDER - Changes the sex: "male" or "female" (keep it lowercase!) (string)
PORTRAIT - Changes the portrait of the champion (string)
sdpStats(ID,HEALTH,ENERGY,STR,DEX,VIT,WIL,PROTECTION,EVASION,RES_FIRE,RES_COLD,RES_POISON,RES_SHOCK)
HEALTH - Sets the health of the champion. (number)
ENERGY - Sets the energy of the champion. (number)
STR - Sets the strength of the champion. (number)
... (same for the rest)
sdpEquip(ID,LEFTHAND,RIGHTHAND,HELMET,TORSO,LEG,FEET,CLOAK,NECK,GAUNTLET,BRACERS)
LEFTHAND - Sets the item on the left hand (string)
RIGHTHAND - Sets the item on the right hand (string)
HELMET - Sets the helm slot of the champion (string)
... (same for the rest again)
Item1 - (string)
Item2 - (string)
... (up to all backpack slots)
--- currently you can't add more than 1 item per slot (I'll change this later on)
comment it with "--" (without the quotes).
IV. Script section
This script comes with a new function called "sdpChamp(champID)" which is a shorter version of "party:getChampion(champID)",
so instead of writing "party:getChampion(1):setStatMax("health",100)" you could write "sdpChamp(1):setStatMax("health",100)"
to keep your code smaller/cleaner. Everything you write here will override the settings you made above!
Now let's do some scripting!
Let's check if the first champion have the name "Hax" if yes, then change his health to 1000.
Code: Select all
if sdpChamp(1):getName("Hax") then
sdpChamp(1):setStatMax("health",1000)
end
Code: Select all
sdpEnable = true -- Set this to false if you don't want to use sdp.
sdpUseDefaultOnly = false -- Set this to true if you only want to change the default party (not custom).
sdpDefaultSats = false --[[ Set this to true if the script should
automatically set the stats(STR,INT...)
based on race and class. ]]--
function setDefaultParty()
sdpSetChamp(1,true,1,"ContarStonesKull","Human","Fighter","male",nil)
sdpSetChamp(2,true,1,"Mork","Minotaur","Fighter","male",nil)
sdpSetChamp(3,true,1,"Yennica Whitefeather","Human","Rogue","female",nil)
sdpSetChamp(4,true,1,"Sancsaron","Human","Mage","male",nil)
sdpStats(1, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
sdpStats(2, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
sdpStats(3, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
sdpStats(4, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
sdpEquip(1, nil,"torch", nil, nil, nil, nil, nil, nil, nil, nil)
sdpEquip(2, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
sdpEquip(3, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
sdpEquip(4, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
sdpInventory(1,{})
sdpInventory(2,{})
sdpInventory(3,{})
sdpInventory(4,{})
-- add custom party-scripts here
-----
end
function sdpSetStatHuman(champID)
party:getChampion(champID):setStatMax("health",60)
party:getChampion(champID):setStatMax("energy",50)
party:getChampion(champID):setStatMax("strength",10)
party:getChampion(champID):setStatMax("dexterity",10)
party:getChampion(champID):setStatMax("vitality",10)
party:getChampion(champID):setStatMax("willpower",10)
party:getChampion(champID):setStatMax("resist_fire",0)
party:getChampion(champID):setStatMax("resist_cold",0)
party:getChampion(champID):setStatMax("resist_poison",0)
party:getChampion(champID):setStatMax("resist_shock",0)
end
function sdpSetStatMinotaur(champID)
party:getChampion(champID):setStatMax("health",70)
party:getChampion(champID):setStatMax("energy",42)
party:getChampion(champID):setStatMax("strength",15)
party:getChampion(champID):setStatMax("dexterity",6)
party:getChampion(champID):setStatMax("vitality",14)
party:getChampion(champID):setStatMax("willpower",7)
party:getChampion(champID):setStatMax("resist_fire",0)
party:getChampion(champID):setStatMax("resist_cold",8)
party:getChampion(champID):setStatMax("resist_poison",8)
party:getChampion(champID):setStatMax("resist_shock",0)
end
function sdpSetStatLizardman(champID)
party:getChampion(champID):setStatMax("health",60)
party:getChampion(champID):setStatMax("energy",47)
party:getChampion(champID):setStatMax("strength",10)
party:getChampion(champID):setStatMax("dexterity",12)
party:getChampion(champID):setStatMax("vitality",10)
party:getChampion(champID):setStatMax("willpower",9)
party:getChampion(champID):setStatMax("resist_fire",2)
party:getChampion(champID):setStatMax("resist_cold",0)
party:getChampion(champID):setStatMax("resist_poison",0)
party:getChampion(champID):setStatMax("resist_shock",2)
end
function sdpSetStatInsectoid(champID)
party:getChampion(champID):setStatMax("health",55)
party:getChampion(champID):setStatMax("energy",60)
party:getChampion(champID):setStatMax("strength",8)
party:getChampion(champID):setStatMax("dexterity",11)
party:getChampion(champID):setStatMax("vitality",8)
party:getChampion(champID):setStatMax("willpower",14)
party:getChampion(champID):setStatMax("resist_fire",1)
party:getChampion(champID):setStatMax("resist_cold",0)
party:getChampion(champID):setStatMax("resist_poison",0)
party:getChampion(champID):setStatMax("resist_shock",1)
end
function sdpSetChamp(champID, champAllow, champLevel, champName, champRace, champClass, champGender, champPortrait)
if champAllow ~= true then
party:getChampion(champID):setEnabled(champAllow)
end
if champName then
party:getChampion(champID):setName(champName)
end
if champRace then
party:getChampion(champID):setRace(champRace)
end
if champClass then
party:getChampion(champID):setClass(champClass)
end
if champGender then
party:getChampion(champID):setSex(champGender)
end
if champPortrait then
party:getChampion(champID):setPortrait(champPortrait)
end
if sdpDefaultSats then
if party:getChampion(champID):getRace() == "Human" then
sdpSetStatHuman(champID)
sdpCheckClass(champID)
elseif party:getChampion(champID):getRace() == "Minotaur" then
sdpSetStatMinotaur(champID)
sdpCheckClass(champID)
elseif party:getChampion(champID):getRace() == "Lizardman" then
sdpSetStatLizardman(champID)
sdpCheckClass(champID)
else
sdpSetStatInsectoid(champID)
sdpCheckClass(champID)
end
end
while party:getChampion(champID):getLevel() <= champLevel-1 do
party:getChampion(champID):levelUp()
end
end
function sdpEquip(champID, champLeftH, champRightH, champHelmet, champTorso, champLeg, champFeet, champCloak, champNeck, champGauntlet, champBracers)
if champLeftH then
party:getChampion(champID):insertItem(7,spawn(champLeftH))
end
if champRightH then
party:getChampion(champID):insertItem(8,spawn(champRightH))
end
if champHelmet then
party:getChampion(champID):insertItem(1,spawn(champHelmet))
end
if champTorso then
party:getChampion(champID):insertItem(2,spawn(champTorso))
end
if champLeg then
party:getChampion(champID):insertItem(3,spawn(champLeg))
end
if champFeet then
party:getChampion(champID):insertItem(4,spawn(champFeet))
end
if champCloak then
party:getChampion(champID):insertItem(5,spawn(champCloak))
end
if champNeck then
party:getChampion(champID):insertItem(6,spawn(champNeck))
end
if champGauntlet then
party:getChampion(champID):insertItem(9,spawn(champGauntlet))
end
if champBracers then
party:getChampion(champID):insertItem(10,spawn(champBracers))
end
end
function sdpStats(champID, champHealth, champEnergy, champStr, champDex, champVit, champWil, champProtection, champEvasion, champResFire, champResCold, champResPoison, champResShock)
if champHealth then
party:getChampion(champID):setStatMax("health",champHealth)
end
if champEnergy then
party:getChampion(champID):setStatMax("energy",champEnergy)
end
if champStr then
party:getChampion(champID):setStatMax("strength",champStr)
end
if champDex then
party:getChampion(champID):setStatMax("dexterity",champDex)
end
if champVit then
party:getChampion(champID):setStatMax("vitality",champVit)
end
if champWil then
party:getChampion(champID):setStatMax("willpower",champWil)
end
if champProtection then
party:getChampion(champID):setStatMax("protection",champProtection)
end
if champEvasion then
party:getChampion(champID):setStatMax("evasion",champEvasion)
end
if champResFiret then
party:getChampion(champID):setStatMax("resist_fire",champResFire)
end
if champResCold then
party:getChampion(champID):setStatMax("resist_cold",champResCold)
end
if champResPoison then
party:getChampion(champID):setStatMax("resist_poison",champResPoison)
end
if champResShock then
party:getChampion(champID):setStatMax("resist_shock",champResShock)
end
end
function sdpInventory(champID, itemTable)
for v,i in ipairs(itemTable) do
party:getChampion(champID):insertItem(v+10,spawn(i))
end
end
function sdpCheckClass(champID)
if party:getChampion(champID):getClass() == "Mage" then
party:getChampion(champID):modifyStatCapacity("health",-25)
elseif party:getChampion(champID):getClass() == "Rogue" then
party:getChampion(champID):modifyStatCapacity("health",-15)
end
end
function sdpChamp(champID)
return party:getChampion(champID)
end
function sdpGetNextChamp()
for p=1,4 do
if party:getChampion(p):getEnabled() == false then
return p
end
end
return 0
end
if sdpEnable then
if sdpUseDefaultOnly and party:getChampion(1):getName() == "ContarStonesKull" then
setDefaultParty()
elseif sdpUseDefaultOnly == false then
setDefaultParty()
end
end