Bridge Commander Central

BC Forums => BC Scripting => Topic started by: Maxloef on September 03, 2010, 10:14:37 AM

Title: Adding a starbase to a starsystem?
Post by: Maxloef on September 03, 2010, 10:14:37 AM
Can anyone give me some pointers on HOW to add a starbase to a starsystem... ive managed to get a neutral one...and been able t set the alert status..

but i want it to ONLY be friendly to ROMULAN ships...any pointers?
Title: Re: Adding a starbase to a starsystem?
Post by: Morgan on September 03, 2010, 10:54:27 AM
I think its dependent on the AI the base is using. I transplanted one from KM (SelfDefenseAI.py) and was able to have a starbase in a system that would fire if fired upon. Not quite what you're looking for but it's a place to start.
Title: Re: Adding a starbase to a starsystem?
Post by: Maxloef on September 03, 2010, 11:54:02 AM
no its not what im looking for, i want it to be like the starbase 12 AI where if u warp in and ur romulan its hostile...and if u warp in as fed its friendly...only problem is fining the code for it :P

this is what ive got...

Code: [Select]
loadspacehelper.CreateShip("R_TNG_STARBASE", pSet, "IRB Valdore", "Rom_Station_1")

if sRace == "Romulan":
pFriendlies.AddName("IRB Valdore")
else:
pEnemies.AddName("IRB Valdore")
Title: Re: Adding a starbase to a starsystem?
Post by: Mario on September 03, 2010, 01:27:48 PM
On the top of my head something like this should do the job for the starbase 12 scenario.

Imports
Code: [Select]
import App
import Foundation
import MissionLib
import loadspacehelper
import string

Code
Code: [Select]
# variables which need to be changed
sName = "shipName"
sScript = "script"
sLoc = "someLocation"
# pSet = # set you need, uncomment this

# create the ship
loadspacehelper.CreateShip(sScript, pSet, sName, sLoc)
pShip = MissionLib.GetPlayer()
if not pShip:
        print 'bail'
        return
pScript = pShip.GetScript()
if not pScript:
        print 'no script'
        return
pScript = string.split(pScript, '.')[-1]
if not Foundation.shipList.has_key(pScript):
        print 'foundation doesn\'t contain such a ship'
        return
sRace = Foundation.shipList[pScript].race.name
if sRace == "Romulan":
        pMission = App.Game_GetCurrentGame().GetCurrentEpisode().GetCurrentMission()
        pMission.GetEnemyGroup().AddName(sName)
        print 'race is romulan assign the ai here'
else:
        print 'do other stuff like adding other ai'

Title: Re: Adding a starbase to a starsystem?
Post by: Maxloef on September 03, 2010, 01:49:55 PM
it spawns but its neutral :P
Title: Re: Adding a starbase to a starsystem?
Post by: Mario on September 03, 2010, 02:43:13 PM
Code will work if you know how to utilize it, if by neutral you mean gray affiliation color this means the ship was just created not assigned to any particular group.
Title: Re: Adding a starbase to a starsystem?
Post by: Maxloef on September 03, 2010, 03:19:38 PM
Code will work if you know how to utilize it, if by neutral you mean gray affiliation color this means the ship was just created not assigned to any particular group.

any tips/help you can give...im kindoff new to the real scripting :P
Title: Re: Adding a starbase to a starsystem?
Post by: Mario on September 03, 2010, 07:37:39 PM
Not really, learning how to script ain't that easy. If you post the code you actually now have might help in pointing you to the right direction. Exact code which can be inspected for syntax errors.
Title: Re: Adding a starbase to a starsystem?
Post by: Maxloef on September 04, 2010, 03:26:39 PM
Code: [Select]
# variables which need to be changed
sName = "IRB Valdore"
sScript = "R_TNG_STARBASE"
sLoc = "Rom_Station_1"
# pSet = # set you need, uncomment this

# create the ship
loadspacehelper.CreateShip(sScript, pSet, sName, sLoc)
pShip = MissionLib.GetPlayer()
if not pShip:
print 'bail'
return
pScript = pShip.GetScript()
if not pScript:
print 'no script'
return
pScript = string.split(pScript, '.')[-1]
if not Foundation.shipList.has_key(pScript):
print 'foundation doesn\'t contain such a ship'
return
sRace = Foundation.shipList[pScript].race.name
if sRace == "Romulan":
pMission = App.Game_GetCurrentGame().GetCurrentEpisode().GetCurrentMission()
pMission.GetEnemyGroup().AddName(sName)
print 'race is romulan assign the ai here'
else:
print 'do other stuff like adding other ai'

Title: Re: Adding a starbase to a starsystem?
Post by: Mario on September 05, 2010, 09:55:16 AM
I really thought you'd figure out what the prints mean and be able to adapt the code and insert the code where needed for your own needs. Which AI's are you intending on using for this starbase (full loc)?