Lua: Monster and projectile speed

Have a question, suggestion, or comment about Aleph One's features and functionality (Lua, MML, the engine itself, etc)? Post such topics here.
Post Reply
User avatar
ravenshining
Vidmaster
Posts: 892
Joined: Jun 17th '17, 22:50
Location: Hawai'i

I understand the difficulties with polling instantaneous speeds, but it'd be real useful if we could return a monster's nominal walking speed or projectile's nominal flight speed with lua!

For example, I'm currently working on a script that would give monsters the ability to aim based on ballistic trajectories. At the moment, I have to resort to this ugly mess:

Code: Select all

local pv = 1024
if projectile.type == "grenade" then
  pv = 256
elseif projectile.type == "trooper grenade" or projectile.type == "juggernaut missile" then
  pv = 204
elseif projectile.type == "sewage yeti" and Game.difficulty == "kindergarten" then
  pv = 112
elseif projectile.type == "sewage yeti" and Game.difficulty == "easy" then
  pv = 120
elseif projectile.type == "sewage yeti" and Game.difficulty == "normal" then
  pv = 128
elseif projectile.type == "sewage yeti" and Game.difficulty == "major damage" then
  pv = 144
elseif projectile.type == "sewage yeti" and Game.difficulty == "total carnage" then
  pv = 160
end
And OK, sure, that works... with standard physics. This script will have to be adjusted by hand to match maps or scenarios with any changes to projectile speed, alien status, or affection by gravity. It would be so much better to be able to get those values from projectile.type !
User avatar
treellama
Vidmaster
Posts: 6110
Joined: Jun 2nd '06, 02:05
Location: Pittsburgh
Contact:

This is just access to the physics model isn't it?
User avatar
ravenshining
Vidmaster
Posts: 892
Joined: Jun 17th '17, 22:50
Location: Hawai'i

Yes, all I'm looking for is a way to read what's stored in the physics model, for simplicity's sake and so a script needing them might be useful to others who might be running M1 or scenarios with different physics without modification. I could try looking in to A1's lua code myself if I find time on the weekend, but that's not an area of the code I'm familiar with yet.

At the moment, my lua for messing with projectiles is relying on me to manually enter code to define speed, area of effect, and whether the guided, alien, affected by gravity, affected by half gravity flags are set. Implicitly I'm also looking at doubly affected by gravity, penetrates liquids, and rebounds from floor.

For monsters, Speed, Alien, and Berzerker would be enough to establish how fast a monster walks, and I'd love to be able to read shrapnel data and the Delayed Hard Death flag for planned features.

Being able to set Cannot Attack and firing range would be very nice, but I realise setting values may be a whole other matter than reading them.
Post Reply