SOLVED - dmg script help
Posted: Thu Jan 17, 2013 10:54 pm
I need help with script, which will dmg each character every 5sec, unless wearing specific chest armor(lets call it Coatl). Somebody help pls ?
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
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
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
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
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