Linking Campaigns

This is the location for all mods to collaborate. Anyone making or planning their own mod should post help requests, screen shots and news here.

Moderators: Omega, tillias, Mod Contributor

Linking Campaigns

Postby pyramid » Fri Mar 11, 2011 8:38 pm

I have followed the Development Campaign Tutorial.

I have a new campaign stored in campaign_new.py and want to link (=start new campaign when the main campaign is over) the first mission to the end of the last Jenek mission, which is:
Code: Select all
    WrapUpGangster.Init(vs, # savegame variable
        [], #start location
        [], #dialog
        None, # fixer sprite
        GoToSubnode(0,(PushNews(piratewin))), # subnode script
        None, # completion script
        [CampaignEndNode(vs)])


I should reference the first mission from my new LoadNewCampaign, but how do I do this?
User avatar
pyramid
Expert Mercenary
Expert Mercenary
 
Posts: 960
Topics: 44
Joined: Wed Jun 14, 2006 6:02 pm
Location: Somewhere in the vastness of space

Share On:

Share on Facebook Facebook Share on Twitter Twitter Share on Digg Digg

Re: Linking Campaigns

Postby klauss » Fri Mar 11, 2011 9:00 pm

You'll have extensive examples in the privateer campaign. Check it out. When i get a more comfortable connection, I'm on a mobile now, i'll try to find and post one
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
User avatar
klauss
Elite
Elite
 
Posts: 7243
Topics: 55
Joined: Mon Apr 18, 2005 7:40 am
Location: LS87, Buenos Aires, República Argentina

Re: Linking Campaigns

Postby pyramid » Sat Mar 12, 2011 5:29 pm

As I understand, PU doesn't check the finalization conditions of previous missions. The characters are there in the bars of the starting bases since the beginning of the game. I suppose, this is because the campaigns are independent from each other.

As such, using save variables might be a good way to check the status of previous campaigns. I try it that way.
User avatar
pyramid
Expert Mercenary
Expert Mercenary
 
Posts: 960
Topics: 44
Joined: Wed Jun 14, 2006 6:02 pm
Location: Somewhere in the vastness of space

Re: Linking Campaigns

Postby klauss » Sat Mar 12, 2011 10:51 pm

Ok, this is an extract from campaigns.py in privateer:

Code: Select all
   MakeCargoMission(priv, # Creates a cargo mission

      SANDOVAL_SPRITE, # Campaign, sprite

      [InSystemCondition("Gemini/New_Detroit","New_Detroit")], # Where fixer meets you to start the mission

      [InSystemCondition("Gemini/Newcastle","Liverpool")], # 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.
      AddCargo('Artifact',1,True,

         SetSaveVariable('terrell_no_entry',1.0,

            AddRemovingSprite("artifact_1", ARTIFACT1_SPRITE, ARTIFACT_POSITION, ARTIFACT_SIZE, "Put_Away_the_Artifact",

               LoadMission("directions_mission","directions_mission",

                  (priv.name+"_mission",['Gemini/New_Constantinople', 'Gemini/Newcastle'], 'Liverpool'),

                  vars=dict(MISSION_SHORTDESC=sandovalspeech.get('shortdesc','Campaign mission')) )))),

      # Script to be run to start the mission (usually None if you don't have a script, but ambush is also common.)

      ("Iron",10), # Mission arguments.

      #[['Gemini/New_Constantinople', 'Gemini/Newcastle'], 'Liverpool'], # directions

      priv.name+"_mission", # Script to be set on completion. -1=Failure, 0=Not Accepted, 1=Succeed, 2=In progress

      sandovalspeech, # Dictionary containing what the fixer says.

      None, # If you reject the mission twice. "None" means that he continues asking you forever until you accept

      CampaignEndNode(priv), # If you lose the mission

      SandovalFinish, # If you win the mission. Usually points to the next mission

      SandovalMission1) # The current mission node.



It's very informative on its own, the comments say it all.

You can find the entire script here.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
User avatar
klauss
Elite
Elite
 
Posts: 7243
Topics: 55
Joined: Mon Apr 18, 2005 7:40 am
Location: LS87, Buenos Aires, República Argentina

Re: Linking Campaigns

Postby pyramid » Sun Mar 13, 2011 11:19 am

That is not the point. I am still learning but the basic idea how to write missions in a campaign is clear to me.

What I don't know is how to make one campaign start or not depending on the outcome of a previous campaign. This is not done in priv pu since campaigns are independent as far as I could see.

Let's make this concrete. I have the main campaign with the ending node:
Code: Select all
def LoadMainCampaign():

    ... missions ...

    WrapUpGangster.Init(
        ...
        [CampaignEndNode(vs)]) # continue with next mission
   
    return vs


Now I want to start my new campaign only if this particular last node of the main campaign was reached, something like:

Code: Select all
def LoadMainCampaign():
    ... missions ...
    WrapUpGangster.Init(
        ...
        [LoadNewCampaign.Mission1]) # continue with next mission <<<---- ADD DEPENDENCY HERE
    return vs

def LoadNewCampaign():
    Make Mission(
        ...
        Mission1) # The current mission node.
    return vs


