I understand "player is the hero" might not be suitable in your plug.
It made sense in mine because the AI could use 100% of the ships resources/energy to try and kill you, whereas the player didn't have the same luxury, so it kind of balanced out.
Multi-mode weaps work like this:
In short, you have multiple weaps and swap the ammo, so only one can fire.
You can also do this by swapping the weaps themselves, (easier to implement) but this limits you to only purchasing one weap.
The player gets an abortable mission that controls the weapon mode. All weapons of the same type will be in the same mode, though you can make similar weapons and call one Group A, and the other Group B, and control the groups independently.
It's also important to remember that you'll need to get rid of these missions when the player gets a new ship.
Say a weap is to have two modes. You make two weaps, one for each mode, and invisible ammo for each.
Make the starting mode the visible on in the outfitter, the other is invisible. The starting mode is the one that takes up mass, gun slots, etc.
When you buy it, it does four things:
- Grants both weapons
- Deletes both ammos
- Grants ammo for the starting mode
- Starts a mission
Selling:
- Deletes both weapons
- Does not delete ammo
- Aborts the missions
One cron (0-0-1) that detects for neither weapon but some ammo, then deletes the ammo.
The missions look like this:
128 "APC Turret: AUTO" OnAbort: s129
129 "APC Turret: Starting Manual..." OnShipDone: a129 s130 dAmmo1 gAmmo2
130 "APC Turret: MANUAL" OnAbort: s131
131 "APC Turret: Starting Auto..." OnShipDone: a131 s128 dAmmo2 gAmmo1
Optional 132 "Clear APC Missions" a128 a129 a130 a131 (auto-aborting)
You can type this into the OnSell field of the outfit, but I found it to be easier to simply s132 when I need to clear everything.
You need a self-destructing dude for the missions that have OnShipDone. Takes 3-4 secs for a weapon to change modes this way.
Side note: Only one mode needs to change using OnShipDone, all other modes can start instantly by simply starting the next mission in the OnAbort field. There needs to be a spot in the mission chain to break-out using Axxx so the missions can be scrapped. Fxxx is, and always has been, broken.
The weaps themselves use their respective ammo, but give them a burst count of 3,000 or so, and only use ammo at the end of the burst. This is so that the weap only needs one ammo outfit, and so the player is unlikely to run out of ammo. Make sure that (burst count * number of weaps) doesn't exceed 32,767. At 3,000 I can have 10 weaps max.
The reason the outfits delete ammo first when buying, is to keep the ammo at one unit. And the outfits do not delete ammo when selling, so that you don't delete the only ammo when reducing the number of weaps. The cron will clear it when you take off after you sell the last weap.
You can give AI ships these weapons, but you'll have to predetermine what mode it is to be in. Give both weapons (the inactive on can be granted in outfits, if need be) and one of the appropriate ammo.
In the OnPurchase and OnCapture fields, you start the matching mission.
FYI, if the ship is to be an "escape ship" the OnPurchase and OnCapture fields won't trigger.
This post has been edited by Desprez : 14 March 2008 - 07:58 PM