Skip to content
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

Spawn crates /w Warheads & minor crate improvements #1227

Merged

Conversation

Starkku
Copy link
Contributor

@Starkku Starkku commented Mar 22, 2024

Spawn powerup crate

  • Warheads can now spawn powerup crates of specified type(s) on their impact cells (if free, or nearby cells if occupied something other than a crate) akin to map trigger action 108 ('Create Crate').
    • SpawnsCrateN where N is a number starting from 0, parsed until no key is found can be used to define the type of crate spawned.
    • SpawnsCrateN.Weight is a number that determines relative weighting of spawning corresponding crate type vs. other listed ones (0 is no chance, higher means higher probability) defaulting to 1 if not defined.
    • SpawnsCrate.Type/Weight is an alias for SpawnsCrate0.Type/Weight if latter is not set.

In rulesmd.ini:

[SOMEWARHEAD]            ; Warhead
SpawnsCrate(N).Type=     ; Powerup crate type enum (money|unit|healbase|cloak|explosion|napalm|squad|reveal|armor|speed|firepower|icbm|invulnerability|veteran|ionstorm|gas|tiberium|pod)
SpawnsCrate(N).Weight=1  ; integer

Crate improvements

There are some improvements on goodie crate logic:

  • The limit of vehicles a player can own before unit crates start giving money instead can now be customized by setting UnitCrateVehicleCap. Negative numbers disable the cap entirely.
  • FreeMCV setting is now actually respected and can be used to disable the forced unit selected from [General] -> BaseUnit that is given if player picks a crate and has enough credits but no existing buildings or BaseUnit vehicles.
    • The previously hardcoded credits threshold that must be passed can also now be customized via FreeMCV.CreditsThreshold.
  • It is possible to influence weighting of units given from crates (CrateGoodie=true) via CrateGoodie.RerollChance, which determines the chance that if this type of unit is rolled, it will reroll again for another type of unit.

In rulesmd.ini:

[CrateRules]
UnitCrateVehicleCap=50         ; integer
FreeMCV=true                   ; boolean
FreeMCV.CreditsThreshold=1500  ; integer

[SOMEVEHICLE]                  ; VehicleType
CrateGoodie.RerollChance=0.0   ; floating point value, percents or absolute (0.0-1.0)

Copy link

github-actions bot commented Mar 22, 2024

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@mbnq
Copy link

mbnq commented Mar 28, 2024

Thats very cool!

@Starkku Starkku force-pushed the feature/minor-crate-improvements branch from e4e0024 to 3a16e81 Compare March 31, 2024 16:00
@Starkku Starkku changed the title Minor crate logic improvements Spawn crates /w Warheads & minor crate improvements Mar 31, 2024
@mbnq
Copy link

mbnq commented Mar 31, 2024

I love this and thank you for making this!

money:		ok
unit:		ok
healbase: 	ok
cloak:		ok
explosion:	ok
napalm:		ok
squad:		money
reveal:		ok
armor:		ok
speed:		ok
firepower:	ok
icbm:		ok
invulnerability: displays armor p-up animation, nothing happens
veteran:	ok
ionstorm:	nothing
gas:		ok
pod:		nothing
darkness:	crate does not spawn

Crates spawned on the water are money, as normal.
Squad does't work and it shouldn't i think.
Invulnerability displays armor power up anim, nothing happens.
Pod no animation, no effect.

I would suggest to default crate to moneycrate if crate type is not supported,
missing or garbage is written like here:

SpawnsCrate0.Type=randomtext
SpawnsCrate0.Weight=1

I would like to also suggest to default to moneycrate not working powerups and unlist them from documentation.
Tested with ra2yrbf

I will test it in mp soon.

@Starkku Starkku force-pushed the feature/minor-crate-improvements branch from 3a16e81 to ca26053 Compare April 1, 2024 08:56
@Starkku
Copy link
Contributor Author

Starkku commented Apr 1, 2024

CrateType not supported is treated as if nothing was parsed.

darkness not working was a parsing bug I fixed.

Many Powerups not working is an existing problem that I have not addressed with these changes.

@Starkku Starkku added the Tested label Apr 1, 2024
@Starkku Starkku force-pushed the feature/minor-crate-improvements branch from ca26053 to 2fa13bb Compare April 9, 2024 12:44
@Starkku Starkku force-pushed the feature/minor-crate-improvements branch from 2fa13bb to 7bc5a1f Compare May 2, 2024 07:13
Copy link
Contributor

@MortonPL MortonPL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good besides a few tiny inefficiencies in parsing.

src/Ext/WarheadType/Body.cpp Show resolved Hide resolved
src/Ext/WarheadType/Body.cpp Outdated Show resolved Hide resolved
src/Ext/WarheadType/Body.cpp Outdated Show resolved Hide resolved
src/Utilities/TemplateDef.h Show resolved Hide resolved
@Starkku Starkku force-pushed the feature/minor-crate-improvements branch from 7bc5a1f to 6a1d44d Compare May 11, 2024 10:48
@Starkku Starkku merged commit e359f70 into Phobos-developers:develop May 14, 2024
6 checks passed
@Starkku Starkku deleted the feature/minor-crate-improvements branch May 19, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants