def ForEachSys (startingsys,functio):
    systemdict={}
    systemdict[startingsys]=functio(startingsys)
    todo=getAdjacentSystemList(startingsys)
    while len(todo):
        tmptodo=todo.pop(-1)
        if (tmptodo not in systemdict):
            todo+=getAdjacentSystemList(tmptodo)
            systemdict[tmptodo]=functio(tmptodo)
    return len(systemdict)
Beispiel #2
0
def ForEachSys(startingsys, functio):
    systemdict = {}
    systemdict[startingsys] = functio(startingsys)
    todo = getAdjacentSystemList(startingsys)
    while len(todo):
        tmptodo = todo.pop(-1)
        if (tmptodo not in systemdict):
            todo += getAdjacentSystemList(tmptodo)
            systemdict[tmptodo] = functio(tmptodo)
    return len(systemdict)
def randomMovement(fg,fac):
    import universe
    import fg_util
    citizen=VS.isCitizen(fac)
    sys=fg_util.FGSystem(fg,fac)
    convoywhere=fg.find("->")
    if (convoywhere!=-1):
        endpoints=[fg[0:convoywhere],fg[convoywhere+2:]]
        
    if fg.find("Insys")!=-1:
        return#can't go about moving insys fgs away
    if (sys!='nil' and fg!=fg_util.BaseFGInSystemName(sys)):
        l = universe.getAdjacentSystemList(sys)
        nthis = fg_util.NumFactionFGsInSystem(fac,sys)
        if (len(l)):
            suggestednewsys = l[vsrandom.randrange(0,len(l))]
            for i in l:
                ifac = VS.GetGalaxyFaction(i)
                if (ifac==fac and nthis > fg_util.NumFactionFGsInSystem(fac,i)):
                    suggestednewsys = i
                elif (VS.GetRelation(fac,ifac)<0):
                    fg_util.TransferFG(fg,fac,i)
                    return
            #                       print 'moving '+fg+' from '+sys+' to '+ newsys
            fg_util.TransferFG( fg,fac,suggestednewsys);
        else:
            pass #debug.debug("flightgroup "+fg+" in system "+sys + " is stuck")
Beispiel #4
0
def attackFlightgroup (fgname, faction, enfgname, enfaction,iscap):
    global dnewsman_
    if (iscap):
        battlename=dnewsman_.TYPE_FLEETBATTLE
        (leader,enleader)=iscap.split(",")
    else:
        battlename = dnewsman_.TYPE_BATTLE
        leader = fg_util.getFgLeaderType(fgname,faction)
        enleader = fg_util.getFgLeaderType(enfgname,enfaction)
    sys = fg_util.FGSystem (fgname,faction)
    ensys = fg_util.FGSystem (enfgname,enfaction)
    if (sys==ensys):
        if (0 and VS.systemInMemory(sys)):
            VS.pushSystem(sys)
            LaunchEqualShips (fgname,faction,enfgname,enfaction)
            VS.TargetEachOther (fgname,faction,enfgname,enfaction)
            VS.popSystem()
        debug.debug("attackFlightgroup(fgname=%s, faction=%s, enfgname=%s, enfaction=%s, iscap=%s)" % (fgname, faction, enfgname, enfaction, iscap))
        SimulatedDukeItOut (fgname,faction,enfgname,enfaction)
    elif (sys!='nil' and ensys!='nil'):
        #pursue other flightgroup
        import universe
        adjSystemList=universe.getAdjacentSystemList(sys)
        if ensys in adjSystemList:
            fg_util.TransferFG (fgname,faction,ensys)
        else:
            return 0
    else:
        #debug.error('nil DRAW error')
        return 0
    if (fg_util.NumShipsInFG(fgname,faction)==0):
        if (fg_util.NumShipsInFG(enfgname,enfaction)==0):
            dnewsman_.writeDynamicString([str(Director.getSaveData(0,"stardate",0)),battlename,dnewsman_.STAGE_END,faction,enfaction,dnewsman_.SUCCESS_DRAW,str(getImportanceOfSystem(sys)),sys,dnewsman_.KEYWORD_DEFAULT,fgname,leader,enfgname,enleader])
        else:
            dnewsman_.writeDynamicString([str(Director.getSaveData(0,"stardate",0)),battlename,dnewsman_.STAGE_END,faction,enfaction,dnewsman_.SUCCESS_LOSS,str(getImportanceOfSystem(sys)),sys,dnewsman_.KEYWORD_DEFAULT,fgname,leader,enfgname,enleader])
        return 0
    elif (fg_util.NumShipsInFG(enfgname,enfaction)==0):
        dnewsman_.writeDynamicString([str(Director.getSaveData(0,"stardate",0)),battlename,dnewsman_.STAGE_END,faction,enfaction,dnewsman_.SUCCESS_WIN,str(getImportanceOfSystem(sys)),sys,dnewsman_.KEYWORD_DEFAULT,fgname,leader,enfgname,enleader])
        return 0
    if (vsrandom.randrange(0,4)==0):
        #FIXME  if it is advantageous to stop attacking only!!
        #FIXME add a stop attacking news report?  -- this should now be fixed, as a draw is reported (not heavilly tested)
        #CAUSES TOO MUCH NEWS#Director.pushSaveString(0,"dynamic_news",dynamic_news.makeVarList([str(Director.getSaveData(0,"stardate",0)),battlename,"end",faction,enfaction,"0",str(getImportanceOfSystem(sys)),sys,"all",fgname,leader,enfgname,enleader]))
        return 0
    if (vsrandom.randrange(0,4)==0 and enfgname!=fg_util.BaseFGInSystemName(ensys)):
        #FIXME  if it is advantageous to run away only
        #FIXME add a retreat news report?  -- this should now be fixed, as a draw is reported (not heavilly tested)
        #CAUSES TOO MUCH NEWS#Director.pushSaveString(0,"dynamic_news",dynamic_news.makeVarList([str(Director.getSaveData(0,"stardate",0)),battlename,"end",faction,enfaction,"-1",str(getImportanceOfSystem(sys)),sys,"all",fgname,leader,enfgname,enleader]))
        num=VS.GetNumAdjacentSystems(ensys)
        if (num>0):
            ensys=VS.GetAdjacentSystem(ensys,vsrandom.randrange(0,num))
            fg_util.TransferFG (fgname,faction,ensys)
    return 1
