Page 1 of 1
Game Over Script help
Posted: Sun Mar 27, 2016 2:54 pm
by WaspUK1966
I've found a flaw in the code I've used in my mod. Basically, I have a floor trigger in a fire pit that starts a timer when you land on it. This timer runs a script every second which damages the party by a certain amount until you get out of the pit, which sets off another floor trigger to stop the timer.
Code: Select all
function causedamage()
party.party:playScreenEffect("damage_screen")
playSound("champion_die")
for i=1,4 do
if party.party:getChampion(i):isAlive() then
party.party:getChampion(i):modifyBaseStat("health", -8)
else
end
end
end
But obviously, as ive found out, if you dont get out of the pit, it will keep repeating even though all the party is dead. I assumed the game would automatically end when all your party had died. How can I code it so that it ends the game when all the party is dead (game over screen) and turns off the timer etc.
Any help greatly appreciated
George
Re: Game Over Script help
Posted: Sun Mar 27, 2016 6:03 pm
by minmay
Don't use Champion:modifyBaseStat() to do damage, it will screw everything up. Use Champion:damage().
Re: Game Over Script help
Posted: Sun Mar 27, 2016 11:46 pm
by vieuxchat
Doesn't modifyBaseStat change your "Max" values ?
So you don't "damage" your champions, you reduce they maximum health. The game probably don't check for death after changing base stats.
Re: Game Over Script help
Posted: Mon Mar 28, 2016 1:44 pm
by WaspUK1966
So how do I use Champion:damage() in my code, instead of what I used? I've tried all combos I can think of and keep getting errors.
Thanks
George
Re: Game Over Script help
Posted: Mon Mar 28, 2016 2:18 pm
by vieuxchat
Try that :
Code: Select all
for i = 1,4 do
party.party:getChampion(i):damage(math.random(8,15),"physical")
party.party:getChampion(i):playDamageSound()
end
just change the math.random() part for whatever value you want.
Change "physical" for "shock" for instance if you want shock damage. (here is the damage type list : “physical”, “fire”, “poison”, “cold”, “shock”)
Re: Game Over Script help
Posted: Mon Mar 28, 2016 2:33 pm
by AndakRainor
I use this in my gameOver function:
Code: Select all
for i = 1,4 do
local c = party.party:getChampionByOrdinal(i)
c:damage(c:getMaxHealth()*1000, "pure")
end
Re: Game Over Script help
Posted: Mon Mar 28, 2016 3:02 pm
by WaspUK1966
Thank you so much for that! Works brilliantly. Now my Mod will work as it should. Will release soon once several tweaks are completed. Thanks once again (was giving me a bad headache!)
George