Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Locational damage  (Read 1563 times)

Kusgnos

  • Bay Watcher
    • View Profile
Locational damage
« on: August 29, 2010, 02:42:30 am »

Just wondering, but how would a person go about coding locational damage? Currently using TE4's framework (coded in Lua) and messing around with it, but I don't have much experience with this.
Logged

Xegeth

  • Bay Watcher
    • View Profile
Re: Locational damage
« Reply #1 on: August 29, 2010, 10:35:24 am »

I've had a look through the engine and it doesn't look too bad. To start with you'll probably need to replace self.life in ActorLife.lua with a table storing each location and its hitpoints, and takeHit needs to pick a random location to apply damage to. After that, you just need to modify any function that uses the life variable and make it use the table instead.

If you want to avoid modifying the engine, you can copy engine\interface\ActorLife.lua to YourGame\class\interface\ and replace all instances of "engine.interface.ActorLife" with "mod.class.interface.ActorLife".

I've not tested this so you could need more work to get it running, and it probably isn't the best way to implement it, but hopefully it should help.
Logged

Lap

  • Bay Watcher
  • I <3 Lua
    • View Profile
Re: Locational damage
« Reply #2 on: August 29, 2010, 11:33:03 am »

What are you working on anyways?
Logged

Cthulhu

  • Bay Watcher
  • A squid
    • View Profile
Re: Locational damage
« Reply #3 on: August 29, 2010, 11:36:46 am »

He's obviously making the Serial Killer Roguelike we all thought we had.
Logged
Shoes...

Lap

  • Bay Watcher
  • I <3 Lua
    • View Profile
Re: Locational damage
« Reply #4 on: August 29, 2010, 11:39:53 am »

=\ If that's a case I'd really hope that all these potential authors collaborate instead of making 5 incomplete games.
Logged

Cthulhu

  • Bay Watcher
  • A squid
    • View Profile
Re: Locational damage
« Reply #5 on: August 29, 2010, 11:40:50 am »

That could be cool.

Otherwise you know we're going to have a bunch of abortive attempts that go nowhere, if you guys work together you might get the roguelike.

And you know you want it.
Logged
Shoes...

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: Locational damage
« Reply #6 on: August 29, 2010, 12:11:48 pm »

Yes, PLEASE work together.
Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

Lap

  • Bay Watcher
  • I <3 Lua
    • View Profile
Re: Locational damage
« Reply #7 on: August 29, 2010, 12:54:00 pm »

Logged

Kusgnos

  • Bay Watcher
    • View Profile
Re: Locational damage
« Reply #8 on: August 29, 2010, 01:51:35 pm »

I've had a look through the engine and it doesn't look too bad. To start with you'll probably need to replace self.life in ActorLife.lua with a table storing each location and its hitpoints, and takeHit needs to pick a random location to apply damage to. After that, you just need to modify any function that uses the life variable and make it use the table instead.

If you want to avoid modifying the engine, you can copy engine\interface\ActorLife.lua to YourGame\class\interface\ and replace all instances of "engine.interface.ActorLife" with "mod.class.interface.ActorLife".

I've not tested this so you could need more work to get it running, and it probably isn't the best way to implement it, but hopefully it should help.

Thanks a lot! It's very helpful, and I appreciate it. Bound to be useful information. And...about that Serial Killer roguelike thing, haha, I originally did have that in mind, but I figure I'd best temper my hope and just go make some random stuff so I get more experience. I highly doubt that with what I know how, I can get to work on an actual roguelike.
Logged