Beispiel #5
0
def attackFlightgroup (fgname, faction, enfgname, enfaction,iscap):
    global dnewsman_
    if (iscap):
        battlename=dnewsman_.TYPE_FLEETBATTLE
        (leader,enleader)=iscap.split(",")
    else:
        battlename = dnewsman_.TYPE_BATTLE
        leader = fg_util.getFgLeaderType(fgname,faction)
        enleader = fg_util.getFgLeaderType(enfgname,enfaction)
    sys = fg_util.FGSystem (fgname,faction)
    ensys = fg_util.FGSystem (enfgname,enfaction)
    if (sys==ensys):
        if (0 and VS.systemInMemory(sys)):
            VS.pushSystem(sys)
            LaunchEqualShips (fgname,faction,enfgname,enfaction)
            VS.TargetEachOther (fgname,faction,enfgname,enfaction)
            VS.popSystem()
        #debug.debug('duke '+fgname + ' '+enfgname)
        SimulatedDukeItOut (fgname,faction,enfgname,enfaction)
    elif (sys!='nil' and ensys!='nil'):
        #pursue other flightgroup
        import universe
        adjSystemList=universe.getAdjacentSystemList(sys)
        if ensys in adjSystemList:
            fg_util.TransferFG (fgname,faction,ensys)
        else:
            return 0
    else:
        return 0 #debug.debug('nil DRAW error')
    if (fg_util.NumShipsInFG(fgname,faction)==0):
        if (fg_util.NumShipsInFG(enfgname,enfaction)==0):
            dnewsman_.writeDynamicString([str(Director.getSaveData(0,"stardate",0)),battlename,dnewsman_.STAGE_END,faction,enfaction,dnewsman_.SUCCESS_DRAW,str(getImportanceOfSystem(sys)),sys,dnewsman_.KEYWORD_DEFAULT,fgname,leader,enfgname,enleader])
        else:
            dnewsman_.writeDynamicString([str(Director.getSaveData(0,"stardate",0)),battlename,dnewsman_.STAGE_END,faction,enfaction,dnewsman_.SUCCESS_LOSS,str(getImportanceOfSystem(sys)),sys,dnewsman_.KEYWORD_DEFAULT,fgname,leader,enfgname,enleader])
        return 0
    elif (fg_util.NumShipsInFG(enfgname,enfaction)==0):
        dnewsman_.writeDynamicString([str(Director.getSaveData(0,"stardate",0)),battlename,dnewsman_.STAGE_END,faction,enfaction,dnewsman_.SUCCESS_WIN,str(getImportanceOfSystem(sys)),sys,dnewsman_.KEYWORD_DEFAULT,fgname,leader,enfgname,enleader])
        return 0
    if (vsrandom.randrange(0,4)==0):
        #FIXME  if it is advantageous to stop attacking only!!
        #FIXME add a stop attacking news report?  -- this should now be fixed, as a draw is reported (not heavilly tested)
        #CAUSES TOO MUCH NEWS#Director.pushSaveString(0,"dynamic_news",dynamic_news.makeVarList([str(Director.getSaveData(0,"stardate",0)),battlename,"end",faction,enfaction,"0",str(getImportanceOfSystem(sys)),sys,"all",fgname,leader,enfgname,enleader]))
        return 0
    if (vsrandom.randrange(0,4)==0 and enfgname!=fg_util.BaseFGInSystemName(ensys)):
        #FIXME  if it is advantageous to run away only
        #FIXME add a retreat news report?  -- this should now be fixed, as a draw is reported (not heavilly tested)
        #CAUSES TOO MUCH NEWS#Director.pushSaveString(0,"dynamic_news",dynamic_news.makeVarList([str(Director.getSaveData(0,"stardate",0)),battlename,"end",faction,enfaction,"-1",str(getImportanceOfSystem(sys)),sys,"all",fgname,leader,enfgname,enleader]))
        num=VS.GetNumAdjacentSystems(ensys)
        if (num>0):
            ensys=VS.GetAdjacentSystem(ensys,vsrandom.randrange(0,num))
            fg_util.TransferFG (fgname,faction,ensys)
    return 1
