Bridge Commander Central
BC Forums => BC Scripting => Topic started by: Lord Tribble on May 28, 2013, 10:48:47 AM
-
This is probably a face palm worthy simple thing, but I can't for the life of me figure it out.
How do I completely replace the stock ships (Bird of Prey, warbird etc) by editing the scripts rather than replacing the model/icon files?
I've already got them to use the right models and HP by changing the scripts/ships files, but when I try to create a script for them in scripts/custom to change the description and icon, I end up with duplicate entries in ship selection menus. The script does change the icon and description, but I get two buttons for the same ship.
I know it must be possible to do this without duplicating as I've had mods that replaced the stock Fed ships, and been able to later edit those scripts to change the description and icons.
-
did you use BCUT? did you delete the pyc files?
-
I've tried making the plugin file both by copying and editing one from another bop, and creating an entirely new one in bcut
As far as I could see, there wasn't a pyc file to delete for the stock ones :idk:
-
can you post the code of one of your plugins youre trying to change?
there are 2 different ways to go about this...
-
##### Created by:
##### Bridge Commander Universal Tool
import App
import Foundation
abbrev = "BirdOfPrey"
iconName = "ErmeyBOP"
longName = "Bird of Prey"
shipFile = "BirdOfPrey"
species = App.SPECIES_GALAXY
menuGroup = "Klingon Ships"
playerMenuGroup = "Klingon Ships"
Foundation.ShipDef.BirdOfPrey = Foundation.KlingonShipDef(abbrev, species, { 'name': longName, 'iconName': iconName, 'shipFile': shipFile })
Foundation.ShipDef.BirdOfPrey.desc = "test1"
if menuGroup: Foundation.ShipDef.BirdOfPrey.RegisterQBShipMenu(menuGroup)
if playerMenuGroup: Foundation.ShipDef.BirdOfPrey.RegisterQBPlayerShipMenu(playerMenuGroup)
if Foundation.shipList._keyList.has_key(longName):
Foundation.ShipDef.__dict__[longName].friendlyDetails[2] = Foundation.shipList[longName].friendlyDetails[2]
Foundation.ShipDef.__dict__[longName].enemyDetails[2] = Foundation.shipList[longName].enemyDetails[2]
-
ok first off - the EmeryBOP icon - why didnt you just rename that and then overwrite the stock BOP icon with that one?
for the ship description - you can try this in the plugin (after import Foundation)
ship = Foundation.ShipDef.BirdOfPrey"
ship.hasTGLName = 0
ship.hasTGLDesc = 1
the other method would be to edit the ships.TGL (using TGL editor) for the Bird Of Prey entry...
-
ok first off - the EmeryBOP icon - why didnt you just rename that and then overwrite the stock BOP icon with that one?
Trying to see if I could do it without ;)
for the ship description - you can try this in the plugin (after import Foundation)
ship = Foundation.ShipDef.BirdOfPrey"
ship.hasTGLName = 0
ship.hasTGLDesc = 1
the other method would be to edit the ships.TGL (using TGL editor) for the Bird Of Prey entry...
Tried adding that, no difference :(.
I don't understand how some mods have done what I'm trying to do. They don't seem to have touched the TGL
-
I've tried making the plugin file both by copying and editing one from another bop, and creating an entirely new one in bcut
As far as I could see, there wasn't a pyc file to delete for the stock ones :idk:
if it's stock, the game should only have a .pyc for it. The stock game doesn't have any uncompiled .py files. In order to get those, you need to download the SDK. And the game should automatically compile any .py files it can find too.
-
rename the icon to have the same name as the stock icon and overwrite it...
also try manually editing the Ships.TGL itself...
if it's stock, the game should only have a .pyc for it. The stock game doesn't have any uncompiled .py files. In order to get those, you need to download the SDK. And the game should automatically compile any .py files it can find too.
the stock game doesnt come with any plugins... all the stock ship plugins are in the StaticDefs script...
also, the game wont compile any py files on it's own...
-
I've just tried what I was doing with the warbird, and that worked fine.
The bop however still doesn't wan't to play ball, I can change the icon and description with the scripts/custom plugin, but I also get two buttons for it :idk:
-
Found where I was going wrong; in the staticdefs file, the bird of prey is given 'BOP' as a name. I entered that into the longname field and it has successfully overidden the other button.
It showed up as BOP in the friendly and enemy lists though, so I added the tgl name line to call them 'Bird of Prey' again. They're not given numbers but the stock didn't get them either so I'm not gonna try to bodge that.
This is the plugin script I ended up with;
-------------------
##### Created by:
##### Bridge Commander Universal Tool
import App
import Foundation
abbrev = "BirdOfPrey"
iconName = "ErmeyBOP"
longName = "BOP"
shipFile = "BirdOfPrey"
species = App.SPECIES_BIRD_OF_PREY
menuGroup = "Klingon Ships"
playerMenuGroup = "Klingon Ships"
Foundation.ShipDef.BirdOfPrey = Foundation.KlingonShipDef(abbrev, species, { 'name': longName, 'iconName': iconName, 'shipFile': shipFile })
Foundation.ShipDef.BirdOfPrey.hasTGLName = 1
#Foundation.ShipDef.BirdOfPrey.hasTGLDesc = 1
#Foundation.ShipDef.BirdOfPrey.name = "Bird of Prey"
Foundation.ShipDef.BirdOfPrey.desc = "No information available."
if menuGroup: Foundation.ShipDef.BirdOfPrey.RegisterQBShipMenu(menuGroup)
if playerMenuGroup: Foundation.ShipDef.BirdOfPrey.RegisterQBPlayerShipMenu(playerMenuGroup)
if Foundation.shipList._keyList.has_key(longName):
Foundation.ShipDef.__dict__[longName].friendlyDetails[2] = Foundation.shipList[longName].friendlyDetails[2]
Foundation.ShipDef.__dict__[longName].enemyDetails[2] = Foundation.shipList[longName].enemyDetails[2]
---------------------
I found a way of doing it by editing the staticdefs file as well, but I didn't want to risk messing up any foundation scripts. Not really sure what the tgls are so I didn't want to risk breaking those either!
Thanks Guys!