-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Mallmadness #32
base: master
Are you sure you want to change the base?
Conversation
scripts/base/mallmadness.nut
Outdated
weaponModelIDs <- [293, 259, 260, 261, 262, 263, 264, 265, 266, 267, | ||
268, 269, 270, 291, 271, 272, 273, 274, 275, 277, | ||
278, 279, 281, 282, 283, 284, 280, 276, 285, 286, | ||
287, 288, 289, 290]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, these should not be in a strict numerical order. Other scripts lazily defined modelID as weaponID + 258
which resulted in the wrong pickup models.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave this comment in the code, not just on GitHub
scripts/base/mallmadness.nut
Outdated
weaponPickupAmmo <- [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
1, 1, 3, 3, 3, 3, 2, 10, 8, 8, | ||
12, 12, 30, 30, 30, 30, 30, 30, 14, 12, | ||
4, 50, 60, 60]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be balanced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need this. If anything, it should probably be a factor for GetAmmoAtSlot
. but for now 1.0 is fine.
We hopefully only have to balance the ammo that we initially spawn + maybe the overall amount of ammo that's on the server.
scripts/base/mallmadness.nut
Outdated
Vector(373.796, 1244.51, 25.6426), | ||
Vector(356.106, 1111.4, 25.3876), | ||
Vector(414.485, 1138.62, 22.7296), | ||
Vector(431.755, 1078.82, 19.0915)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add moar!
scripts/base/mallmadness.nut
Outdated
AddClass(3, RGB(100,149,237), 66, Vector(-421.729, -485.533, 11.0655), 0, | ||
8,1, 20,15, 23,90); | ||
AddClass(4, RGB(100,149,237), 37, Vector(-421.729, -485.533, 11.0655), 0, | ||
9,1, 19,20, 22,90); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I said moar!
scripts/base/mallmadness.nut
Outdated
|
||
function onPlayerHealthChange( player, lastHP, newHP ) { | ||
if ( newHP < 1 && alive[player.ID]) { | ||
alive[player.ID] = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless this check is made, a whole lot of pickups are created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just remove the weapons from the player before spawning the pickup, so they can't drop the same weapon twice.
scripts/base/mallmadness.nut
Outdated
} | ||
|
||
function onPlayerHealthChange( player, lastHP, newHP ) { | ||
if ( newHP < 1 && alive[player.ID]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HP is a float, thus not == 0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if a player has 0.999 health? Could they still be alive?
If so, I'd make this smaller for safety? epsilon = 1e-9; newHP < epsilon
or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, a smaller threshold should be in place.
function onPlayerCommand( player, cmd, text ) { | ||
cmd = cmd.tolower(); | ||
if (cmd == "rules") { | ||
Message( "No disturbing other's play. Kids only." ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Suggestions welcome!
scripts/base/mallmadness.nut
Outdated
|
||
function onPlayerSpawn( player ) { | ||
local pos = spawns[rand() % spawns.len()]; | ||
TeleportPlayer(player, pos, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be in a modules/random-spawn.nut or something
scripts/base/mallmadness.nut
Outdated
++zOffset; | ||
if (!(zOffset %= 2)) { | ||
++xOffset; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pick a random angle / random radius and spawn them, or even just split the circle into 8 sectors with fixed radius - this would also make it more deterministic where to run to grab weapons.
Something along the lines of:
radius = 1.0; // Alternative: RandFloat(0.1, 1.0)
alpha = player.Angle + i / 8.0 * 2.0 * PI; //Alternative: RandFloat(0.0, 2.0 * PI)
x = pos.x + sin(alpha) * radius;
y = pos.y + cos(alpha) * radius;
scripts/base/mallmadness.nut
Outdated
} | ||
|
||
function onPickupClaimPicked( player, pickup ) { | ||
if ( alive[player.ID] ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the alive
array? Can't you check Player.Health > 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HP is a float. While burning, you might pick up the lowest hanging pickups in the current (non-wheel) system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how that can be an issue? Are you saying burning/dead players still have health > 0? If that's the case, then the onPlayerHealthChange
should also fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Burning people seem to have [0,1[
health for a while, the alive-check was added because more than 50 pickups were added per death.
scripts/base/mallmadness.nut
Outdated
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should possibly be moved to modules/drop-weapons.nut or something
scripts/main.nut
Outdated
scripts_load("module/emote.nut") | ||
scripts_load("module/teleporter.nut") | ||
//scripts_load("module/teleporter.nut") | ||
scripts_load("module/spectate.nut") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spectate should be disabled probably. We could have our own spectate mode with different overhead cameras instead.
I wouldn't focus too much on the instant-weapon dropping for now. It just adds a lot of hacks but we might eventually don't even want it. We need to do play-testing to know - my experiences with these modes are 15 years old. |
scripts/base/mallmadness.nut
Outdated
weaponModelIDs <- [293, 259, 260, 261, 262, 263, 264, 265, 266, 267, | ||
268, 269, 270, 291, 271, 272, 273, 274, 275, 277, | ||
278, 279, 281, 282, 283, 284, 280, 276, 285, 286, | ||
287, 288, 289, 290]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetWeaponDataValue(weapon_index, 22)
could work?
(Should return a float of the model-id, if my logic is correct)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that one (and 23
) but the Molotov cocktail showed up as a missile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They probably have the file server-side and removed TearGas
or something - or you had an off-by-one to begin with? Anyhow, this list will have to stay then (for now).
scripts/module/weapon_pickups.nut
Outdated
local xOffset = 0; | ||
local zOffset = 0; | ||
local pos = player.Pos, | ||
x, y, alpha; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style
scripts/module/weapon_pickups.nut
Outdated
local pickup = null; | ||
for (local i = 0; i <= 8; ++i) { | ||
if ( player.GetWeaponAtSlot(i) ) { | ||
alpha = i / 8.0 * 2.0 * PI; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add the player angle or a random jitter, otherwise it's painfully obvious that certain weapons always spawn facing north
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this really be a problem though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will probably lead to ugly pickup distribution (where it looks like parallel rows of weapons), and might also lead to certain weapons always spawning in awkward places (imagine players standing infront of a small wall to shoot, then the same kind of gun might always spawn inside the wall every time). By adding jitter or natural randomness this can be prevented.
By testing for a few minutes, another issue has shown. Pickups are always gathered. This means you can have 300+ ammo for your Uzi and suddenly you end up with a Tec-9 and 3 rounds. Ideally, client should have to claim the pickup somehow. |
|
scripts/module/random_spawn.nut
Outdated
|
||
function onPlayerSpawn( player ) { | ||
local pos = spawns[rand() % spawns.len()]; | ||
TeleportPlayer(player, pos, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a random offset to avoid spawn-killing. Also avoids people possibly getting stuck in each other.
scripts/main.nut
Outdated
scripts_load("module/random_spawn.nut") | ||
scripts_load("module/weapon_pickups.nut") | ||
//scripts_load("module/goto.nut") | ||
//scripts_load("module/stunting.nut") | ||
scripts_load("module/skin.nut") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be disabled
I'm not proud of the current state of this.
Classes are not diverse enoughKill on exit
not yet implementedThis should be heavily refactored - main.nut should probably be a part of the game mode script. Thus this affects
base/freestyle.nut
too.