Beispiel #6
0
def getSystemsKAwayNoFaction( start, k ):
    set = [start]  #set of systems that have been visited
    pathset = [[start]]  #parallel data structure to set, but with paths
    pathtor = [[start]]  #parallel data structure to raw return systems with path
    r = [start]  #raw data structure containing systems n away where n<=k
    for n in range(0,k):
        set.extend(r)
        pathset.extend(pathtor)
        r=[]
        pathtor=[]
        for iind in range(len(set)):
            i = set[iind]
            l = universe.getAdjacentSystemList(i)
            for jind in range(len(l)):
                j=l[jind]
                if not (j in set or j in r):
                    r.append(j)
                    pathtor.append(pathset[iind]+[j])
    return pathtor
def getSystemsKAwayNoFaction( start, k ):
    set = [start]#set of systems that have been visited
    pathset = [[start]]#parallel data structure to set, but with paths
    pathtor = [[start]]#parallel data structure to raw return systems with path
    r = [start] #raw data structure containing systems n away where n<=k
    for n in range(0,k):
        set.extend(r)
        pathset.extend(pathtor)
        r=[]
        pathtor=[]
        for iind in range(len(set)):
            i = set[iind]
            l = universe.getAdjacentSystemList(i)
            for jind in range(len(l)):
                j=l[jind]
                if not (j in set or j in r):
                    r.append(j)
                    pathtor.append(pathset[iind]+[j])
    return pathtor
def randomMovement(fg,fac):
    import universe
    import fg_util
    sys=fg_util.FGSystem(fg,fac)
    if (sys!='nil' and fg!=fg_util.BaseFGInSystemName(sys)):
        l = universe.getAdjacentSystemList(sys)
        nthis = fg_util.NumFactionFGsInSystem(fac,sys)
        if (len(l)):
            suggestednewsys = l[vsrandom.randrange(0,len(l))]
            for i in l:
                ifac = VS.GetGalaxyFaction(i)
                if (ifac==fac and nthis > fg_util.NumFactionFGsInSystem(fac,i)):
                    suggestednewsys = i
                elif (VS.GetRelation(fac,ifac)<0):
                    fg_util.TransferFG(fg,fac,i)
                    return
            #                       print 'moving '+fg+' from '+sys+' to '+ newsys
            fg_util.TransferFG( fg,fac,suggestednewsys);
        else:
            pass #print "flightgroup "+fg+" in system "+sys + " is stuck"
Beispiel #9
0
def randomMovement(fg,fac):
    import universe
    import fg_util
    citizen=VS.isCitizen(fac)
    sys=fg_util.FGSystem(fg,fac)
    convoywhere=fg.find("->")
    if (convoywhere!=-1):
        endpoints=[fg[0:convoywhere],fg[convoywhere+2:]]
        
    if fg.find("Insys")!=-1:
        return#can't go about moving insys fgs away
    if (sys!='nil' and fg!=fg_util.BaseFGInSystemName(sys)):
        l = universe.getAdjacentSystemList(sys)
        nthis = fg_util.NumFactionFGsInSystem(fac,sys)
        if (len(l)):
            suggestednewsys = l[vsrandom.randrange(0,len(l))]
            sugfac=VS.GetGalaxyFaction(suggestednewsys)
            sugrel=VS.GetRelation(fac,sugfac)
            
            if convoywhere==-1 and (((fac.find(sugfac)!=-1 or sugrel>.5) and citizen) or not citizen):
                fg_util.TransferFG( fg,fac,suggestednewsys);
                #debug.debug('moving '+fg+' from '+sys+' to '+ suggestednewsys)
            else:
                for i in l:
                    ifac = VS.GetGalaxyFaction(i)
                    #if (ifac==fac and nthis > fg_util.NumFactionFGsInSystem(fac,i)):
                    #    suggestednewsys = i
                    likes=False
                    if convoywhere!=-1:
                        if endpoints[0]==i or endpoints[1]==i:
                            likes=True
                    elif VS.GetRelation(fac,ifac)>.5:
                        likes=True
                    if (likes):
                        fg_util.TransferFG(fg,fac,i)
                        return
                #debug.debug('moving '+fg+' from '+sys+' to '+ suggestednewsys)
                fg_util.TransferFG( fg,fac,suggestednewsys);
        else:
            pass #debug.debug("flightgroup "+fg+" in system "+sys + " is stuck")
