Use two ammo with one shot?

Freeform discussion about anything related to modding Transcendence.
Post Reply
schilcote
Militia Captain
Militia Captain
Posts: 726
Joined: Sat Feb 02, 2008 7:22 pm

Long story short, I need my weapon, which takes multiple types of ammo, to fire two shots at once while consuming two units of ammo at once. How do I go about this?
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
User avatar
sun1404
Militia Captain
Militia Captain
Posts: 527
Joined: Thu Nov 03, 2011 10:32 am
Location: Heretic. (Finally!)

Should be possible with OnFire event? I've forgotten the details, but you probably can use the event to generate another shot from a virtual weapon (or a copy of the current weapon's shot), and at the same time delete one ammo of the chosen type from the ship's inventory. Before this, you can do a check to see if there are at least 2 ammo left in the inventory, and make the weapon not fire if there aren't.
Yes, look at my avatar, I have a wyvera type ship.
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

Does the weapon consume one ammo type two at a time, or two types of ammo one at a time each?

Either way, it is definitely possible and not too hard with the OnWeaponFire event, but it may be a little tricky for UI-friendliness if your weapon needs to eat more than one ammo type at the same time.
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.
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

I'm not sure if this is exactly what you want but:

in a very cheap way you could in the <OnWeaponFire> event of the weapon:

(objGetProperty gSource 'selectedMissile)
this will return the itmStruct of the currently selected missile in your launcher.
so you can manually remove 1 missile from the cargo hold and the weapon will basically consume 2 ammo.
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

I have done that in my mods already, but I am not sure if what the OP wants is consume two of one ammo type or one ammo from two separate types. If he wants the latter, it is a bit trickier to implement (I have not done that before, but I have an idea how).
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.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

There's a multiverse library for that.

http://forums.kronosaur.com/viewtopic.p ... 522#p58522

You want AU_multishotammohandler if you're making a launcher or AU_initializeunlauncher, AU_virtualammoupdate, and AU_fireunlauncher if you want a non-launcher weapon that handles multiple ammo types. The latter system invokes the former if AU_fireunlauncher is called with two arguments.
Literally is the new Figuratively
schilcote
Militia Captain
Militia Captain
Posts: 726
Joined: Sat Feb 02, 2008 7:22 pm

It's a double-barrel missile launcher. It's supposed to use two units of the same kind of ammo.

This:

Code: Select all

<OnFireWeapon>
				(block Nil
					(unconventionalWeaponOnFire 20000)
					(objRemoveItem gSource (objGetProperty gSource 'selectedMissile) 1) ;We only remove one 'cos we already removed one as part of being fired
					Nil
				)
			</OnFireWeapon>
SHOULD work but it actually takes THREE missiles, which is downright bizzare.

EDIT:

That's happening because OnFireWeapon gets called twice, one for each missile. Hmm.

EDIT:
Atarlost wrote:There's a multiverse library for that.
How do I actually use that? Just slotting a <Library unid="..."> declaration right below the opening <TranscendenceExtension> doesn't do it. How do I make the game download the library?
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

<OnFireWeapon> is called once for each shot in your configuration. If you have two shots, the event is called twice per attack.

The game automatically subtracts one ammo per attack, independently of events.

One of the calls to OnFireWeapon event should not remove ammo. The remaining calls should.

You need to keep track of shots fired.

Also, when weapons is damaged or ionizated, and it misfires, events are not called, but you still lose one ammo.
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.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

The game should just download libraries used in enabled mods if you're connected to the multiverse and don't have them.
Literally is the new Figuratively
Post Reply