Weapon Attribute Device

A place to discuss mods in development and concepts for new mods.
Post Reply
User avatar
pip
Militia Lieutenant
Militia Lieutenant
Posts: 114
Joined: Fri Jul 13, 2012 6:31 am

Basically an "is this possible, or am I just making noise" thread.

A while ago someone requested help in making any weapon omni capable, and someone else produced a snip of code to do just that (I've been looking for this thing for four days now and can only conclude I am useless at searching).

Anyway, I had a thought.
Would it be possible to create an installable device to covert a weapon to omni fire?
Also, would it be possible to create a similar device to mount a weapon in the launcher slot?
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

Yes. Weapons' firing arcs can be changed from default to 'omnidirectional (and their positions changed if necessary).

Existing devices cannot be converted into a launcher. You need to create a separate entity that has the same stats except launcher="true".

EDIT - For setting weapon to be omnidirectional, use this...

Code: Select all

(objSetItemProperty gSource item 'fireArc 'omnidirectional)
where item is the weapon to be upgraded.
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
pip
Militia Lieutenant
Militia Lieutenant
Posts: 114
Joined: Fri Jul 13, 2012 6:31 am

That launcher restriction would explain some of the convolutions in these weapon mods, I knew it had to be specified but had no idea if it could be changed or not.
Thanks PM. Image

----

Code: Select all

<Events>
  <OnInstall>
     (objSetItemProperty gSource item 'fireArc 'omnidirectional)
  </OnInstall>		
</Events>	
That doesn't work, so obviously I've got it wrong.
Wouldn't it need telling to associate itself with an installed weapon, or does gSource do that?
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

item is undefined. You need to do something like enumerate over installed weapons and change the firing arc within that enumeration.
Literally is the new Figuratively
User avatar
pip
Militia Lieutenant
Militia Lieutenant
Posts: 114
Joined: Fri Jul 13, 2012 6:31 am

That seems like perfectly solid advice. Sadly I'm not exactly sure how to do that.
Had a brief look through the wiki (which is not exactly the "friendliest" of resources) and came up with itmEnumTypes, but nothing about it other than how to print lists of everything in the game.
For starters, is that the exp I should be using for this?
And is there anywhere with stuff to read about how to chain all these things together?

(Just as an aside, I haven't touched any kind of code since Total Annihilation was a thing. At least this gem doesn't use cob/bos. That would be awful.
So yeah.... Ever so slightly out of practice.)
User avatar
pip
Militia Lieutenant
Militia Lieutenant
Posts: 114
Joined: Fri Jul 13, 2012 6:31 am

Okay, this is like trying to run through an ocean of treacle.

So far I've got:

Code: Select all

(enum (objGetItems gSource <some means of identifying installed weapons of which I have no clue>)
and then what?
TVR
Militia Commander
Militia Commander
Posts: 334
Joined: Sat Sep 08, 2012 3:26 am

The rest:

Code: Select all

(enum (objGetItems gSource "wI") theItem
    (objSetItemProperty gSource theItem 'fireArc 'omnidirectional)
)
Reference event implementation of omnidirectionalizer device:

Code: Select all

<Events>
    <OnInstall> <!-- For each item on the ship gSource matching criteria "wI" (weapons Installed) set that item's 'fireArc to 'omnidirectional -->
        (objEnumItems gSource "wI" theItem
            (objSetItemProperty gSource theItem 'fireArc 'omnidirectional)
        )
    </OnInstall>

    <OnUninstall> <!-- Opposite of the above, disable omnidirectional enhancement when turret device is uninstalled -->
        (objEnumItems gSource "wI" theItem
            (objSetItemProperty gSource theItem 'fireArc Nil)
        )
    </OnUninstall>

    <OnEnable> <!-- Copy and paste code in OnInstall here -->

    </OnEnable>

    <OnDisable> <!-- Copy and paste code in OnUninstall here -->

    </OnDisable>
</Events>
Fiction is reality, simplified for mass consumption.
PGP: 0x940707ED, 5DB8 4CB4 1EF5 E987 18A0 CD99 3554 3C13 9407 07ED
Bitcoin: 1LLDr7pnZDjXVT5mMDrkqRKkAPByPCQiXQ
User avatar
pip
Militia Lieutenant
Militia Lieutenant
Posts: 114
Joined: Fri Jul 13, 2012 6:31 am

That is.... Wonderful.
Thank you so much! :)

I just wish the wiki was a little more friendly, but lack of time to spend will do that to things.
Post Reply