Beispiel #10
0
def randomMovement(fg,fac):
    import universe

    sys=fg_util.FGSystem(fg,fac)
    if fg.find("Insys")!=-1:
        return  # can't go about moving insys fgs away
    if (sys!='nil' and fg!=fg_util.BaseFGInSystemName(sys)):
        l = universe.getAdjacentSystemList(sys)
        nthis = fg_util.NumFactionFGsInSystem(fac,sys)
        if (len(l)):
            suggestednewsys = l[vsrandom.randrange(0,len(l))]
            for i in l:
                ifac = VS.GetGalaxyFaction(i)
                if (ifac==fac and nthis > fg_util.NumFactionFGsInSystem(fac,i)):
                    suggestednewsys = i
                elif (VS.GetRelation(fac,ifac)<0):
                    fg_util.TransferFG(fg,fac,i)
                    return
            #debug.debug('moving '+fg+' from '+sys+' to '+ suggestednewsys)
            fg_util.TransferFG(fg, fac, suggestednewsys);
        else:
            #debug.debug("flightgroup "+fg+" in system "+sys + " is stuck")
            pass
def AddSysDict (cursys):
    global _generatedsys, _last_progress_percent
    #pick random fighter from insysenemies with .3 probability OR pick one from the friendlies list.
#       debug.debug('Addsysdict')
    sysfaction=VS.GetGalaxyFaction(cursys)

    numflightgroups = 1+vsrandom.randrange(fg_util.MinNumFlightgroupsInSystem(cursys)-1,fg_util.MaxNumFlightgroupsInSystem(cursys))
    
    #debug.debug("Initializing system %s with %d flightgroups... " % (cursys,numflightgroups))
    progress_percent = (float(_generatedsys) / getSystemCount())
    if progress_percent - _last_progress_percent > 0.01:
        ShowProgress.setProgressBar("loading",progress_percent)
        ShowProgress.setProgressMessage("loading","Generating dynamic universe (%.2f%%)" % (100*progress_percent))
        _last_progress_percent = progress_percent
    _generatedsys += 1

    global fgnames, fglists
    i=0
    AddBasesToSystem(sysfaction, cursys)
    adjsystems=getAdjacentSystemList(cursys)
    for i in xrange(len(faction_ships.factions)):
       thisfac=faction_ships.factions[i]
       thisfactionnr=faction_ships.factionToInt(thisfac)
       rel=VS.GetRelation(sysfaction,thisfac)
       iscit=VS.isCitizen(thisfac)
       if iscit and thisfac.find(sysfaction)!=-1:
          #debug.debug("generating spc civilian for "+cursys+" faction "+thisfac)
          #do somethign special for this military faction
          if thisfac==sysfaction:
              pass
          elif iscit:
              for neighbor in adjsystems:
                 if (VS.GetRelation(thisfac,VS.GetGalaxyFaction(neighbor))>-.05):
                   #fgname=cursys+"->"+neighbor
                   fgname="(CivReg) "+GetNewFGName(thisfac)
                   typenumbertuple=GenerateCivilianFgShips(thisfac,thisfactionnr,True)
                   fg_util.AddShipsToFG (fgname,thisfac,typenumbertuple,cursys)
              fgname="Insystem_"+cursys;
              typenumbertuple=GenerateCivilianFgShips(thisfac,thisfactionnr,False)
       if iscit:
          #debug.debug("generating gen civilian for "+cursys+" faction "+thisfac)
          if VS.GetRelation(thisfac,sysfaction)>-.05:#brave citizens of the new order... 
             fgname=GetNewFGName(thisfac)
             typenumbertuple=GenerateCivilianFgShips(thisfac,thisfactionnr,True)
             fg_util.AddShipsToFG (fgname,thisfac,typenumbertuple,cursys)
    friendlychance=.7
    if cursys in faction_ships.fortress_systems:
        friendlychance=faction_ships.fortress_systems[cursys]
        #debug.debug('enemy chance for '+cursys +'= '+str(friendlychance))
    for i in xrange (numflightgroups): #number of fgs in a system.
        faction=sysfaction
        friendly=0
        if not sysfaction or sysfaction=='unknown' or vsrandom.random()>friendlychance:
            faction=faction_ships.get_rabble_of_no_citizen(sysfaction)#why even have citizens on the list then
        else:            
            faction=faction_ships.get_friend_of_no_citizen(sysfaction)#likewise--- maybe this should be a faction_ships fix
            if (faction==sysfaction):
                friendly=1
            if (sysfaction in faction_ships.production_centers):
                if (cursys in faction_ships.production_centers[sysfaction]):
                    friendly=2
            #if (friendly):
            #    debug.debug(faction+" "+sysfaction+" "+cursys)
        factionnr=faction_ships.factionToInt(faction)
        global maxshipsinfg
        typenumbertuple=GenerateFgShips(vsrandom.randrange(maxshipsinfg)+1,factionnr,friendly)
        fgname=GetNewFGName(faction)
        fg_util.AddShipsToFG (fgname,faction,typenumbertuple,cursys)
    return i
