Deal damage to party

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Deal damage to party

Post by minmay »

The same reason being hit by a fireball doesn't cause champion sounds for the injury.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Deal damage to party

Post by Eleven Warrior »

Isaac wrote:
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?
Also both Codes don't show a Screen effect like when the party dies from to much damage. In log 1 you see a big fiery screen when the party is dead yeah. I did it your way Thom, but Issacs had the Race sound which I needed. That's strange what Minmay said about the fireball, one would be screaming if they were hit by a ball of fire lol lol lol :)
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Deal damage to party

Post by minmay »

Some damage sources have screen effects. This includes most elemental damage and some of the "big" physical attacks (ogres, spike traps, etc.). There is no special screen effect associated with a game over, just the "GAME OVER" text. However if you get killed by damage that has a screen effect, then you will still see the screen effect if it kills the whole party; therefore, you see a "big fiery screen when the party is dead" if the party was just killed by a fireball.
If you want to play a screen effect with your damage then you need to either do so explicitly with PartyComponent:playScreenEffect(), or add a screen effect field to your TileDamagerComponent or MonsterAttackComponent.

And fireballs/frostbolts/ogre charges/spike traps/etc don't play champions' damage sounds because:
1. all four champions' damage sounds playing at once sounds awkward.
2. they already have screen effects or other dramatic effects, so the player does not need an audio cue to recognize that they have been damaged.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Deal damage to party

Post by Eleven Warrior »

Hi all. Ok I tried to add the Screen Fx to the party t:playScreenEffect("damage_screen") but it's not working. It comes up with error: Attemp to call method ' playScreenEffect' (a nil Value).

What I need is when this lot take damage the damage screen appears no matter where the party is. Any help please. I know it's possible just not sure what Minmay meant

Code: Select all

function PartyDie3a()

  damageTile(party.level, party.x, party.y, party.facing, party.elevation, 512, "fire", 2000)
  for x = 1,4 do
   local t = party.party:getChampion(x) 
   playSound("damage_"..t:getRace().."_"..t:getSex())
 	t:playScreenEffect("damage_screen") 
end
	end
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Deal damage to party

Post by minmay »

http://www.grimrock.net/modding/scripting-reference/
playScreenEffect is a method of PartyComponent, not Champion.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply