Author Topic: Mod Idea: Nebula generating weapon  (Read 3388 times)

Offline X_TheUnknown_X

  • Posts: 325
  • Cookies: 328
  • (Semi) Retired
Mod Idea: Nebula generating weapon
« on: May 15, 2009, 04:23:39 PM »
Firstly, Hello! This is probably my first post here (up until now I've just been a 'lurker'  :hide ).

With the introduction out of the way, I want to ask is something is possible. I came up with a mod idea a few days ago after remembering a nebula generating weapon from Armada II, and thought it would be good if the same was possible in Bridge Commander. My idea is to launch a probe/shuttle with a nebula growing from it (perhaps from a shuttle bay??) and use that to weaken enemies.

I have created a new probe with hardpoint and I want to know if it is possible to attach a nebula to the probe - and if so, how?
I have spent some time learning Python - but have never really tried modding BC before.
Any help here :?:

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Attach nebula to ship
« Reply #1 on: May 15, 2009, 05:50:13 PM »
Attaching will work, just do pShip.AttachObject(pNebula) (or pProbe.AttachObject(pNebula) or whatever the object is that you want to attach it to) and the nebula's position and orientation will be relative to the object you attached it to.

But growing an existing nebula might prove a bit harder, you will have to experiment, namely the size is fixed/setup on creation, meaning you would have to delete the nebula before adding a bigger one, which will be noticable, if not the visible notice of popping, then the slowdown of constantly creating and deleting.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline X_TheUnknown_X

  • Posts: 325
  • Cookies: 328
  • (Semi) Retired
Re: Attach nebula to ship
« Reply #2 on: May 16, 2009, 05:34:10 AM »
I see. Constantly creating and deleting the nebula won't look good and will almost certainly slow the game down. I'll have to think of a way around that.

However, I would like to ask where I put the line pShip.AttachObject(pNebula). If i put it in either the ship's model file or hardpoint file I get one of two errors:
1. NameError: pShip
2. AttributeError: AttachObject

Am I missing something here?  :?

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Attach nebula to ship
« Reply #3 on: May 16, 2009, 07:59:42 AM »
No, that most certainly won't work.

Have you programmed before?
Are you aware of "scopes"?


You have to attach it to the probe (which is a ship!) after you create both the probe and the nebula in the function that you call through the button you programmed.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline Rob Archer

  • Posts: 163
  • Cookies: 545
  • New Frontier MKVI
Re: Attach nebula to ship
« Reply #4 on: May 16, 2009, 09:37:24 AM »
But growing an existing nebula might prove a bit harder, you will have to experiment, namely the size is fixed/setup on creation, meaning you would have to delete the nebula before adding a bigger one, which will be noticable, if not the visible notice of popping, then the slowdown of constantly creating and deleting.

You could create the Larger Nebula over the old one then delete the old one then you never see the original get deleted, i'm not sure what effect this would have on game play though. Also it would need to get bigger over time something like .5 units per second or something.

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Attach nebula to ship
« Reply #5 on: May 16, 2009, 10:07:56 AM »
.SetScale might also work.

But you would mostlikely still notice the popping of changing the size.
And to do such a detailed you would need to use the TGSequence, which creates a fixed length sequence of calls to SetScale. If it is supposed to stop growing after a while, then that would work, but I still think you would notic the popping.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline LJ

  • Retired Staff
  • Posts: 1661
  • Cookies: 1139
Re: Attach nebula to ship
« Reply #6 on: May 16, 2009, 01:23:03 PM »
You could overlap by say 5 slightly bigger nebulas and replace the smallest one with the biggest one every few seconds?

Offline X_TheUnknown_X

  • Posts: 325
  • Cookies: 328
  • (Semi) Retired
Re: Attach nebula to ship
« Reply #7 on: May 16, 2009, 03:27:35 PM »
I hate to say that my nebula weapon mod is only just off the drawing board. I have thought of the idea and have created some nebulae and a probe to go with it, but that's about all.

To deploy the weapon, I was initially thinking of using the Shuttle Launching framework to launch a probe and then attach the nebula. Only when I could get that much working would I worry about sizing it.

There are two ways I can see of lauching my probe, but errors keep coming up in the concept: First, use the existing framework to add the NebulaProbe to the shuttles menu (that works), but how I would then add the nebula once it has launched? Second, add a seprate 'Fire nebula weapon' button to the Tactical menu, and then use a button function to launch the NebulaProbe. But, how do I use the framework to fire the probe and attach the nebula without cauing a pile of errors?

I really need to learn how the framework works before continuing. Any ideas?

EDIT: I have just tested a system where one can launch a probe from the existing shuttle launching framework off the Science menu and then deploy the nebula from the Tactical menu. And it works! However, the Nebula's damage settings don't seem to work anymore, it just creates the sphere, that's all. Ideas???

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Help with mod idea: Nebula generating weapon
« Reply #8 on: May 16, 2009, 06:35:34 PM »
You could just load a ship to the set using loadspacehelper.LoadShip.

Also, does it need to be a probe? Couldn't you not just use a projectile and FoundationTechnologies?

@LJ, the real problem is that there is no animation for scaling in BC, meaning it will never be truely fluid, and I fear that your method would, after 5 iterations, just as bad as continuesly (sp) adding/deleting nebula. SetScale would work best (minus the fluid-ness).
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline X_TheUnknown_X

  • Posts: 325
  • Cookies: 328
  • (Semi) Retired
Re: Help with mod idea: Nebula generating weapon
« Reply #9 on: May 17, 2009, 08:32:27 AM »
In testing, I have found a problem with using loadspacehelper.CreateShip(). It just plonks a probe at a random location anywhere in the set. With the shuttle framework, I can create the torpedo from the location of the player. (If i can use loadspacehelper to get the player's location - please tell me how)

I guess it doesn't nececarily have to be a probe, but the advantage here is that you can use the AI to get the probe to follow enemy ships. Or with KM1.0, the helm menu has command ship/fleet options so you can tell your probe where to go.

Also, regarding the nebula's increasing size. Your'e right that it is almost impossible to get the nebula to look fluid when it's growing - unless I use some ridiculously small increase scale each time (which sounds destined to crash the game). Would it be possible to create a NanoFX-style explosion and attach a fully-grown nebula then? (Hopefully, the player should be distracted by the explosion enough so they don't see the nebula appear)

However, I still have a problem with the nebula itself. Apart from just having a fuzzy sphere, there are no interior textures, no sensor jamming effects and no damaging effects. I can't undestand why. Without it, the mod seems next-to-useless.

Offline SMBW

  • Noob
  • Posts: 35
  • Cookies: 107
Re: Help with mod idea: Nebula generating weapon
« Reply #10 on: May 17, 2009, 09:08:30 AM »
lol - I did some test with nebulas some weeks ago. I tried to do it with replacing and well the results weren't that bad but MLeo is right first of all it looks bad (and sometimes funny) and the second problem is the lag - and I think that's the bigger problem. I didn't try set scale though...
Don't part with your illusions. When they are gone you may still exist, but you have ceased to live.  - -  Mark Twain

Sorry for my bad English!

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Help with mod idea: Nebula generating weapon
« Reply #11 on: May 17, 2009, 09:17:03 AM »
@X_TheUnknown_X: If you don't pass in a set (the second parameter), then it will just create the ship, you will then need to add it to the right set and you can then set the desired location through SetTranslateXYZ.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Help with mod idea: Nebula generating weapon
« Reply #12 on: May 17, 2009, 09:17:35 AM »
lol - I did some test with nebulas some weeks ago. I tried to do it with replacing and well the results weren't that bad but MLeo is right first of all it looks bad (and sometimes funny) and the second problem is the lag - and I think that's the bigger problem. I didn't try set scale though...
It will still look a bit funny/bad but the lag should be gone, since it's just the one nebula.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline X_TheUnknown_X

  • Posts: 325
  • Cookies: 328
  • (Semi) Retired
Re: Help with mod idea: Nebula generating weapon
« Reply #13 on: May 17, 2009, 11:40:21 AM »
Success! The nebula now works properly. Thanks to your SetTranslateXYZ() suggestion, MLeo, the nebula is now launched and deolyed from one single button on the Science menu. I am now improvising with different ways of making the nebula expand or explode into life and looking though all the possible bugs / glitches that may appear.

Thanks for everyone's help. If anyone else has any suggestions - please tell me them.

PS: The reason why the nebula wasn't working properly was becuase I forgot to add it to the set.  :oops:

Offline Rob Archer

  • Posts: 163
  • Cookies: 545
  • New Frontier MKVI
Re: Help with mod idea: Nebula generating weapon
« Reply #14 on: May 18, 2009, 05:37:08 PM »

@LJ, the real problem is that there is no animation for scaling in BC, meaning it will never be truely fluid, and I fear that your method would, after 5 iterations, just as bad as continuesly (sp) adding/deleting nebula. SetScale would work best (minus the fluid-ness).

set scale is what i used for the Stargate Event Horizons, it is acctually quite fluid, you just need to get the timing right

Offline LJ

  • Retired Staff
  • Posts: 1661
  • Cookies: 1139
Re: Mod Idea: Nebula generating weapon
« Reply #15 on: May 18, 2009, 05:49:58 PM »
You have a copy of my Python transitions library right? Whap that in a Sequence made up of a few script actions... job done ;-)

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Mod Idea: Nebula generating weapon
« Reply #16 on: May 18, 2009, 06:05:13 PM »
I think you may all be forgetting the strain TGSequence puts BC under, remember how I used that for BPCore Animated Maps? That didn't work really well on a fine grained (small steps) sequence.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline LJ

  • Retired Staff
  • Posts: 1661
  • Cookies: 1139