def AddSysDict(cursys):
    global _generatedsys, _last_progress_percent
    #pick random fighter from insysenemies with .3 probability OR pick one from the friendlies list.
    #       debug.debug('Addsysdict')
    sysfaction = VS.GetGalaxyFaction(cursys)

    numflightgroups = 1 + vsrandom.randrange(
        fg_util.MinNumFlightgroupsInSystem(cursys) - 1,
        fg_util.MaxNumFlightgroupsInSystem(cursys))

    #debug.debug("Initializing system %s with %d flightgroups... " % (cursys,numflightgroups))
    progress_percent = (_generatedsys / getSystemCount())
    if progress_percent - _last_progress_percent > 0.01:
        ShowProgress.setProgressBar("loading", progress_percent)
        ShowProgress.setProgressMessage(
            "loading",
            "Generating dynamic universe (%.2f%%)" % (100 * progress_percent))
        _last_progress_percent = progress_percent
    _generatedsys += 1

    global fgnames, fglists
    i = 0
    AddBasesToSystem(sysfaction, cursys)
    adjsystems = getAdjacentSystemList(cursys)
    for i in range(len(faction_ships.factions)):
        thisfac = faction_ships.factions[i]
        thisfactionnr = faction_ships.factionToInt(thisfac)
        rel = VS.GetRelation(sysfaction, thisfac)
        iscit = VS.isCitizen(thisfac)
        if iscit and thisfac.find(sysfaction) != -1:
            #debug.debug("generating spc civilian for "+cursys+" faction "+thisfac)
            #do somethign special for this military faction
            if thisfac == sysfaction:
                pass
            elif iscit:
                for neighbor in adjsystems:
                    if (VS.GetRelation(thisfac, VS.GetGalaxyFaction(neighbor))
                            > -.05):
                        #fgname=cursys+"->"+neighbor
                        fgname = "(CivReg) " + GetNewFGName(thisfac)
                        typenumbertuple = GenerateCivilianFgShips(
                            thisfac, thisfactionnr, True)
                        fg_util.AddShipsToFG(fgname, thisfac, typenumbertuple,
                                             cursys)
                fgname = "Insystem_" + cursys
                typenumbertuple = GenerateCivilianFgShips(
                    thisfac, thisfactionnr, False)
        if iscit:
            #debug.debug("generating gen civilian for "+cursys+" faction "+thisfac)
            if VS.GetRelation(
                    thisfac,
                    sysfaction) > -.05:  #brave citizens of the new order...
                fgname = GetNewFGName(thisfac)
                typenumbertuple = GenerateCivilianFgShips(
                    thisfac, thisfactionnr, True)
                fg_util.AddShipsToFG(fgname, thisfac, typenumbertuple, cursys)
    friendlychance = .7
    if cursys in faction_ships.fortress_systems:
        friendlychance = faction_ships.fortress_systems[cursys]
        #debug.debug('enemy chance for '+cursys +'= '+str(friendlychance))
    for i in range(numflightgroups):  #number of fgs in a system.
        faction = sysfaction
        friendly = 0
        if not sysfaction or sysfaction == 'unknown' or vsrandom.random(
        ) > friendlychance:
            faction = faction_ships.get_rabble_of_no_citizen(
                sysfaction)  #why even have citizens on the list then
        else:
            faction = faction_ships.get_friend_of_no_citizen(
                sysfaction
            )  #likewise--- maybe this should be a faction_ships fix
            if (faction == sysfaction):
                friendly = 1
            if (sysfaction in faction_ships.production_centers):
                if (cursys in faction_ships.production_centers[sysfaction]):
                    friendly = 2
            #if (friendly):
            #    debug.debug(faction+" "+sysfaction+" "+cursys)
        factionnr = faction_ships.factionToInt(faction)
        global maxshipsinfg
        typenumbertuple = GenerateFgShips(
            vsrandom.randrange(maxshipsinfg) + 1, factionnr, friendly)
        fgname = GetNewFGName(faction)
        fg_util.AddShipsToFG(fgname, faction, typenumbertuple, cursys)
    return i
