Inventory help
-
- Posts: 10
- Joined: Fri Sep 14, 2012 4:55 am
Inventory help
Hey guys, this is a simple question, is it possible to edit the starting inventory of characters? If so, how? Thanks, Fuzzyfrank.
EDIT: Also, how do i change the wall textures, thanks again, Fuzzyfrank.
EDIT 2: Nevermind about the second one, I got it. Under project, right click the level and then click properties.
EDIT: Also, how do i change the wall textures, thanks again, Fuzzyfrank.
EDIT 2: Nevermind about the second one, I got it. Under project, right click the level and then click properties.
Last edited by Fuzzyfrank on Fri Sep 14, 2012 5:23 am, edited 1 time in total.
Re: Inventory help
Since I have a similar question, how do you make it so the default party is one person, like Toorum.
-
- Posts: 10
- Joined: Fri Sep 14, 2012 4:55 am
Re: Inventory help
Good question, I wonder that too.Lmaoboat wrote:Since I have a similar question, how do you make it so the default party is one person, like Toorum.
Re: Inventory help
The scripting interface provides access to champions.
http://www.grimrock.net/modding/scripting-reference/
http://www.grimrock.net/modding/scripting-reference/
-
- Posts: 10
- Joined: Fri Sep 14, 2012 4:55 am
Re: Inventory help
Thank You.petri wrote:The scripting interface provides access to champions.
http://www.grimrock.net/modding/scripting-reference/
EDIT: for the line of code
Champion():removeItem(slot)
How would I say it so it would remove the torch from Contar Stoneskull's left hand?
Re: Inventory help
Assuming Contar is the first champion in the party:Fuzzyfrank wrote:How would I say it so it would remove the torch from Contar Stoneskull's left hand?
Code: Select all
party:getChampion(1):removeItem(7)
-
- Posts: 10
- Joined: Fri Sep 14, 2012 4:55 am
Re: Inventory help
Thank you. I'm new to scripting.petri wrote:Assuming Contar is the first champion in the party:Fuzzyfrank wrote:How would I say it so it would remove the torch from Contar Stoneskull's left hand?7 is the slot number of the left hand, defined in Champion:insertItem()'s documentation.Code: Select all
party:getChampion(1):removeItem(7)
Sorry to ask, but, how do I make the script run as soon as the player starts?
- SpiderFighter
- Posts: 789
- Joined: Thu Apr 12, 2012 4:15 pm
Re: Inventory help
Dunno if the OP found his answer, but I came across this during a search for something else and thought I'd tidy thigns up for future searches.
Just place a script_enitity in your map and leave it unconnected (and uncalled as a function) and it will run automatically. For example:Fuzzyfrank wrote:Sorry to ask, but, how do I make the script run as soon as the player starts?
SpoilerShow
local startknife = spawn("knife")
party:getChampion(1):insertItem(7,startknife)
party:getChampion(1):insertItem(7,startknife)
Re: Inventory help
In the Editing superthread here on the forum, you will find a section called SDP (Starting Default Party), and Like SpiderFighter says, you simply place the script entity in your dungeon. It allows you to choose which Champions are activated, what class/race/gender they are, thier starting stats and equipment. I have one of these set up in the mod I'm working on and will paste it below for you to reference. In this example, Champs 1,2 and 3 are active, slot 4 is not. Champ 2 starts with a machete in his left hand. Note that the three active characters use custom portraits, which are not in your mod and will need to be changed. Between this example and the instructions on the SDP script, u should be able to execute whatever you like
SDP thread:
viewtopic.php?f=14&t=3201
Example (working) SDP in a dungeon:
SDP thread:
viewtopic.php?f=14&t=3201
Example (working) SDP in a dungeon:
SpoilerShow
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 = true --[[ 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,"Silaria","Human","Rogue","female","mod_assets/portraits/silaria.dds")
sdpSetChamp(2,true,1,"Gromm","Minotaur","Fighter","male","mod_assets/portraits/gromm.dds")
sdpSetChamp(3,true,1,"Galaran","Human","Mage","male","mod_assets/portraits/galaran.dds")
sdpSetChamp(4,false,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,"dagger", nil, nil, nil, nil, nil, nil, nil, nil)
sdpEquip(2, nil, "machete", 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",100)
party:getChampion(champID):setStatMax("energy",100)
party:getChampion(champID):setStatMax("strength",14)
party:getChampion(champID):setStatMax("dexterity",18)
party:getChampion(champID):setStatMax("vitality",16)
party:getChampion(champID):setStatMax("willpower",15)
party:getChampion(champID):setStatMax("resist_fire",0)
party:getChampion(champID):setStatMax("resist_cold",0)
party:getChampion(champID):setStatMax("resist_poison",50)
party:getChampion(champID):setStatMax("resist_shock",0)
end
function sdpSetStatMinotaur(champID)
party:getChampion(champID):setStatMax("health",120)
party:getChampion(champID):setStatMax("energy",60)
party:getChampion(champID):setStatMax("strength",18)
party:getChampion(champID):setStatMax("dexterity",12)
party:getChampion(champID):setStatMax("vitality",18)
party:getChampion(champID):setStatMax("willpower",10)
party:getChampion(champID):setStatMax("resist_fire",0)
party:getChampion(champID):setStatMax("resist_cold",8)
party:getChampion(champID):setStatMax("resist_poison",50)
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
sdpUseDefaultOnly = false -- Set this to true if you only want to change the default party (not custom).
sdpDefaultSats = true --[[ 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,"Silaria","Human","Rogue","female","mod_assets/portraits/silaria.dds")
sdpSetChamp(2,true,1,"Gromm","Minotaur","Fighter","male","mod_assets/portraits/gromm.dds")
sdpSetChamp(3,true,1,"Galaran","Human","Mage","male","mod_assets/portraits/galaran.dds")
sdpSetChamp(4,false,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,"dagger", nil, nil, nil, nil, nil, nil, nil, nil)
sdpEquip(2, nil, "machete", 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",100)
party:getChampion(champID):setStatMax("energy",100)
party:getChampion(champID):setStatMax("strength",14)
party:getChampion(champID):setStatMax("dexterity",18)
party:getChampion(champID):setStatMax("vitality",16)
party:getChampion(champID):setStatMax("willpower",15)
party:getChampion(champID):setStatMax("resist_fire",0)
party:getChampion(champID):setStatMax("resist_cold",0)
party:getChampion(champID):setStatMax("resist_poison",50)
party:getChampion(champID):setStatMax("resist_shock",0)
end
function sdpSetStatMinotaur(champID)
party:getChampion(champID):setStatMax("health",120)
party:getChampion(champID):setStatMax("energy",60)
party:getChampion(champID):setStatMax("strength",18)
party:getChampion(champID):setStatMax("dexterity",12)
party:getChampion(champID):setStatMax("vitality",18)
party:getChampion(champID):setStatMax("willpower",10)
party:getChampion(champID):setStatMax("resist_fire",0)
party:getChampion(champID):setStatMax("resist_cold",8)
party:getChampion(champID):setStatMax("resist_poison",50)
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
Currently conspiring with many modders on the "Legends of the Northern Realms"project.
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Re: Inventory help
I use an even more direct version:SpiderFighter wrote: For example:Code: Select all
local startknife = spawn("knife") party:getChampion(1):insertItem(7,startknife)
Code: Select all
party:getChampion(1):insertItem(7,spawn("knife"))
Finished Dungeons - complete mods to play