2 New Mods: locked angle turret and ICX autocannon

Post about your finished mods here.
Post Reply
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

First of all, THANKS to F50 for letting me tinker with the tractor device prototype mod. :D

From that mod I used a helper function that calculates the angle of the vector from the playership to the target of the playership.
With this tool in my hands I made 2 mods:

ICX AutoCannon !
Basically I reinvented the omnidirectional cannon in script code. The cannon automatically shoots down enemy ships.
It works with targeted spaceobjects or it tracks automatically the nearest ship.
It can be turned on and off.
I think that every addict to omnidirectional weapons will love it! :D

Locked Angle Turret Mod !
Proof of concept code, it's basically my old switchable omni/non-omni turbolaser cannon; in this version however the cannon will continue to fire in the last direction when the omnidirectional turret is turned off.
The code was a bit tricky because I had to keep in cosideration both the angle between the 2 spaceobjects and the facing direction of the playership.
(it has a small bug, the first switch is not working, and I don't know why, simply the omnidirectional version remain in the cargo of the playership. From the second use it works perfectly)
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

digdug wrote:ICX AutoCannon !
Basically I reinvented the omnidirectional cannon in script code. The cannon automatically shoots down enemy ships.
It works with targeted spaceobjects or it tracks automatically the nearest ship.
It can be turned on and off.
I think that every addict to omnidirectional weapons will love it! :D
I used ICX derived code in my mod to make the turret systems for the canis indus. capital ships. :)
Actually, I think somebody tried it back in .98d, but it was very buggy. A fully functional one seems like a great thing.

As to your locked angle turret, it looks like the reverse of what happened to the borg shield... :?
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

digdug wrote:First of all, THANKS to F50 for letting me tinker with the tractor device prototype mod. :D
your welcome, and so is anyone else who wishes to use that prototype.
ICX AutoCannon !
Basically I reinvented the omnidirectional cannon in script code. The cannon automatically shoots down enemy ships.
It works with targeted spaceobjects or it tracks automatically the nearest ship.
It can be turned on and off.
I think that every addict to omnidirectional weapons will love it! :D
I had plans to do this, but I probably wouldn't have gotten around to it for about a year. :D I would like to go even farther with this. I would like to give the sapphire a special bonus with these devices (some autocannon-only device slots) to make it a viable and unique ship choice. I remember either Periculi or Betel made a mod did something very similar to this by uninstalling and installing some phantom devices. :twisted: Do you think you could do this digdug?
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

:lol: I was planning out a 5-state weapon earlier this week.

Anything like that is really quite possible and easy with the new item getters and setters!

Maybe the bonus of the sapphire could be something like a super computer AI- because it is a 'luxury' class vessel, you would expect more amenities, and what could be more amenable than an on board computer that fires your special weapons for you so you don't have to wear out your trigger finger. :)

Of course, it could also have some personality issues come up once in a while.
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

for the autoturret i found a way to use <onUpdate> to make it work on any ship,

small font because it's quite lengthy for a post

<ItemType UNID="&itAutocannon;"
name= "ICX Autocannon turret"
level= "6"
value= "15000"
mass= "2500"
frequency= "uncommon"
modifiers= "MajorItem"

description= "This automated turbolaser cannon tracks and shoots down enemy targets."
>

<Image imageID="&rsItems1;" imageX="0" imageY="192" imageWidth="96" imageHeight="96"/>

<Invoke key="Z" installedOnly="true">
(block Nil
(if (objGetData gPlayerShip "Autocannon")
(block Nil
(objSetData gPlayerShip "Autocannon" Nil)
(plyMessage gPlayer "ICX AutoCannon OFF!")
)
(block Nil
(objSetData gPlayerShip "Autocannon" on)
(plyMessage gPlayer "ICX AutoCannon ON!")
)
)
)
</Invoke>

<Events>
<onUpdate>
(if (objGetData gPlayerShip "Autocannon")
(block (target distance srcPos targetPos bestDist bestDegree count finalAngle EnemyShipList)

(setq target (objGetTarget gSource))

(if (not target)
(block Nil
(setq EnemyShipList (sysFindObject gPlayerShip "EsN:40"))
(item EnemyShipList 0)
)
)
(if target
(block Nil
(setq distance (objGetDistance target gSource))

(if (eq (itmIsDamaged theitem) Nil)
(block Nil

(setq srcPos (objGetPos gSource))
(setq targetPos (objGetPos target))

(for count 0 180
(block (vector currDist)
(setq vector (sysVectorPolarOffset targetPos (multiply count 2) distance))
(setq currDist (sysVectorDistance vector srcPos))
(if (ls currDist BestDist)
(block Nil
(setq bestDegree (multiply count 2))
(setq bestDist currDist)
)
)
)
)



(if (ls distance 40)
(block Nil
(sysCreateWeaponFire &virtualturbolaser; gPlayership srcPos (add 180 bestDegree) 100 target True)
)
)
)
(objSendMessage gSource Nil "Device non-functional: Error!")
)
)
)

)
)
</onUpdate>
</Events>
<MiscellaneousDevice
powerUse= "20"
/>

</ItemType>
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

cool, thanks bobby! :D
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

the error is showing up only in 0.99x and not in 0.98d where the mod is working perfectly

the error i get is : "unable to find item in list"

and is related to the function objRemoveItem
i tried to use gSource or gPlayership, and i tried to use the optional number (1 item in this case) or not using it.

So I don't know why I get this error. :oops:
What is very strange is that after the first error, the mod works and the weapon is switched without problems! :?
Post Reply