def LoadMainCampaign():

    HAULER_SPRITE   = ("campaign/hauler.spr","Talk_To_The_Hauler") #sprite file for the fixer
    HAULER2_SPRITE  = ("campaign/hauler.spr","Talk_To_Jenek") #sprite file for the fixer
    HAULER_LOCATION = ("Crucible/Cephid_17","Atlantis")
    HaulerMission1  = CampaignClickNode() # Initialize each node
    HaulerMission2  = CampaignClickNode() # Initialize each node

    GANGSTER_SPRITE     = ("campaign/gangster.spr","Talk_To_The_Patron")
    GANGSTER_LOCATION   = ("Crucible/Cephid_17","Serenity")
    GangsterSwindled    = CampaignClickNode()

    Hauler2Consequence  = CampaignNode()
    HaulerReward        = CampaignClickNode()

    AngryHauler     = CampaignClickNode()
    AngryGangster   = CampaignClickNode()

    SPY_SPRITE      = ("campaign/investigator.spr","Talk_To_The_Investigator")
    SPY_LOCATION    = ("Crucible/Cephid_17","Ataraxia")
    INVESTIGATORID_SPRITE = "campaign/investigatorID.spr"
    INVESTIGATORID_POSITION= (0, -0.4)
    INVESTIGATORID_SIZE    = (1, 1)
    TailMission1    = CampaignClickNode()
    TailMission2    = CampaignClickNode()
    TailReward      = CampaignClickNode()
    TailRewardPop   = CampaignClickNode()

    GangsterSellout = CampaignClickNode()
    GangsterFight   = CampaignNode()

    GangsterHit1    = CampaignClickNode()
    GangsterHit2    = CampaignClickNode()
    GangsterBounty  = CampaignClickNode()

    GangsterReward  = CampaignClickNode()

    WrapUpSpy       = CampaignNode()
    WrapUpGangster  = CampaignNode()

    vs=Campaign("vega_strike_campaign") # Name of the save game variable for the entire campaign. Can't contain spaces
    vs.Init(HaulerMission1) # the first node.

    description = "Jenek:_Deliver_First_Cargo"
    MakeCargoMission(vs, # Creates a cargo mission
        HAULER_SPRITE, # Campaign, sprite
        [InSystemCondition(HAULER_LOCATION[0],HAULER_LOCATION[1])], # Where fixer meets you to start the mission
        [InSystemCondition("Redemption/Bernards_star","Jacobs")], # Where the mission ends. Usually the same as starting point for next fixer.
        None, # Script to be run as you click on the fixer. A common use is to AddCredits() for the previous mission.
        LoadMission(description,"directions_mission",(vs.name+"_mission",['Crucible/Stirling','Redemption/Bernards_star'], 'Jacobs')),#Script to be run to start the mission (usually None if you don't have a script, but ambush is also common.)
        ("Syringes",2,False), # Mission arguments.
        vs.name+"_mission", # Script to be set on completion. -1=Failure, 0=Not Accepted, 1=Succeed, 2=In progress
        haulerdeal1, # Dictionary containing what the fixer says.
        None, # If you reject the mission twice. "None" means that he continues asking you forever until you accept
        GangsterSwindled, # If you lose the mission
        HaulerMission2, # If you win the mission. Usually points to the next mission
        HaulerMission1) # The current mission node.

    description = "Jenek:_Deliver_Second_Cargo"
    MakeNoFailureCargoMission(vs, # Creates a cargo mission
        HAULER2_SPRITE, # Campaign, sprite
        [InSystemCondition(HAULER_LOCATION[0],HAULER_LOCATION[1])], # Where fixer meets you to start the mission
        [InSystemCondition(GANGSTER_LOCATION[0],GANGSTER_LOCATION[1])], # Where the mission ends. Usually the same as starting point for next fixer.
        ClearFactionRecord('merchant',0.7,PushRelation('merchant')), # Script to be run as you click on the fixer. A common use is to AddCredits() for the previous mission.
        LoadMission(description,"directions_mission",(vs.name+"_mission",[], GANGSTER_LOCATION[1])), # Script to be run to start the mission (usually None if you don't have a script, but ambush is also common.) (having no destination will call significant unit.. oakham should be the only dockable significant in that system
        ("Recycled_Plastics",50,False), #FIXME: varied cargo, and lots of it! Mission arguments.
        vs.name+"_mission", # Script to be set on completion. -1=Failure, 0=Not Accepted, 1=Succeed, 2=In progress
        haulerdeal2, # Dictionary containing what the fixer says.
        GangsterHit1, # If you reject the mission twice. "None" means that he continues asking you forever until you accept
        Hauler2Consequence, # If you lose the mission
        HaulerReward, # If you win the mission. Usually points to the next mission
        HaulerMission2) # The current mission node.

    HaulerReward.Init(vs,
        [InSystemCondition(HAULER_LOCATION[0],HAULER_LOCATION[1])],
        haulerreward,
        HAULER2_SPRITE,
        GoToSubnode(0,AddCredits(2000,ClearFactionRecord('merchant',1.0))),
        None,
        [GangsterHit2])

    GangsterSwindled.Init(vs,
        [InSystemCondition(GANGSTER_LOCATION[0],GANGSTER_LOCATION[1])],
        gangsterswindled,
        GANGSTER_SPRITE,
        GoToSubnode(0,SetCredits(0)),
        None,
        [TailMission1])

    Hauler2Consequence.Init(vs,[],None,None,TrueSubnode(),Hauler2Consequence,[AngryHauler,AngryGangster])

    AngryHauler.Init(vs,
        [InSystemCondition(HAULER_LOCATION[0],HAULER_LOCATION[1])],
        angryhauler,
        HAULER2_SPRITE,
        GoToSubnode(0,AdjustRelation('privateer','pirates',-0.05,AdjustRelation('privateer','merchant',-0.1,PopRelation('merchant')))),
        None,
        [GangsterFight])

    AngryGangster.Init(vs,
        [InSystemCondition(GANGSTER_LOCATION[0],GANGSTER_LOCATION[1])],
        angrygangster,
        GANGSTER_SPRITE,
        GoToSubnode(0,AdjustRelation('privateer','pirates',-0.05,AdjustRelation('privateer','merchant',-0.1,PopRelation('merchant')))),
        None,
        [GangsterFight])

    MakeMission(vs, # Creates any type of mission
        SPY_SPRITE, # Campaign, sprite
        [InSystemCondition(SPY_LOCATION[0],SPY_LOCATION[1])], # Where fixer meets you to start the mission
        [InSystemCondition(SPY_LOCATION[0],SPY_LOCATION[1])], # Where the mission ends.
        None, # Script on click
        AddRemovingSprite("investigatorID", INVESTIGATORID_SPRITE, INVESTIGATORID_POSITION, INVESTIGATORID_SIZE, "Give back the ID"), # Script to be run to start the mission (usually None if you don't have a script. Do NOT load an ambush mission here.)
        'tail',
        (vs.name+"_mission",0,["Crucible/Cephid_17","Crucible/17-ar","Redemption/Quetal"],30000,11000,"pirates","confed","Napolae","IntelSEC"), # Mission arguments.
        vs.name+"_mission", # Script to be set on completion. -1=Failure, 0=Not Accepted, 1=Succeed, 2=In progress
        confed_tail_finance, # Dictionary containing what the fixer says.
        GangsterSellout, # If you reject the mission twice. "None" means that he continues asking you forever until you accept
        GangsterFight, # If you lose the mission
        TailRewardPop, # Win mission
        TailMission1)

    MakeMission(vs, # Creates any type of mission
        SPY_SPRITE, # Campaign, sprite
        [InSystemCondition(SPY_LOCATION[0],SPY_LOCATION[1])], # Where fixer meets you to start the mission
        [InSystemCondition(SPY_LOCATION[0],SPY_LOCATION[1])], # Where the mission ends.
        PushNews(hitsuccess), # Script on click
        AddRemovingSprite("investigatorID", INVESTIGATORID_SPRITE, INVESTIGATORID_POSITION, INVESTIGATORID_SIZE, "Give back the ID"), # Script to be run to start the mission (usually None if you don't have a script. Do NOT load an ambush mission here.)
        'tail',
        (vs.name+"_mission",0,["Crucible/Cephid_17","Crucible/17-ar","Redemption/Quetal"],30000,11000,"pirates","confed","Napolae","IntelSEC"), # Mission arguments.
        vs.name+"_mission", # Script to be set on completion. -1=Failure, 0=Not Accepted, 1=Succeed, 2=In progress
        confed_tail_insider, # Dictionary containing what the fixer says.
        GangsterFight, # If you reject the mission twice. "None" means that he continues asking you forever until you accept
        GangsterFight, # If you lose the mission
        TailReward, # Win mission
        TailMission2)

    TailRewardPop.Init(vs,
        [InSystemCondition(SPY_LOCATION[0],SPY_LOCATION[1])],
        tailreward,
        SPY_SPRITE,
        GoToSubnode(0,AddCredits(50000,PopCredits(AdjustRelation('privateer','pirates',-0.55,AdjustRelation('privateer','confed',0.2))))),
        None,
        [WrapUpSpy])

    TailReward.Init(vs,
        [InSystemCondition(SPY_LOCATION[0],SPY_LOCATION[1])],
        tailreward,
        SPY_SPRITE,
        GoToSubnode(0,AddCredits(50000,AdjustRelation('privateer','pirates',-0.55,AdjustRelation('privateer','confed',0.2)))),
        None,
        [WrapUpSpy])

    GangsterSellout.Init(vs,
        [InSystemCondition(GANGSTER_LOCATION[0],GANGSTER_LOCATION[1])],
        gangstersellout,
        GANGSTER_SPRITE,
        GoToSubnode(0,AdjustRelation('privateer','pirates',-0.35)),
        None,
        [GangsterFight])

    description = "Luviccio:_Deliver_Cargo_To_Jenek"
    MakeCargoMission(vs, # Creates a cargo mission
        GANGSTER_SPRITE, # Campaign, sprite
        [InSystemCondition(GANGSTER_LOCATION[0],GANGSTER_LOCATION[1])], # Where fixer meets you to start the mission
        [InSystemCondition(HAULER_LOCATION[0],HAULER_LOCATION[1])], # Where the mission ends. Usually the same as starting point for next fixer.
        None, # Script to be run as you click on the fixer. A common use is to AddCredits() for the previous mission.
        LoadMission(description,"directions_mission",(vs.name+"_mission",[], HAULER_LOCATION[1])),# Script to be run to start the mission (usually None if you don't have a script, but ambush is also common.)
        ("Low_Yield_Explosives",1), # Mission arguments.
        vs.name+"_mission", # Script to be set on completion. -1=Failure, 0=Not Accepted, 1=Succeed, 2=In progress
        gangsterhit1, # Dictionary containing what the fixer says.
        TailMission2, # If you reject the mission twice. "None" means that he continues asking you forever until you accept
        GangsterFight, # If you lose the mission
        GangsterBounty, # If you win the mission. Usually points to the next mission
        GangsterHit1) # The current mission node.

    description = "Luviccio:_Deliver_Cargo_To_Jenek"
    MakeCargoMission(vs, # Creates a cargo mission
        GANGSTER_SPRITE, # Campaign, sprite
        [InSystemCondition(GANGSTER_LOCATION[0],GANGSTER_LOCATION[1])], # Where fixer meets you to start the mission
        [InSystemCondition(HAULER_LOCATION[0],HAULER_LOCATION[1])], # Where the mission ends. Usually the same as starting point for next fixer.
        None, # Script to be run as you click on the fixer. A common use is to AddCredits() for the previous mission.
        LoadMission(description,"directions_mission",(vs.name+"_mission",[], HAULER_LOCATION[1])),# Script to be run to start the mission (usually None if you don't have a script, but ambush is also common.)
        ("Low_Yield_Explosives",1), # Mission arguments.
        vs.name+"_mission", # Script to be set on completion. -1=Failure, 0=Not Accepted, 1=Succeed, 2=In progress
        gangsterhit2, # Dictionary containing what the fixer says.
        TailMission2, # If you reject the mission twice. "None" means that he continues asking you forever until you accept
        GangsterFight, # If you lose the mission
        GangsterBounty, # If you win the mission. Usually points to the next mission
        GangsterHit2) # The current mission node.

    MakeMission(vs, # Creates any type of mission
        GANGSTER_SPRITE, # Campaign, sprite
        [InSystemCondition(GANGSTER_LOCATION[0],GANGSTER_LOCATION[1])], # Where fixer meets you to start the mission
        [], # Where the mission ends. Usually the same as starting point for next fixer.
        AdjustRelation('privateer','pirates',0.2,AdjustRelation('privateer','merchant',-0.1,PushNews(hitsuccess))),
        None, # Script to be run to start the mission (usually None if you don't have a script. Do NOT load an ambush mission here.)
        'bounty',(0,0,0,False,0,'confed',(),vs.name+"_mission",'','',True,[]), #Mission arguments.
        vs.name+"_mission", # Script to be set on completion. -1=Failure, 0=Not Accepted, 1=Succeed, 2=In progress
        gangsterbounty, # Dictionary containing what the fixer says.
        GangsterFight, # If you reject the mission twice. "None" means that he continues asking you forever until you accept
        GangsterFight, # If you lose the mission
        GangsterReward,
        GangsterBounty)

    GangsterReward.Init(vs,
        [InSystemCondition(GANGSTER_LOCATION[0],GANGSTER_LOCATION[1])],
        gangsterreward,
        GANGSTER_SPRITE,
        GoToSubnode(0,AddCredits(10000,AdjustRelation('privateer','pirates',0.2,AdjustRelation('privateer','confed',-0.5)))),
        None,
        [WrapUpGangster])

    GangsterFight.Init(vs,
        [],
        [],
        None,
        GoToSubnode(0,(LoadMission("ambush","ambush",(vs.name+"_mission",universe.getAdjacentSystemList(GANGSTER_LOCATION[0]),0,'pirates',4,'','',["You shouldn't have left that system, Luviccio hadn't finished with you.", "No matter, we'll finish you for him!"])))),
        None,
        [WrapUpSpy])

    WrapUpSpy.Init(vs,
        [],
        [],
        None,
        GoToSubnode(0,(PushNews(confedwin))),
        None,
        [CampaignEndNode(vs)])

    WrapUpGangster.Init(vs, # savegame variable
        [], #start location
        [], #dialog
        None, # fixer sprite
        GoToSubnode(0,(PushNews(piratewin))), # subnode script
        None, # completion script
        #campaign_pirates.Mission1) #[CampaignEndNode(vs)]) # continue with next mission
        [CampaignEndNode(vs)]) # continue with next mission

    return vs