SOLVED - dmg script help
SOLVED - dmg script help
I need help with script, which will dmg each character every 5sec, unless wearing specific chest armor(lets call it Coatl). Somebody help pls ?
Last edited by Drakkan on Fri Jan 18, 2013 12:33 pm, edited 1 time in total.
Re: dmg script help
the easiest way to hurt the party is with damageTile , but that wouldn't allow individual champions with the armor to avoid the damage. You can script loss of health and hurt sounds for individuals, but that's a little tricky
Finished Dungeons - complete mods to play
Re: dmg script help
well i think it would be something like (do not know commands, so just brief idea how it might probably work)Komag wrote:the easiest way to hurt the party is with damageTile , but that wouldn't allow individual champions with the armor to avoid the damage. You can script loss of health and hurt sounds for individuals, but that's a little tricky
for every champion
if champion1 slot 2 is equiped Coat then
do nothing
else dmgpchampion1
this make for everychampion to be repeated until x-second clock is disabled.
what you think ?
Re: dmg script help
The basic commands you will want are:
Champion:damage(amount, type)
Deals damage to the champion. Type must be “physical”, “fire”, “shock”, “poison” or “cold”.
Champion:playDamageSound()
Plays the damage sound which is determined by champion’s race and gender.
I haven't tested these, so I'm unsure if dealing damage in this way plays the damage sound anyway.
Since there are 4 champions you'll want to cycle through each and check if they are a) Enabled and b) Alive... if so, then check for the presence of the "Coat" in the Torso location... if it's missing deal damage.
This is theoretical code as I haven't had chance to check it.
Champion:damage(amount, type)
Deals damage to the champion. Type must be “physical”, “fire”, “shock”, “poison” or “cold”.
Champion:playDamageSound()
Plays the damage sound which is determined by champion’s race and gender.
I haven't tested these, so I'm unsure if dealing damage in this way plays the damage sound anyway.
Since there are 4 champions you'll want to cycle through each and check if they are a) Enabled and b) Alive... if so, then check for the presence of the "Coat" in the Torso location... if it's missing deal damage.
Code: Select all
for i=1,4 do
if party:getChampion(i):getEnabled() and party:getChampion(i):isAlive() then
if party:getChampion(i):getItem(2).name == "Coat" then
-- hudPrint("Coat found")
else
party:getChampion(i):damage(50, "fire")
party:getChampion(i):playDamageSound()
end
end
end
Puzzle Frameworks - http://www.grimrock.net/forum/viewtopic.php?f=14&t=4564
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Re: dmg script help
third row returnign error - attempt to index a nil value XGrimwold wrote:The basic commands you will want are:
Champion:damage(amount, type)
Deals damage to the champion. Type must be “physical”, “fire”, “shock”, “poison” or “cold”.
Champion:playDamageSound()
Plays the damage sound which is determined by champion’s race and gender.
I haven't tested these, so I'm unsure if dealing damage in this way plays the damage sound anyway.
Since there are 4 champions you'll want to cycle through each and check if they are a) Enabled and b) Alive... if so, then check for the presence of the "Coat" in the Torso location... if it's missing deal damage.
This is theoretical code as I haven't had chance to check it.Code: Select all
for i=1,4 do if party:getChampion(i):getEnabled() and party:getChampion(i):isAlive() then if party:getChampion(i):getItem(2).name == "Coat" then -- hudPrint("Coat found") else party:getChampion(i):damage(50, "fire") party:getChampion(i):playDamageSound() end end end
Re: dmg script help
Oops... forgot the case where the champion is wearing nothing on his Torso.
try:
try:
Code: Select all
for i=1,4 do
if party:getChampion(i):getEnabled() and party:getChampion(i):isAlive() then
if party:getChampion(i):getItem(2) ~= nil and party:getChampion(i):getItem(2).name == "Coat" then
-- hudPrint("Coat found")
else
party:getChampion(i):damage(50, "fire")
party:getChampion(i):playDamageSound()
end
end
end
Puzzle Frameworks - http://www.grimrock.net/forum/viewtopic.php?f=14&t=4564
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Re: dmg script help
working fine now, thanks !Grimwold wrote:Oops... forgot the case where the champion is wearing nothing on his Torso.
try:Code: Select all
for i=1,4 do if party:getChampion(i):getEnabled() and party:getChampion(i):isAlive() then if party:getChampion(i):getItem(2) ~= nil and party:getChampion(i):getItem(2).name == "Coat" then -- hudPrint("Coat found") else party:getChampion(i):damage(50, "fire") party:getChampion(i):playDamageSound() end end end
