Hey bazuso & Isaac,
very strange indeed that the weapons dont respond
Spawning another weapon on the ground and attacking with it works fine
Also if setCustomPC is activated via a floor trigger then it works fine too
- not sure why the weapons wont respond if setCustomPC is called in-script.
Sorry - quick response - about to head out but will have another look soon
Akroma
New modder, need help (Default party, custom class)
Re: New modder, need help (Default party, custom class)
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: New modder, need help (Default party, custom class)
But at least that means it's usable.akroma222 wrote:Hey bazuso & Isaac,
Also if setCustomPC is activated via a floor trigger then it works fine too
I find that it also works when triggered by delayedCall.
So here it is; adjusted:
Code: Select all
--Set a Custom Party: version 0.9a
--By Isaac
function setCustomPC()
local function rnd(min,max) if max then return math.random(min,max) else return math.random(min) end end
local characters = {
{--PC #1
enabled = true,
name = "test1",
race = "minotaur",
sex = "male",
class = "farmer",
portrait = "minotaur_male_02",
isCustomPortrait = false,
stats = {strength = rnd(15), dexterity = rnd(15), vitality = 56, willpower = rnd(15)}, --remember to account for racial Stat Bonuses!
traits = {"head_hunter",},
skills = {
alchemy=0, accuracy=1, athletics=3, critical=0,
concentration=0, light_weapons=0, heavy_weapons=2,
missile_weapons=0, throwing=0, firearms=0, armors=2,
earth_magic=0, water_magic=0, fire_magic=0, dodge=0,
air_magic=0,
},
equipped = {
"hand_axe", --Weapon
"", -- OffHand
"peasant_cap", --Head
"leather_brigandine", --Chest
"", --Legs
"", --Feet
"", --Cloak
"", --Necklace
"leather_gloves", --Gloves
"", --Bracers
"fire_bomb", --Weapon2
"", --Offhand2
},
Backpack = {"dagger", "pitroot_bread","dagger", "pitroot_bread","dagger", "pitroot_bread",
"dagger", "pitroot_bread","dagger", "pitroot_bread","dagger", "pitroot_bread",
"dagger", "pitroot_bread","dagger", "pitroot_bread","dagger", "pitroot_bread",
"dagger", "potion_healing",}, -- 20 comma separated items max
},
{--PC #2
enabled = true,
name = "test2",
race = "minotaur",
sex = "male",
class = "fighter",
portrait = "minotaur_male_11",
isCustomPortrait = true,
stats = {strength = 20, dexterity = rnd(6,20), vitality = rnd(15,22), willpower = rnd(20)},
traits = {"head_hunter",},
skills = {
alchemy=0, accuracy=0, athletics=2, critical=1,
concentration=0, light_weapons=2, heavy_weapons=1,
missile_weapons=0, throwing=0, firearms=1, armors=2,
earth_magic=0, water_magic=0, fire_magic=0, dodge=0,
air_magic=0,
},
equipped = {
"dagger", --Weapon
"", -- OffHand
"peasant_cap", --Head
"", --Chest
"", --Legs
"", --Feet
"", --Cloak
"", --Necklace
"", --Gloves
"", --Bracers
"", --Weapon2
"", --Offhand2
},
Backpack = {"dagger", "pitroot_bread", "potion_healing",},-- 20 comma separated items max
},
{--PC #3
enabled = true,
name = "test3",
race = "insectoid",
sex = "female",
class = "rogue",
portrait = "insectoid_female_03",
isCustomPortrait = false,
stats = {strength = rnd(16), dexterity = rnd(6,20), vitality = 16, willpower = rnd(16,20)},
traits = {},
skills = {
alchemy=3, accuracy=3, athletics=0, critical=1,
concentration=4, light_weapons=0, heavy_weapons=0,
missile_weapons=0, throwing=0, firearms=0, armors=2,
earth_magic=0, water_magic=0, fire_magic=0, dodge=1,
air_magic=0,
},
equipped = {
"dagger", --Weapon
"", -- OffHand
"peasant_cap", --Head
"", --Chest
"", --Legs
"", --Feet
"", --Cloak
"", --Necklace
"", --Gloves
"", --Bracers
"", --Weapon2
"", --Offhand2
},
Backpack = {"dagger", "pitroot_bread", "potion_healing",},-- 20 comma separated items max
},
{--PC #4
enabled = true,
name = "test4",
race = "human",
sex = "female",
class = "wizard",
portrait = "human_female_03",
isCustomPortrait = false,
stats = {strength = 20, dexterity = rnd(6,20), vitality = 16, willpower = rnd(15,20)},
traits = {},
skills = {
alchemy=1, accuracy=3, athletics=1, critical=0,
concentration=4, light_weapons=0, heavy_weapons=0,
missile_weapons=0, throwing=0, firearms=0, armors=0,
earth_magic=1, water_magic=0, fire_magic=2, dodge=1,
air_magic=1,
},
equipped = {
"dagger", --Weapon
"", -- OffHand
"peasant_cap", --Head
"", --Chest
"", --Legs
"", --Feet
"", --Cloak
"", --Necklace
"", --Gloves
"", --Bracers
"", --Weapon2
"", --Offhand2
},
Backpack = {"dagger", "pitroot_bread", "potion_healing",},-- 20 comma separated items max
},
}
--**************************************************************************************
local function setEnabledPCs()
for x,PC in pairs(characters) do
local champ = party.party:getChampion(x)
champ:setEnabled(PC["enabled"])
end
end
setEnabledPCs()
local function setSkills(champ, skills)
for k,v in pairs(skills) do
champ:trainSkill(k,champ:getSkillLevel(k)*-1, false)
champ:trainSkill(k,v)
end
champ:upgradeBaseStat("health", champ:getMaxHealth()-champ:getHealth())
champ:upgradeBaseStat("energy", champ:getMaxEnergy()-champ:getEnergy())
champ:setSkillPoints(0)
end
local function setStats(champ, stats)
for k,v in pairs(stats) do
champ:setBaseStat(k,v)
end
end
for pos,PC in pairs(characters) do
local champ = party.party:getChampion(pos)
if champ:getEnabled() then
champ:setRace(PC["race"])
champ:setName(PC["name"])
champ:setSex(PC["sex"])
local filepath = iff(characters[pos]["isCustomPortrait"],"mod_","").."assets/textures/portraits/"..characters[pos]["portrait"]..".tga"
champ:setPortrait(filepath)
champ:setClass(PC["class"])
setStats(champ, PC["stats"])
setSkills(champ, PC["skills"])
if #PC["traits"] > 0 then
for x = 1, #PC["traits"] do
champ:addTrait(characters[pos]["traits"][x])
end
end
for x = 1,12 do
if #PC["equipped"][x] > 0 then
champ:insertItem(x,spawn(PC["equipped"][x]).item)
end
end
if #PC["Backpack"] then
for x = 1, #PC["Backpack"] do
champ:insertItem(x+12,spawn(PC["Backpack"][x]).item)
end
end
end
end
for x=1,5 do hudPrint("") end
delayedCall(self.go.id, .2, "fixHealth")
end
function fixHealth()
for x = 1, 4 do
local champ = party.party:getChampion(x)
if champ:getEnabled() then
champ:setHealth(champ:getMaxHealth())
champ:setEnergy(champ:getMaxEnergy())
end
end
end
delayedCall(self.go.id, .1, "setCustomPC")
Re: New modder, need help (Default party, custom class)
Ahh I do remember (not well though) someone mentioning that we should use delayedCall if calling scripts upon initializingIsaac wrote: find that it also works when triggered by delayedCall.
I really cant remember who or in what context
I run about 10 delayedCalls from the Party Component's onInit hook
One of them sets the Race / Class Traits for all champions (even the hidden traits like Hand Caster)
Ive found its a much better way to handle things than listing traits in the race / class definitions
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: New modder, need help (Default party, custom class)
Bazuso, how is your modding coming along?Second, is it possible to have unarmed damage increase as one class levels up? I want to make a hand-to-hand focused class but I am not sure how to go about this. My current idea is just to have their unarmed damage increase by some percentage for every time they level up, or maybe even have gloves become a factor as well. I'm also wondering if it's possible to have them "dual wield" their fists so that they can attack with one after the other, rather than just hit once and only be able to attack again after the cooldown. The light weapon mastery trait doesn't affect this because fists aren't considered light weapons.
I would be really grateful for any help or information that anyone could share. If I get deeper into the modding then I imagine I'll likely have more questions later as well. Thanks in advance
Re-read your original post and realized you are thinking of doing the same as Ive done with Unarmed (including 'gloves')
If this is still something you are looking at?
Akroma
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)