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

Reset timer for Super Weapons #1153

Conversation

FS-21
Copy link
Contributor

@FS-21 FS-21 commented Sep 10, 2023

  • When this super weapon is clicked forces a countdown restart.
  • To make Warhead or Weapon detonation at target cell tags work with this feature is needed to set SW.FirstClickRestartsTimer.ForceDetonations=yes.
  • The cost of the super weapon can be substracted in the first click by setting SW.FirstClickRestartsTimer.Cost so Money.Amount isn't recommended here.
  • SW.FirstClickRestartsTimer.AutoFire launchs the super weapon at the end of the first counter restart. Don't use the tag SW.AutoFire.
  • SW.FirstClickRestartsTimer.RefundIfAborted refunds the paid cost if the SW is no longer available if the restarted countdown haven't finished.
  • Designed with upgrades (or research) in mind, simplifying the number of workarounds. Probably some Ares tags are still recommended for this job.

In rulesmd.ini:

[SOMESW] ; Super Weapon
SW.FirstClickRestartsTimer=no ; boolean
SW.FirstClickRestartsTimer.AutoFire=no ; boolean
SW.FirstClickRestartsTimer.Cost=0 ; integer, always substract money
SW.FirstClickRestartsTimer.RefundIfAborted=no ; boolean
Message.InsufficientFunds= ; CSF entry key
Message.RestartedTimer= ; CSF entry key
EVA.RestartedTimer= ; EVA entry

@github-actions
Copy link

github-actions bot commented Sep 10, 2023

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.

@FS-21
Copy link
Contributor Author

FS-21 commented Sep 10, 2023

If you want a model for testing it I posted an example in action of what I'm going to use in my case:
Initially starts "ready" to be clicked, then it starts the SW timer and substracts the money and when the counter reaches 0:00 auto-launchs the upgrade SW. Once upgraded all units will be converted into the new model and in the sidebar the old model will be replaced by the new upgraded one thanks to the "LimboDelivery" tags in Prerequisite tags.

[LimboUpgrade_SW01]
UIName=NAME:LimboUpgrade_SW01
UIDescription=UID:LimboUpgrade_SW01
Name=Devout upgrade
SidebarPCX=limboupgrade_sw01.pcx
IsPowered=false
DisableableFromShell=no
FlashSidebarTabFrames=0
RechargeTime=5
SW.InitialReady=yes
Type=GenericWarhead
Action=Custom
AIDefendAgainst=no
SW.CreateRadarEvent=no
ShowTimer=no
Range=1
LineMultiplier=1
EVA.Ready=EVA_UpgradeComplete
Text.Ready=NOSTR:
Text.Preparing=NOSTR:
RechargeVoice=;
ChargingVoice=;
ImpatientVoice=;
EVA.Impatient=EVA_UpgradeInProgress
SuspendVoice=;
SW.MaxCount=1
SW.Shots=1
SW.UseAITargeting=yes
SW.AITargeting.Constraints=none
SW.AITargeting=Self
Cursor=GenericGreen ; No cursor will be used here!
NoCursor=NoGenericGreen ; No cursor will be used here!
SW.FireIntoShroud=yes
; Make new upgraded object the new default unit in the sidebar
LimboDelivery.Types=LIMBOUPGRADE_01 ; List of BuildingTypes that will use in "Prerequisites" tag the new upgraded unit
LimboDelivery.IDs=1
;LimboDelivery.RollChances=100%
SW.NegBuildings=LIMBOUPGRADE_01 ; Once upgraded this can't be upgraded again using this SW
; Convert existing old objects in the battlefield
Convert.From=DEVOUT ; Old unit
Convert.To=DEVOUT2 ; New unit
Convert.AffectedHouses=owner
; Tags related to SW timer reset
SW.FirstClickRestartsTimer=yes
SW.FirstClickRestartsTimer.AutoFire=yes
SW.FirstClickRestartsTimer.Cost=-10000 ; Pay for starting the upgrade process...
Message.InsufficientFunds=;
Message.RestartedTimer=;
EVA.RestartedTimer=EVA_UpgradeInProgress

@Metadorius
Copy link
Member

Metadorius commented Sep 10, 2023

SW.FirstClickRestartsTimer.AutoFire.ForceDetonations=yes

holy mother of god

@FS-21
Copy link
Contributor Author

FS-21 commented Sep 10, 2023

SW.FirstClickRestartsTimer.AutoFire.ForceDetonations=yes

holy mother of god

Mistake, I left it as SW.FirstClickRestartsTimer.ForceDetonations=yes in the code. I updated the comments and the docs

Moved the variable TimerRestarted into SuperExt.
Removed the tag "SW.FirstClickRestartsTimer.AutoFire.ForceDetonation".
grammar mistake
Copy link
Member

@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.

  • Use false instead of no in documentation.
  • SW.FirstClickRestartsTimer.Cost should accept both negative and positive values, like in vanilla (also positive/negative refunds).
  • EVA.RestartedTimer, Message.InsufficientFunds and Message.RestartedTimer should be mentioned in the documentation.

But I don't have good feelings about removing the substraction mandatory part of the money tag. This was createdfor  upgrades in mind :-/
@FS-21
Copy link
Contributor Author

FS-21 commented Sep 13, 2023

Applied feedback.

@FS-21
Copy link
Contributor Author

FS-21 commented Feb 7, 2024

I'll close this pull request because there is a desync I can't fix in the hook at 0x6CBCD4 .

@FS-21 FS-21 closed this Feb 7, 2024
@FS-21 FS-21 deleted the feature/restart-sw-countdown-1-time branch February 7, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants