Question on Falling Damage

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Musabb
Posts: 3
Joined: Sat Sep 15, 2012 5:19 pm

Question on Falling Damage

Post by Musabb »

Greetings. Tried to research this but was not successful.

I'd like to make a very deep trapdoor that drops the party several levels. When I do this, of course, I kill the party. I need a way to mitigate the fall damage resulting from the long fall or something equivalent.

Any help would be greatly appreciated. Thanks.
User avatar
Shroom
Posts: 98
Joined: Tue Mar 27, 2012 6:37 pm
Location: UK

Re: Question on Falling Damage

Post by Shroom »

Drop them down one level onto a teleporter which moves them to the final destination, which can be on any level - set it to invisible and silent if you dont want them to know
Musabb
Posts: 3
Joined: Sat Sep 15, 2012 5:19 pm

Re: Question on Falling Damage

Post by Musabb »

Thanks but I was hoping for the effect of seeing the party drop several levels into the pit and have them laboriously climb back up.

Dropping onto a teleporter doesn't work unfortunately as the teleporter ignores falling party members.
I can write a script that heals the party as soon as they land but the damage kills them first and ends the game before they can be healed.
Magus
Posts: 56
Joined: Wed Sep 12, 2012 6:05 pm

Re: Question on Falling Damage

Post by Magus »

Can't really find a way to change/remove the falldamage. The only thing i get to work is:
while falling remove all champions and add them after the player lands on the ground.

(The game isn't over if you remove all champions, only if they die)
User avatar
Shroom
Posts: 98
Joined: Tue Mar 27, 2012 6:37 pm
Location: UK

Re: Question on Falling Damage

Post by Shroom »

I dont know if they hit the floor first or the teleport, but if its the teleport, you could drop them and move them over multiple pits
theruler
Posts: 70
Joined: Sun Apr 15, 2012 11:19 am

Re: Question on Falling Damage

Post by theruler »

Let's say you want to make a pit 8 levels deep.
Have you tried to put a teleporter on 6th (in midair) and place its target on 7th?

EDIT: teleporter ignores falling stuff.
maybe it could be possible to modify the script in order to allow that. Remain to check if inertia is still transferred.
Anyway the solution proposed below is clevest.
Last edited by theruler on Sat Sep 15, 2012 7:41 pm, edited 2 times in total.
Lmaoboat
Posts: 359
Joined: Wed Apr 11, 2012 8:55 pm

Re: Question on Falling Damage

Post by Lmaoboat »

You could use a script that increases the parties max health by a lot, then lowers it by the same amount after they hit the ground.
Musabb
Posts: 3
Joined: Sat Sep 15, 2012 5:19 pm

Re: Question on Falling Damage

Post by Musabb »

Lmaoboat wrote:You could use a script that increases the parties max health by a lot, then lowers it by the same amount after they hit the ground.
Thanks. That's exactly what I did and it works fine.

At the very beginning I run the following:

Code: Select all

-- Bump up hitpoints
   for x = 1, 4, 1 do
     party:getChampion(x):modifyStatCapacity("health",120)
     party:getChampion(x):modifyStat("health",120)
   end

And then once they fall the whole distance and take damage (but live) I execute the following via a hidden pressure plate.

Code: Select all

function resethits()
	-- Bump down hitpoints
 	for x = 1, 4, 1 do
 		party:getChampion(x):modifyStatCapacity("health",-120)
 	end
end

Thanks everyone for the suggestions.
User avatar
Eightball
Posts: 48
Joined: Thu Jan 09, 2014 8:21 am

Re: Question on Falling Damage

Post by Eightball »

There's a serious problem with the pitimmunity method described by Komag on the useful scripts thread that spawns from this one.

(useful scripts here: viewtopic.php?p=31896#p31896)

The problem is that after the player uses the pit immunity, the game can't be saved without it totally crashing! Has anyone else had this error with Komag's script? I'd really like to keep using it if possible, because it works great otherwise!
SpoilerShow

Code: Select all

function tempImmunity()
     for i = 1,4 do
	   pitImmunity = party:getChampion(i)
	   pitImmunity:setEnabled(false)
     end
end

function immunityRovoke()
  for i = 1,4 do
    pitImmunity = party:getChampion(i)
    pitImmunity:setEnabled(true)
  end
end
Here's the game crashing error:
SpoilerShow
immunityScript: cannot serialize table 'pitImmunity' with metatable
stack traceback:
[C]: in function 'error'
[string "ScriptEntity.lua"]: in function 'saveValue'
[string "ScriptEntity.lua"]: in function 'saveState'
[string "GameMode.lua"]: in function 'saveGame'
[string "SaveGameMenu.lua"]: in function 'update'
[string "GameMode.lua"]: in function 'update'
[string "Grimrock.lua"]: in function 'display'
[string "Grimrock.lua"]: in main chunk

OS Version 6.1

OEM ID: 0
Number of processors: 4
Page size: 4096
Processor type: 586

Total memory: 8136 MB
Free memory: 5642 MB

Display device 0:
Device name: \\.\DISPLAY1
Device string: NVIDIA GeForce GTX 660
State flags: 08000005

Display device 1:
Device name: \\.\DISPLAY2
Device string: NVIDIA GeForce GTX 660
State flags: 00000000

Display device 2:
Device name: \\.\DISPLAY3
Device string: NVIDIA GeForce GTX 660
State flags: 00000000

Display device 3:
Device name: \\.\DISPLAY4
Device string: NVIDIA GeForce GTX 660
State flags: 00000000

Display device 4:
Device name: \\.\DISPLAYV1
Device string: RDPDD Chained DD
State flags: 00000008

Display device 5:
Device name: \\.\DISPLAYV2
Device string: RDP Encoder Mirror Driver
State flags: 00200008

Display device 6:
Device name: \\.\DISPLAYV3
Device string: RDP Reflector Display Driver
State flags: 00200008
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: Question on Falling Damage

Post by JohnWordsworth »

If you want to fix the pitImmunity script, add 'local' before the first use of the pitImmunity variable. The problem is, in the current script, that variable is a global, and therefore stored permanently in the script - and you can't save entity references in the save game. By adding local, the variable only lasts as long as the remaining function call and is cleared away afterwards.

Code: Select all

function tempImmunity()
     local pitImmunity = nil;

     for i = 1,4 do
      pitImmunity = party:getChampion(i)
      pitImmunity:setEnabled(false)
     end
end

function immunityRovoke()
  local pitImmunity = nil;

  for i = 1,4 do
    pitImmunity = party:getChampion(i)
    pitImmunity:setEnabled(true)
  end
end
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Post Reply