Re: Mod Idea: Nebula generating weapon
« Reply #17 on: May 19, 2009, 06:06:38 AM »
It should handle a resolution of 0.05 or 0.10 seconds without a hitch (that is like 4 calls out of 60 fps), especially since computers are getting quicker.  It is not like we are really asking it to do much :-)

Offline X_TheUnknown_X

  • Posts: 325
  • Cookies: 328
  • (Semi) Retired
Re: Mod Idea: Nebula generating weapon
« Reply #18 on: May 19, 2009, 03:11:33 PM »
Well, I'm almost embarrased to ask another question now that everything was working properly. I have set up a timer from MissionLib to wait a few seconds before attaching the nebula. However, everytime I add the timer, I keep getting the same error.

My timer is pretty simple:
Code: [Select]
NebulaTimeTimer = MissionLib.CreateTimer(NebulaTimeEvent, __name__ + ".LoadNebula", App.g_kUtopiaModule.GetGameTime() + 5, 0, 0)

LoadNebula just preloads the nebula and attaches it to the probe. When I play Quick Battle and deploy the nebula, I get:

TypeError: no arguments expected

I don't quite get why it's telling my this, becuase I've similar timers used in the Warp Plasma Venting mod without any errors (of course). If I can fix this last bug, I should be finished within the next week or so. Any help, please?  :wink:

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Mod Idea: Nebula generating weapon
« Reply #19 on: May 19, 2009, 03:56:18 PM »
But is the timer creation the line where it says that the TypeError occurred?
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.