Bridge Commander Central
BC Forums => BC Scripting => Topic started 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?
-
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.
-
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...
loadspacehelper.CreateShip("R_TNG_STARBASE", pSet, "IRB Valdore", "Rom_Station_1")
if sRace == "Romulan":
pFriendlies.AddName("IRB Valdore")
else:
pEnemies.AddName("IRB Valdore")
-
On the top of my head something like this should do the job for the starbase 12 scenario.
Imports
import App
import Foundation
import MissionLib
import loadspacehelper
import string
Code
# 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'
-
it spawns but its neutral :P
-
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.
-
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
-
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.
-
# 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'
-
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)?