SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Editing

Reply
 
Thread Tools Search this Thread
Old 05-24-2016   #1
Blaze The Cat
& Knuckles
 
Blaze The Cat's Avatar
Default Blaze Tries to Lua

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 by Blaze The Cat; 05-24-2016 at 06:54 PM. Reason: A reason is just an excuse.
Blaze The Cat is offline   Reply With Quote
Old 05-24-2016   #2
toaster
トースタちゃん
 
toaster's Avatar
Default

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!
__________________
Quote:
<fickle> giant robo-hood that rips the map apart with her bare hands
toaster is offline   Reply With Quote
Old 05-24-2016   #3
DrStephen
skip sass when
 
DrStephen's Avatar
Default

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.
__________________
proud owner of chadpack, werehog may scream and hat kid in a red fox fursuit

Also I do art follow me kthx
https://twitter.com/Gianluu1999
DrStephen is offline   Reply With Quote
Old 05-24-2016   #4
MK.exe
The one and only!
 
MK.exe's Avatar
Default

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?
__________________
~ MK
MK.exe is offline   Reply With Quote
Old 05-25-2016   #5
Blaze The Cat
& Knuckles
 
Blaze The Cat's Avatar
Default

Quote:
Originally Posted by MK.exe View Post
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 ----------

Quote:
Originally Posted by toaster View Post
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.

Quote:
Originally Posted by toaster View Post
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. =)
Spoiler:
If you can help me with math about circles and radii I could make something extra fun...

Blaze The Cat is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:13 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.