Is there a way to extract the current power level of the capacitor (or heat from temperature gauge) from a weapon, and to set it to zero regardless how much accumulated power it had?
I want to make a weapon, inspired by the Wave Cannon from R-Type (i.e., hold fire button for a few seconds then release for stronger shot), that drains all accumulated power from the capacitor and fires a shot based on the accumulated power.
Is it possible to get/set data related to capacitors/temp?
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!
Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!
Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
Probably not. In Weapon Extended 5 they solved the problem by making virtual station "capacitor". So when you hold fire weapon button - it uses this virtual station to store the charge. As you released this button (it was made very easy) the capacitor released all its held charge.
Here's what to use: <OnFireWeapon> event (used to start charging, obviously), sysAddObjTimerEvent (used to make timed activation of release, put it in the end of <OnFireWeapon>) and sysCancelTimerEvent (used to delete <Discharge> event so you wouldn't get shitload of discharges, put it in the start of <OnFireWeapon>).
BTW, when I tried making some mods myself, I needed to do this too.
Here's what to use: <OnFireWeapon> event (used to start charging, obviously), sysAddObjTimerEvent (used to make timed activation of release, put it in the end of <OnFireWeapon>) and sysCancelTimerEvent (used to delete <Discharge> event so you wouldn't get shitload of discharges, put it in the start of <OnFireWeapon>).
BTW, when I tried making some mods myself, I needed to do this too.
- pixelfck
- Militia Captain
- Posts: 571
- Joined: Tue Aug 11, 2009 8:47 pm
- Location: Travelling around in Europe
I'm not aware of any build-in method to do this. The obvious candidate function for this would be:
But as you can see, there is nothing about capacitor or heat level in there.
You could probably imitate the effect by either using the <OnUpdate> event or by setting a timed event yourself, as EditorRUS suggested.
~Brigand
Code: Select all
(objSetItemProperty obj item property value [count]) -> item
property
'charges charges
'damaged [True|Nil]
'disrupted [True|Nil|ticks]
'enabled [True|Nil|'silentDisabled|'silentEnabled]
'fireArc Nil|(min max)|'omnidirectional
'hp hitPoints
'incCharges charges
'linkedFireOptions list-of-options
'pos (angle radius [z])
'secondary [True|Nil]
(objGetItemProperty obj item property) -> value
property
'enabled
'fireArc
'installDevicePrice
'linkedFireOptions
'pos
'removeDevicePrice
'secondary
All properties for itmGetProperty are also valid.
You could probably imitate the effect by either using the <OnUpdate> event or by setting a timed event yourself, as EditorRUS suggested.
~Brigand
I already have a clumsy, imprecise way of doing this via charges and OnUpdate. If I can access and set heat/power directly, it would be better because the UI looks better and I do not need to powerup the weapon (add a charge) once per second.
I should mention I do not need to make the player hold the fire button as done in arcade/console games. If the player is idling, it is understood he is holding the fire button down. I mention holding the fire button down because that is how it worked in R-Type and many other similar games, but the main point is charging for a brief time for a stronger shot.
I should mention I do not need to make the player hold the fire button as done in arcade/console games. If the player is idling, it is understood he is holding the fire button down. I mention holding the fire button down because that is how it worked in R-Type and many other similar games, but the main point is charging for a brief time for a stronger shot.
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!
Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!
Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
<OnInstalled> ; Or whatever event you need.I should mention I do not need to make the player hold the fire button as done in arcade/console games. If the player is idling, it is understood he is holding the fire button down. I mention holding the fire button down because that is how it worked in R-Type and many other similar games, but the main point is charging for a brief time for a stronger shot.
(sysObjAddTimerEvent 1 "ChargingUp")
</OnInstalled>
<ChargingUp>
(sysObjAddTimerEvent 1 "ChargingUp")
...
</ChargingUp>
Good news, PM, it is all possible!
For the R-Type hold-to-charge cannon:
Just disrupt firing of the above when the counter reaches 100 by enabling and disabling the 'selectedWeapon.
For a no-need-to-hold-down-key autocharge, install a virtual capacitor weapon and remove it and reinstall it everytime the weapon is fired. Since capacitors charge from 0 when newly installed, this functions as a "reset-to-zero"
Notice that the gauge is for display only, external timers and <OnFireWeapon> code is needed to create the virtual, but synchronized counter for TLISP.
Apologies about the terseness, short on time.
For the R-Type hold-to-charge cannon:
Code: Select all
<ItemType UNID="&itMiningLaserCannon;"
name= "dual mining laser cannon"
level= "3"
value= "10000"
mass= "5000"
frequency= "rare"
modifiers= "MajorItem; EnergyWeapon"
description= "Twin mining lasers with linked fire controls, will overheat if fired for extended durations. Also popular as an improvised weapon."
>
<Image imageID="&rsItems1;" imageX="96" imageY="0" imageWidth="96" imageHeight="96"/>
<Weapon
configuration= "dual"
powerUse= "80"
type= "beam"
damage= "laser:1d4; mining3"
fireRate= "1"
lifetime= "20"
counter= "temperature"
counterActivate= "101"
counterUpdate= "-100"
counterUpdateRate= "1"
beamType= "laser"
primaryColor= "0x5f, 0xf1, 0x2a"
secondaryColor= "0x00, 0xff, 0x00"
sound= "&snLaserCannon;"
>
</Weapon>
</ItemType>
For a no-need-to-hold-down-key autocharge, install a virtual capacitor weapon and remove it and reinstall it everytime the weapon is fired. Since capacitors charge from 0 when newly installed, this functions as a "reset-to-zero"
Notice that the gauge is for display only, external timers and <OnFireWeapon> code is needed to create the virtual, but synchronized counter for TLISP.
Apologies about the terseness, short on time.
Fiction is reality, simplified for mass consumption.
PGP: 0x940707ED, 5DB8 4CB4 1EF5 E987 18A0 CD99 3554 3C13 9407 07ED
Bitcoin: 1LLDr7pnZDjXVT5mMDrkqRKkAPByPCQiXQ
PGP: 0x940707ED, 5DB8 4CB4 1EF5 E987 18A0 CD99 3554 3C13 9407 07ED
Bitcoin: 1LLDr7pnZDjXVT5mMDrkqRKkAPByPCQiXQ
'selectedWeapon only works for primary weapon, not linked fire weapons.
One virtual capacitor device would not work with multiple, linked-fire instances of the weapon. Juggling multiple devices, one per weapon, could get too messy to be worth it.
I thought of various tricks, some involving timers, charges, and/or overlays; but I run into problems when time stop, jumping, or multiple linked-fire weapons get involved.
In the end, I decided to forgo the UI to ensure the weapons work. I abandoned visual charges on the Dragonslayer from one of my mods because it got error messages on some dockscreens. Instead, I used the code I wrote for the Charge laser in Items 912. Player has no UI hints of weapon charges, but at least I found no major bugs.
What I really want is the ability to extract and set data from the counter, but that seems impossible.
One virtual capacitor device would not work with multiple, linked-fire instances of the weapon. Juggling multiple devices, one per weapon, could get too messy to be worth it.
I thought of various tricks, some involving timers, charges, and/or overlays; but I run into problems when time stop, jumping, or multiple linked-fire weapons get involved.
In the end, I decided to forgo the UI to ensure the weapons work. I abandoned visual charges on the Dragonslayer from one of my mods because it got error messages on some dockscreens. Instead, I used the code I wrote for the Charge laser in Items 912. Player has no UI hints of weapon charges, but at least I found no major bugs.
What I really want is the ability to extract and set data from the counter, but that seems impossible.
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!
Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!
Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
- AssumedPseudonym
- Fleet Officer
- Posts: 1190
- Joined: Thu Aug 29, 2013 5:18 am
- Location: On the other side of the screen.
That sounds like something that ought to be made as a feature request over on the Ministry.PM wrote:What I really want is the ability to extract and set data from the counter, but that seems impossible.
Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)
My mods on Xelerus: Click here!
Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)