Btw, while I was playing a bit I realized that all the fixer missions do get a "nothing.mission" description in the mission computer under "Active missions". Must be something deeper in the python files, but after 3h of investigation, I couldn't find the right clue. I have submitted tracker artifact 3208662 for this bug.
User avatar
pyramid
Expert Mercenary
Expert Mercenary
 
Posts: 960
Topics: 44
Joined: Wed Jun 14, 2006 6:02 pm
Location: Somewhere in the vastness of space

Re: Linking Campaigns

Postby klauss » Sun Mar 13, 2011 11:33 am

If you take a look, there were conditions for start and end of the mission, you can add custom conditions there.

Most missions in privateer have InSystemCondition, but you could use SaveVariableCondition or code custom ones.

The scripts ran when missions succeed or fail can set variables too, so there you have a possible mechanism.

You could also play with campaign nodes, but I don't know much about how that works.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
User avatar
klauss
Elite
Elite
 
Posts: 7243
Topics: 55
Joined: Mon Apr 18, 2005 7:40 am
Location: LS87, Buenos Aires, República Argentina

Re: Linking Campaigns

Postby pyramid » Sun Mar 13, 2011 11:41 am

OK. Cool & Thanks for confirmation. That was the direction I was thinking to go using SaveVariable condition.

Re: nothing.mission, I found changing the mission_lib.LoadLastMission code results somehow (at least I can set campaign mission descriptions, though e.g. fixer cargo mission is still displaying rubbish.

Since I don't have codestriker access (can this be changed?), I submit here the change proposal:
Code: Select all
def LoadLastMission(which=None):
    plr = getMissionPlayer()
    if which is None:
        which = players[plr].lastMission
    if VS.networked():
        custom.run('mission_lib', ['LoadLastMission',which], None)
        return
   
    last_constructor = players[plr].last_constructor
    last_args = players[plr].last_args
    last_briefing_vars = players[plr].last_briefing_vars
    last_briefing = players[plr].last_briefing
    if which in last_constructor and which in last_args:
        if last_constructor[which]==None:
            if type(last_args[which])==str:
                VS.LoadNamedMissionScript(which, last_args[which])
            else:
                VS.LoadNamedMissionScript(which, repr(last_args[which])+"()")
        else:
            cons = last_constructor[which]
            if type(cons)!=str:
                cons=cons.__name__         
            if type(last_args[which])==str:
                VS.LoadNamedMissionScript(which, '#\nimport '+cons+'\n'+cons+'.'+cons+last_args[which])
            else:
                VS.LoadNamedMissionScript(which, '#\nimport '+cons+'\n'+cons+'.'+cons+repr(last_args[which]))
        del last_args[which]
        del last_constructor[which]
    else:
        debug.debug('No last mission with name "'+str(which)+'"')
User avatar
pyramid
Expert Mercenary
Expert Mercenary
 
Posts: 960
Topics: 44
Joined: Wed Jun 14, 2006 6:02 pm
Location: Somewhere in the vastness of space

Re: Linking Campaigns

Postby klauss » Sun Mar 13, 2011 1:25 pm

pyramid wrote:Since I don't have codestriker access (can this be changed?), I submit here the change proposal:

Post the patch in sourceforge's issue tracker, in the patches section.

I've already asked SF to make it so that any project developer can post patches to code striker, but they're not paying attention. In the meanwhile, I take the patch off the patch tracker and put it up for review if needed.

Patches are better than pasting the code as you did since it's easier to see the changes and test the patches by applying them to our local working copy, all automated.

Also, explain somewhat the rationale for the changes in the tracker, as I have no idea what that function does or should do ;)
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
User avatar
klauss
Elite
Elite
 
Posts: 7243
Topics: 55
Joined: Mon Apr 18, 2005 7:40 am
Location: LS87, Buenos Aires, República Argentina

Re: Linking Campaigns

Postby pyramid » Mon Mar 14, 2011 12:36 pm

Ok. The patch artifact 3211810 is posted.
User avatar
pyramid
Expert Mercenary
Expert Mercenary
 
Posts: 960
Topics: 44
Joined: Wed Jun 14, 2006 6:02 pm
Location: Somewhere in the vastness of space

Re: Linking Campaigns

Postby pyramid » Wed Mar 16, 2011 5:56 pm

The last patch corrected the mission description for campaign generated missions.

The following patch artifact 3217829 was posted for review. It corrects the description for fixer based missions in the mission computer.
User avatar
pyramid
Expert Mercenary
Expert Mercenary
 
Posts: 960
Topics: 44
Joined: Wed Jun 14, 2006 6:02 pm
Location: Somewhere in the vastness of space

Re: Linking Campaigns

Postby pheonixstorm » Wed Mar 16, 2011 6:10 pm

If I can ever get the mission editor done none of this will be a problem.. though I need to find more time. With the wife working and the kids being sick my free time has gone to almost zero :(
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
User avatar
pheonixstorm
Elite
Elite
 
Posts: 1567
Topics: 113
Joined: Mon Jan 25, 2010 7:03 pm



Return to General Modding

Who is online

Users browsing this forum: No registered users and 1 guest