Hey guys,
can someone tell me how to open a door if one of the champion have a certain level of a certain skills?
like:
if Champion(1) or Champion(2) or Champion(3) or Champion(4:) has skills ("spellcraft") level 15 then door_1:open()
I ve see this code in the script repository but I can't adapt it as what I want
function teststat(stat, value, xpmin, xpmax)
local astat = {}
astat[1] = party:getChampion(1):getStat("vitality")
astat[2] = party:getChampion(2):getStat("strength")
astat[3] = party:getChampion(3):getStat("dexterity")
astat[4] = party:getChampion(4):getStat("willpower")
local aname = {}
aname[1] = party:getChampion(1):getName()
aname[2] = party:getChampion(2):getName()
aname[3] = party:getChampion(3):getName()
aname[4] = party:getChampion(4):getName()
for i=1,4 do
if astat[i] < math.random(10) then
-- 10 le niveau de stat a tester
hudPrint(aname[i].." doesn't learn anything.")
else
local experiencegained = math.random(100,200)
-- xpmin 100 et xpmax 200
hudPrint(aname[i].." succeeds to understand what is going on and gain "..experiencegained.." XP." )
party:getChampion(i):gainExp(experiencegained)
end
end
end
function doorCheck()
local level_check = false
local level = 0
for x = 1,4 do
level = party:getChampion(x):getSkillLevel("spellcraft")
if level => 15 then
level _check = true
break
else
level_check = false
end
end
if level_check then
special_door:open()
else
special_door:close()
hudPrint("You are too wimpy to open this door, come back when you are tougher!")
end
end
This is not tested and I may have some syntax error, but should get you close.
function doorCheck()
local level_check = false
local level = 0
for x = 1,4 do
level = party:getChampion(x):getSkillLevel("spellcraft")
if level > 15 then
level_check = true
break
else
level_check = false
end
end
if level_check then
door_1:open()
else
door_1:close()
hudPrint("You are too wimpy to open this door, come back when you are tougher!")
end
end