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: 2614
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

Sun Aug 24, 2008 12:56 am

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
Wolfy
Fleet Admiral
Fleet Admiral
Posts: 5374
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

Sun Aug 24, 2008 1:27 am

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 'hycrotan 'nonBinary))
Image

F50
Militia Captain
Militia Captain
Posts: 995
Joined: Sat Mar 11, 2006 5:25 pm

Sun Aug 24, 2008 2:29 am

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: 1259
Joined: Sat Oct 13, 2007 7:48 pm
Location: By the beach

Sun Aug 24, 2008 2:38 am

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

User avatar
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

Sun Aug 24, 2008 2:46 am

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: 2614
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

Sun Aug 24, 2008 3:36 pm

cool, thanks bobby! :D

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

Sun Aug 24, 2008 9:12 pm

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