Page 1 of 2

Deal damage to party

Posted: Sat Mar 21, 2015 6:05 pm
by Emera Nova
So I'm thinking of making a puzzle that as you do it the party takes damage, problem I could see happening with it would be it breaking if a champion is already dead.

So I'm guessing the script would need to first check to see if each champion is still alive, and if not skip that champion for the damage. And then it would need to deal the damage to other champions.

Idea's on the script itself?

Re: Deal damage to party

Posted: Sat Mar 21, 2015 10:41 pm
by minmay
damaging dead champions is not a problem unless perhaps you try to do it in a really weird way like with setHealth

Re: Deal damage to party

Posted: Sun Mar 22, 2015 4:56 pm
by Emera Nova
So I have this which I thought would be the answer to the deal damage to party but its not working so something is wrong.

Code: Select all

function Damage()
	party.party:getChampion:damage(5, fire)
end

Re: Deal damage to party

Posted: Sun Mar 22, 2015 5:02 pm
by THOM
You have to specify which champion is meant. Also you have to bring fire into quotationmarks:

Code: Select all

function Damage()
   party.party:getChampion(1):damage(5, "fire")
end
This will deal damage only to champion number one.

Re: Deal damage to party

Posted: Sun Mar 22, 2015 5:10 pm
by Emera Nova
:o O was so close with that makes sense that you would have to tell it which one tho. ^-^its working now tho so yay! xD Now to just solve my gun problems and I'll be set to move on with my dungeon.

Re: Deal damage to party

Posted: Tue Mar 24, 2015 7:07 am
by Eleven Warrior
Hi Thom. I cant remember the code for damage whole party not just one member any help please thxs :)

Re: Deal damage to party

Posted: Tue Mar 24, 2015 7:41 am
by Isaac
Eleven Warrior wrote:Hi Thom. I cant remember the code for damage whole party not just one member any help please thxs :)
Well, you can either loop through the party, or use damageTile on the party's location.

Code: Select all

function partyDamage()
for x = 1,4 do
   local t = party.party:getChampion(x) 
   t:damage(5, "fire")
   playSound("damage_"..t:getRace().."_"..t:getSex())
end
end

Code: Select all

function partyDamage()
  damageTile(party.level, party.x, party.y, party.facing, party.elevation, 512, "fire", 5)
  for x = 1,4 do
   local t = party.party:getChampion(x) 
   playSound("damage_"..t:getRace().."_"..t:getSex())
end
end

Re: Deal damage to party

Posted: Tue Mar 24, 2015 9:51 am
by Eleven Warrior
Thxs Issac awesome man :)

Re: Deal damage to party

Posted: Tue Mar 24, 2015 10:19 am
by THOM
This would work also

Code: Select all

function Damage()
   party.party:getChampion(1):damage(5, "fire")
   party.party:getChampion(2):damage(5, "fire")
   party.party:getChampion(3):damage(5, "fire")
   party.party:getChampion(4):damage(5, "fire")
end
Sometimes solutions are very obvious...

Re: Deal damage to party

Posted: Tue Mar 24, 2015 3:34 pm
by Isaac
THOM wrote:This would work also

Code: Select all

function Damage()
   party.party:getChampion(1):damage(5, "fire")
   party.party:getChampion(2):damage(5, "fire")
   party.party:getChampion(3):damage(5, "fire")
   party.party:getChampion(4):damage(5, "fire")
end
Sometimes solutions are very obvious...
This is good too. I wonder why damageTile and :damage() do not cause champion sounds for the injury?