• Do not use Works in Progress as a way of avoiding the releases system! Works in Progress can be used for sharing early betas and for getting suggestions for improvement. Releases of finished content are not allowed in this forum! If you would like to submit a finished addon, click here for instructions on how to do so.

Blaze Tries to Lua

Status
Not open for further replies.
I guess I can post here stuff regarding Lua, hoping maybe it will help you in the later days...

Here are Functions I made that I find handy.

Code:
local function P_3DDist (obj1, obj2)
    return FixedSqrt(FixedMul(abs(obj1.x - obj2.x), abs(obj1.x - obj2.x)) + FixedMul(abs(obj1.y - obj2.y), abs(obj1.y - obj2.y)) + FixedMul(abs(obj1.z - obj2.z), abs(obj1.z - obj2.z)))
end
Returns a distance relative from obj1 to obj2 (Must be mobj_t) in 3D space on the Fixed scale.

Code:
local function P_ExplosionThrust (attacker, victim, radius, thrust, instant)
    if radius != nil
    or thrust != nil
        local xyzdist = P_3DDist(attacker, victim)
        local scaleform = FixedDiv((radius - xyzdist), bombradi2)
        local diffxyz = {(attacker.x - victim.x), (attacker.y - victim.y), (attacker.z - victim.z)}
        local alldist = abs(diffxyz[1]) + abs(diffxyz[2]) + abs(diffxyz[3])
        local thrustxyz = {}
        for w=1,3 do
            thrustxyz[w] = FixedMul(FixedDiv(diffxyz[w],  alldist), FixedMul(thrust, scaleform))
        end
        if instant
            victim.momx = -thrustxyz[1]
            victim.momy = -thrustxyz[2]
            victim.momz = -thrustxyz[3]
        else
            victim.momx = $1 - thrustxyz[1]
            victim.momy = $1 - thrustxyz[2]
            victim.momz = $1 - thrustxyz[3]
        end
    else
end
A further expansion of P_3DDist that not only uses that function but also thrusts the victim object away from the attacker depending on the explosion radius and thrust at maximum. Radius and Thrust use the fixed point scale, and attacker and victim are mobj_t.

Also, it would be nice if I could get some comments on a Lua me and Kitoko are working on, called the Doom Lua, which basically tries its best to recreate old DooM style damage and health systems.

Lua :http://puu.sh/p3JAu/bae9b80a0a.lua
Resource wad: http://puu.sh/p3JKN/7be0cc5d2a.zip

It currently only handles MATCH, so if you try this in Coop or Team Match, for example, it'll look weird. But, the damage is there for proof of concept.

Testing commands (Host only)
iddqd/iddqd2: Gives you 200 of armor and health, the maximum possible with hp and armor maximums of 100 plus bonuses. Will be changed to singleplayer-only with a new function once armor pickups exist.
setvital: Sets vital 1-4 to the following value, only usable on self. This command is UNSAFE and only for testing. 1:Health, 2:Max Health, 3:Armor, 4:Max Armor.

Normal commands (Works fine)
taunt: Taunting is back. Bind this to a key to annoy your friends like the old days.
painvoices: Server only. Changes the pain voices to Doomguy's if your input painvoices "doom" and normal if you set it to painvoices "normal"

Defunct commands (Exists in code, use at own risk)
svflags: Server flags. Currently incomplete, but sets the server global flags, like whether players can swim, or if they can use abilities, etc.
clflags: Client flags. Currently incomplete, but will allow the player to set specific flags on themselves, like if they run or walk, see SRB2's original scoreboard and "score", or see item-up messages.

We have yet to clean up a lot of stuff, so expect it to become more optimized later onm but at least you can have some games of Deathmatch in the meantime. Sugggestions are welcome, even if it involves weapon balance.
 
Last edited:
Your first function can actually be done quicker via usage of one of two provided-by-the-game functions.

Code:
local function P_3DDist (obj1, obj2)
    return P_AproxDistance(P_AproxDistance(obj1.x - obj2.x, obj1.y - obj2.y), obj1.z - obj2.z) // This can also be FixedHypot instead of AproxDistane. I don't actually know the difference. The one that isn't commented out is probably faster for collisions, but FixedHypot is probably better for positioning.
end

I've cheerleaded you on irc before, so I won't be too verbose here... but nice work on the whole!
 
I really liked the Taunt command, and kinda bummed down that it was deleted. I'd also like the Taunt Lua to trigger different Sprites, y'know, like an actual taunt.

I'm not asking you to do a TF2 Conga, but I'd like at least having sonic waving his finger towards his unfortunate victim of insta killing Rail Ring.
 
I played this doom based Lua. Its a pretty solid game-type-thing. I liked how all the characters have the same ablities, jump height and speed.

BUT the thing that still annoying me whislt i play, is a Knuckles player. See, his fire rate is much more higher than sonic and tails. Is it possible to make the fire rate the same with knuckles or is it hardcoded to be at that rate?
 
BUT the thing that still annoying me whislt i play, is a Knuckles player. See, his fire rate is much more higher than sonic and tails. Is it possible to make the fire rate the same with knuckles or is it hardcoded to be at that rate?

I'm not really sure, since I never saw an option to disable it. For a while I assumed it came with CA_GLIDEANDCLIMB, but I guess that's not the case. However, I could control the firing delays and add a fastweapons 1-3 (Like in Zandronum) to turn it from problem to feature.

---------- Post added at 11:40 PM ---------- Previous post was at 11:37 PM ----------

Your first function can actually be done quicker via usage of one of two provided-by-the-game functions.

Thanks! I'll definitely use this.

I've cheerleaded you on irc before, so I won't be too verbose here... but nice work on the whole!

The fact that you care actually kind of makes me smile. So, thanks. =)
If you can help me with math about circles and radii I could make something extra fun...
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top