The reason there are no missions in VS the Game
-
- Expert Mercenary
- Posts: 988
- Joined: Thu Jun 15, 2006 1:02 am
- Location: Somewhere in the vastness of space
- Contact:
The reason there are no missions in VS the Game
For the past couple of days I've been browsing, viewing, reading the svn, the code, the scripts, the forum, the wiki. I'm getting tired... or I'm dumb.
My task is simple, but I feel that the lack of up-to-date documentation is making things more difficult than they actually should or might be. And judging by the lack of actual missions in vs the game, I must assume that many others feel the same.
With this compressed preamble, I'd specifically like to know the following (one small step for a man, one giant leap for the community):
1) I want to write a tiny simple tutorial mission (in order to test out the missions concept AND actually document it): when I start a new campaign and undock from Atlantis, i want to find a small tutorial drone that says "hullo". (Enough, as I said, "small" is the key word here).
2) I suppose I don't need to do anything in the missions folder, since I am already running the explore_universe.mission with my new campaign?
3) I place my script (tutorial.py) in the modules folder then start vs, select campaign? and nothing happens.
4) What now?
My task is simple, but I feel that the lack of up-to-date documentation is making things more difficult than they actually should or might be. And judging by the lack of actual missions in vs the game, I must assume that many others feel the same.
With this compressed preamble, I'd specifically like to know the following (one small step for a man, one giant leap for the community):
1) I want to write a tiny simple tutorial mission (in order to test out the missions concept AND actually document it): when I start a new campaign and undock from Atlantis, i want to find a small tutorial drone that says "hullo". (Enough, as I said, "small" is the key word here).
2) I suppose I don't need to do anything in the missions folder, since I am already running the explore_universe.mission with my new campaign?
3) I place my script (tutorial.py) in the modules folder then start vs, select campaign? and nothing happens.
4) What now?
-
- Expert Mercenary
- Posts: 988
- Joined: Thu Jun 15, 2006 1:02 am
- Location: Somewhere in the vastness of space
- Contact:
Re: The reason there are no missions in VS the Game
Judging by overwhelming amount of replies I see that all of you are actually mission and campaign scripting experts .
4) What I have found out so far:
3) There are two ways of hooking up a campaign / mission:
* Initialize a campaign by a fixer from a base. Here we need to import the campaign script into campaigns.py and add the launch script to the campaignsloaders line. Somehow my campaign became mixed up with the Janek campaign and I did not pursue this further.
* Create a quest in space and hook it up through mission_lib.py the adventure.py.
2) As far as I have seen, the mission xml files in the mission folder can be used to test a mission or campaign without loading a savegame. (???)
1) Instead of saying "Hi", the ship I am launching simply starts shooting at me
I can launch it with the "VS.launch" or "launch.launch_wave_around_unit" commands though the behavior is exactly the same and doesn't change with the AI I am setting (stop, kickstop, sitting_duck, default). On top of it all, it simply disappears after a couple of seconds.
First of all, how can I make my tutorial drone stay with me and be friendly?
4) What I have found out so far:
3) There are two ways of hooking up a campaign / mission:
* Initialize a campaign by a fixer from a base. Here we need to import the campaign script into campaigns.py and add the launch script to the campaignsloaders line. Somehow my campaign became mixed up with the Janek campaign and I did not pursue this further.
* Create a quest in space and hook it up through mission_lib.py the adventure.py.
2) As far as I have seen, the mission xml files in the mission folder can be used to test a mission or campaign without loading a savegame. (???)
1) Instead of saying "Hi", the ship I am launching simply starts shooting at me
I can launch it with the "VS.launch" or "launch.launch_wave_around_unit" commands though the behavior is exactly the same and doesn't change with the AI I am setting (stop, kickstop, sitting_duck, default). On top of it all, it simply disappears after a couple of seconds.
First of all, how can I make my tutorial drone stay with me and be friendly?
-
- The Shepherd
- Posts: 5841
- Joined: Fri May 13, 2005 8:37 pm
- Location: Ottawa
- Contact:
@pyramid a PM to Dilloh on the PU team should give some more info as they do have a working campaign and are in the process of bug hunting with the new version of the engine there main story lines are working now they do have some challenges getting the scripts to behave but are making progress.
Enjoy the Choice
Enjoy the Choice
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
-
- Elite Hunter
- Posts: 1149
- Joined: Mon Aug 14, 2006 3:56 pm
- Location: Black Forest, Germany
Hi Pyramid...
should do the job.
The "LoadYourCampaign" def must be present in the yourcampaign.py file. I can give you a short summary of a one-mission script, infinetively repeating when you reclick the fixer, if you like.
Check if your script contains a similar condition which could make the drone disappear.
Or, much simpler, could you post your script?
i want to find a small tutorial drone that says "hullo".
Code: Select all
def__init__(self,greetingText=["Hullo."]):
Most likely not... I've only been working on embedded fixer-based missions so far, but I believe that's the folder being used for scripts that can be run via the VS launcher.I suppose I don't need to do anything in the missions folder, since I am already running the explore_universe.mission with my new campaign?
Try to put it into the mission folder. Modules is for scripts that will be used during the game runs.I place my script (tutorial.py) in the modules folder then start vs, select campaign? and nothing happens.
You need the following lines:Initialize a campaign by a fixer from a base. Here we need to import the campaign script into campaigns.py and add the launch script to the campaignsloaders line. Somehow my campaign became mixed up with the Janek campaign and I did not pursue this further.
Code: Select all
import yourcampaign
campaignsloaders=[lambda:LoadMainCampaign(),lambda:LoadYourCampaign()]
I have no experience with that, and therefor I probably cannot help you with that. But it shouldn't be too difficult to do it that way, and it might be easier to track errors.Create a quest in space and hook it up through mission_lib.py the adventure.py.
Sorry, I don't have VS on my HDD, PR/PU doesn't have XML files for missions, and I doubt that they're of any use.As far as I have seen, the mission xml files in the mission folder can be used to test a mission or campaign without loading a savegame. (???)
Assuming you're using quest_drone as a base, I found the following there:I can launch it with the "VS.launch" or "launch.launch_wave_around_unit" commands though the behavior is exactly the same and doesn't change with the AI I am setting (stop, kickstop, sitting_duck, default). On top of it all, it simply disappears after a couple of seconds.
Unknown is an always-hostile factions, at least it's in PR. So changing it to confed should make it a lot happier.drone=VS.launch("IO47","drone","unknown","unit","default",1,1,vec,'')
Code: Select all
if (playa.isNull()):
return 1
if not quest.checkSaveValue(playa.isPlayerStarship(),'privateer_drone_active',1):
return 1
Or, much simpler, could you post your script?
-
- Expert Mercenary
- Posts: 988
- Joined: Thu Jun 15, 2006 1:02 am
- Location: Somewhere in the vastness of space
- Contact:
Thanks for the extended post.
The scripting of quests is a bit different to scripting fixer missions where you basically define everything through MakeMission statements. The main reason I want to do it in a different way is that I'd like the invitation to participate in a tutorial to start when the player leaves Atlantis for the first time when starting a new game (campaign). The tutorial would, of course, remain revisitable.
I am mostly learning from the different quest_* scripts in modules.
Somehow the ai sends the unit some 100km away and makes it disappear, not sure why. The message (unit destroyed) is being sent by fg_util (don't have it at hand). Changing return to either 1 or 0 does not change the behavior, so I must assume that this is default functionality. In order for the drone to not disappear I need to keep it busy with something, like a target, or a position change. The solution to the drone attacking me is to set the drone the same faction as the starting player = privateer. In this case the ai script doesn't matter.
I'm not sure about the returns. What is the effect of return 0 (end script execution for the frame, no errors???) or return 1 (script will be killed???).
Having to load a savegame each time I change something in the script is a bit annoying. Actually it helps killing time if you have too much of it; for me however it's a very very valuable resource. In programming you need those trial & error loops. This way I am scripting 10% and loading 90% of the time until all the dozens of units are launched in a new campaign savegame. My assumption was that I would be able to include a python statement in a mission xml file and execute it directly to save time, but didn't somehow manage to do it right. Hints on that are appreciated.
So far the script is not much of anything (drone says hello 'before' i launch and makes a strange dance). Now that I have figured out the basic 1+1, the show can commence. First of all, the dancing of the drone needs to be fixed maybe using angular velocity change. Then timing, dialogues, and more... tomorrow is another day.
The scripting of quests is a bit different to scripting fixer missions where you basically define everything through MakeMission statements. The main reason I want to do it in a different way is that I'd like the invitation to participate in a tutorial to start when the player leaves Atlantis for the first time when starting a new game (campaign). The tutorial would, of course, remain revisitable.
I am mostly learning from the different quest_* scripts in modules.
Somehow the ai sends the unit some 100km away and makes it disappear, not sure why. The message (unit destroyed) is being sent by fg_util (don't have it at hand). Changing return to either 1 or 0 does not change the behavior, so I must assume that this is default functionality. In order for the drone to not disappear I need to keep it busy with something, like a target, or a position change. The solution to the drone attacking me is to set the drone the same faction as the starting player = privateer. In this case the ai script doesn't matter.
I'm not sure about the returns. What is the effect of return 0 (end script execution for the frame, no errors???) or return 1 (script will be killed???).
Having to load a savegame each time I change something in the script is a bit annoying. Actually it helps killing time if you have too much of it; for me however it's a very very valuable resource. In programming you need those trial & error loops. This way I am scripting 10% and loading 90% of the time until all the dozens of units are launched in a new campaign savegame. My assumption was that I would be able to include a python statement in a mission xml file and execute it directly to save time, but didn't somehow manage to do it right. Hints on that are appreciated.
So far the script is not much of anything (drone says hello 'before' i launch and makes a strange dance). Now that I have figured out the basic 1+1, the show can commence. First of all, the dancing of the drone needs to be fixed maybe using angular velocity change. Then timing, dialogues, and more... tomorrow is another day.
You do not have the required permissions to view the files attached to this post.
-
- Elite Hunter
- Posts: 1149
- Joined: Mon Aug 14, 2006 3:56 pm
- Location: Black Forest, Germany
That's the main issue - fixer missions are nothing else then calling a module from a python script. You're trying to create a whole new mission type, surely based on an existing one, but still it's a whole lotta toughter then just placing modules.The main reason I want to do it in a different way is that I'd like the invitation to participate in a tutorial to start when the player leaves Atlantis for the first time when starting a new game (campaign). The tutorial would, of course, remain revisitable.
I am mostly learning from the different quest_* scripts in modules.
There currently is no "greyhound bus" script, that means we cannot assign a flight plan for the drone. However, I'm not sure if the your tutorial expects the player to move far out... if not, simply rip out its engines, and let new tutorial drones spawn an the new nav points you're reaching.In order for the drone to not disappear I need to keep it busy with something, like a target, or a position change.
Uh well, I'm not sure as well since I'm not exactly familiar with python, just putting things together. I interpreted the lines posted as a condition checker for your savegame. You're using the drone as tutorial help, but the drone can only exist if you reached Delta and got the green gun. Since you didn't as you're starting a new game, the engine makes efforts to get the drone away. At least if we're talking about the Privateer-drone.I'm not sure about the returns. What is the effect of return 0 (end script execution for the frame, no errors???) or return 1 (script will be killed???).
That's not necessary; missions set up via the launcher don't use a savegame as they should store all relevant info... but that also includes the ship you're flying, the equipment, the universe... so it's probably less scripting stuff to create a fixer-based mission, that doesn't require alternation of savegames.Having to load a savegame each time I change something in the script is a bit annoying.
The assumption is that a XML actually can import a python file; I don't know if that's possible. That'd be worth a contributor help question, or maybe you find a reference for that in the mission folder. But again, you don't have to fiddle in calls to the savegame. Alternations to it are necessary for many cases like universe or faction setups, but not in case of coming up with new python modules - which you want to have eventually.My assumption was that I would be able to include a python statement in a mission xml file and execute it directly to save time, but didn't somehow manage to do it right. Hints on that are appreciated.
Just that I got you correctly - are you launching from a base, or does the game start in open space? If the latter, it's no miracle as the game spawns the drone and probably needs to load other stuff. So the drone is already generated and spitting out its message while it's not yet displaying other things. This effect will either vanish when the tutorial is embedded within a fixer, or you could place the drone to another nav point so that the player needs to approach that one first.drone says hello 'before' i launch
That's undiscovered land to me, but at least I can make an assumption.the dancing of the drone needs to be fixed
Code: Select all
def setDroneNear (self,playa):
vec = playa.Position()
vec = Vector.Add (vec,(vsrandom.uniform(-1000,1000),
vsrandom.uniform(-1000,1000),
vsrandom.uniform(-1000,1000)))
self.drone.SetPosition(vec)
Code: Select all
def orbitMe (self,playa):
vec = (vsrandom.uniform(-10,10),
vsrandom.uniform(-10,10),
vsrandom.uniform(-10,10))
self.drone.SetVelocity(vec)
Now that you've changed the faction to a friendly type, you probably could retry to change the AI as well... it currently is default, you might want to try to change it to sitting_duck as it applies for friendly behaviour.
-
- Lead Network Developer
- Posts: 2560
- Joined: Sun Jan 12, 2003 9:13 am
- Location: Palo Alto CA
- Contact:
Edit: "neutral" might also be a good faction choice, but I suppose in this specific case privateer works too... usually the player should be the only privateer unit.
It supports campaigns, missions, independent fixers, quests, etc.
Quests are probably the best for this, as they are pretty lightweight, and saving your exact state is not a big concern.
You can use "flightgroup directives" to give units specific orders (which is cool if you want to generate two drones and make one blow up another)
The list of is in C++ (undocumented) but I've decided to look through the code. This should probably go to the wiki sometime
H,h (help) -- leader of flightgroup requests help.
B,b (break and attack) -- default, everyone attacks like normal
A,a (attack target) -- attack their current targets
lowercase k -- something undocumented, says something about capships
F,f (flagship?) -- Ship being escorted.
L,l -- undocumented, like F but has complicated formation rules
E,e -- half of this is copy and pasted from L but I have no idea
P,p (protect)-- I want to help out
You can also add a "." to the end to ensure that the unit will not change targets on its own.
Also, a capital letter overrides the AI script, and lower case will allow it to be changed.
Unfortunately I don't see any codes for acting like a sitting duck... You could try something like making it target itself, or making it target NULL (which you get by calling the constructor VS.Unit() ) and then using something like "A."
Or, just try doing a "B." and having it target you, and make sure it is friendly... then it might just fly near you.
I believe you can get it to fly places by having it target them and then force it to do unit.setFgDirective("B.") which I think forces it to act like normal and fly to this target.
I don't know that much about how the AI system works unfortunately.
The "quest_tutorial.py" script seems to set its velocity to A random number between -10 and 10 in all directions after setting its position to the player. That might work as well as the complicated FG directive stuff.
Quests are run inside of "random_encounters.py"
If it returns 1 or True, it will keep going.
If it returns 0, False or None (python returns None if you don't say what to return) then the quest will stop Execute()ing and be deleted until you jump into that system again or reload.
Just go into the missions folder and copy the "explore_universe.mission", and you should be able to delete the "savegame" tag and you will always spawn at the coordinates and system file specified in the .mission file.
To run with that, you have to run the binary with "vegastrike mymission.mission"
Perhaps best would be to add a wait delay of something like 10 seconds before doing anything. I believe Python does not run when a player is docked so that should give it enough time to complete docking procedures.
You can call VS.GetGameTime() to give you a number in seconds, when the quest first starts, then add 10 seconds onto that and keep checking for that to be true.
Pyramid did it properly.
The "Vector.Add (vec,(vsrandom,vsrandom,vsrandom))" thing will give you a random position and add it onto the player's position ( you don't want it inside of the sun)
However, velocities are relative to (0,0,0) which is stopped. So it doesn't make sense to add a velocity to anything.
Why don't you just use self.drone.SetVelocity((0,0,0)) which will set its velocity to 0 instead of a small but random number?
Make sure there is a "sitting_duck.agg.xml" inside of the ai/events folder.
Also check for the sitting_duck.int.xml
Would probably be simpler than the SetVelocity or FG directives... though I suppose it might be harder to make it fly on its own... I guess you might be able to set a constant velocity with SetVelocity.
VS has a lot of different ways of doing one thing. Just pick the most appropriate one for the job.Dilloh wrote:That's the main issue - fixer missions are nothing else then calling a module from a python script. You're trying to create a whole new mission type, surely based on an existing one, but still it's a whole lotta toughter then just placing modules.The main reason I want to do it in a different way is that I'd like the invitation to participate in a tutorial to start when the player leaves Atlantis for the first time when starting a new game (campaign). The tutorial would, of course, remain revisitable.
I am mostly learning from the different quest_* scripts in modules.
It supports campaigns, missions, independent fixers, quests, etc.
Quests are probably the best for this, as they are pretty lightweight, and saving your exact state is not a big concern.
First of all, look in quest_tutorial.py if you haven't already. It has a simple solution for some of this.There currently is no "greyhound bus" script, that means we cannot assign a flight plan for the drone. However, I'm not sure if the your tutorial expects the player to move far out... if not, simply rip out its engines, and let new tutorial drones spawn an the new nav points you're reaching.In order for the drone to not disappear I need to keep it busy with something, like a target, or a position change.
You can use "flightgroup directives" to give units specific orders (which is cool if you want to generate two drones and make one blow up another)
The list of is in C++ (undocumented) but I've decided to look through the code. This should probably go to the wiki sometime
H,h (help) -- leader of flightgroup requests help.
B,b (break and attack) -- default, everyone attacks like normal
A,a (attack target) -- attack their current targets
lowercase k -- something undocumented, says something about capships
F,f (flagship?) -- Ship being escorted.
L,l -- undocumented, like F but has complicated formation rules
E,e -- half of this is copy and pasted from L but I have no idea
P,p (protect)-- I want to help out
You can also add a "." to the end to ensure that the unit will not change targets on its own.
Also, a capital letter overrides the AI script, and lower case will allow it to be changed.
Unfortunately I don't see any codes for acting like a sitting duck... You could try something like making it target itself, or making it target NULL (which you get by calling the constructor VS.Unit() ) and then using something like "A."
Or, just try doing a "B." and having it target you, and make sure it is friendly... then it might just fly near you.
I believe you can get it to fly places by having it target them and then force it to do unit.setFgDirective("B.") which I think forces it to act like normal and fly to this target.
I don't know that much about how the AI system works unfortunately.
The "quest_tutorial.py" script seems to set its velocity to A random number between -10 and 10 in all directions after setting its position to the player. That might work as well as the complicated FG directive stuff.
I'm assuming by drone he means just an instance of a dummy ship like a Talon.Uh well, I'm not sure as well since I'm not exactly familiar with python, just putting things together. I interpreted the lines posted as a condition checker for your savegame. You're using the drone as tutorial help, but the drone can only exist if you reached Delta and got the green gun. Since you didn't as you're starting a new game, the engine makes efforts to get the drone away. At least if we're talking about the Privateer-drone.I'm not sure about the returns. What is the effect of return 0 (end script execution for the frame, no errors???) or return 1 (script will be killed???).
Quests are run inside of "random_encounters.py"
If it returns 1 or True, it will keep going.
If it returns 0, False or None (python returns None if you don't say what to return) then the quest will stop Execute()ing and be deleted until you jump into that system again or reload.
That's not necessary; missions set up via the launcher don't use a savegame as they should store all relevant info... but that also includes the ship you're flying, the equipment, the universe... so it's probably less scripting stuff to create a fixer-based mission, that doesn't require alternation of savegames.Having to load a savegame each time I change something in the script is a bit annoying.
Would be really simple to define a mission file that calls the privateer scripts.The assumption is that a XML actually can import a python file; I don't know if that's possible. That'd be worth a contributor help question, or maybe you find a reference for that in the mission folder. But again, you don't have to fiddle in calls to the savegame. Alternations to it are necessary for many cases like universe or faction setups, but not in case of coming up with new python modules - which you want to have eventually.My assumption was that I would be able to include a python statement in a mission xml file and execute it directly to save time, but didn't somehow manage to do it right. Hints on that are appreciated.
Just go into the missions folder and copy the "explore_universe.mission", and you should be able to delete the "savegame" tag and you will always spawn at the coordinates and system file specified in the .mission file.
To run with that, you have to run the binary with "vegastrike mymission.mission"
Unfortunately it is not easy to tell if a player is docked to any unit.Just that I got you correctly - are you launching from a base, or does the game start in open space? If the latter, it's no miracle as the game spawns the drone and probably needs to load other stuff. So the drone is already generated and spitting out its message while it's not yet displaying other things. This effect will either vanish when the tutorial is embedded within a fixer, or you could place the drone to another nav point so that the player needs to approach that one first.drone says hello 'before' i launch
Perhaps best would be to add a wait delay of something like 10 seconds before doing anything. I believe Python does not run when a player is docked so that should give it enough time to complete docking procedures.
You can call VS.GetGameTime() to give you a number in seconds, when the quest first starts, then add 10 seconds onto that and keep checking for that to be true.
I guess you already copied it from the quest_tutorial since that looks like the same code.That's undiscovered land to me, but at least I can make an assumption.the dancing of the drone needs to be fixedYou seem to define the vector two times... #1 obviously tries to adapt the player's vector, while #2 gives new numbers. That probably is a paradoxon which makes the whole dancing. I'd try to delete the second vector block and see if it's still dancing. WhereasCode: Select all
def setDroneNear (self,playa): vec = playa.Position() vec = Vector.Add (vec,(vsrandom.uniform(-1000,1000), vsrandom.uniform(-1000,1000), vsrandom.uniform(-1000,1000))) self.drone.SetPosition(vec)
is missing the "(vec," tag in front of "(vsrandom.uniform".Code: Select all
def orbitMe (self,playa): vec = (vsrandom.uniform(-10,10), vsrandom.uniform(-10,10), vsrandom.uniform(-10,10)) self.drone.SetVelocity(vec)
Pyramid did it properly.
The "Vector.Add (vec,(vsrandom,vsrandom,vsrandom))" thing will give you a random position and add it onto the player's position ( you don't want it inside of the sun)
However, velocities are relative to (0,0,0) which is stopped. So it doesn't make sense to add a velocity to anything.
Why don't you just use self.drone.SetVelocity((0,0,0)) which will set its velocity to 0 instead of a small but random number?
Good idea:Now that you've changed the faction to a friendly type, you probably could retry to change the AI as well... it currently is default, you might want to try to change it to sitting_duck as it applies for friendly behaviour.
Make sure there is a "sitting_duck.agg.xml" inside of the ai/events folder.
Also check for the sitting_duck.int.xml
Would probably be simpler than the SetVelocity or FG directives... though I suppose it might be harder to make it fly on its own... I guess you might be able to set a constant velocity with SetVelocity.
-
- Elite Hunter
- Posts: 1149
- Joined: Mon Aug 14, 2006 3:56 pm
- Location: Black Forest, Germany
Aah, many thanks for the information. I didn't know that you could give such clear AI orders within a quest already. That might probably help with fixing the wingman AI which behaves like a amok gunner atm.ace123 wrote:You can use "flightgroup directives" to give units specific orders (which is cool if you want to generate two drones and make one blow up another). The list of is in C++ (undocumented) but I've decided to look through the code.
Maybe I'll try to mess around with it a bit, I always wanted to start writing a "HowTo create campaigns".This should probably go to the wiki sometime
Probably it's an order to take out capship turrets with priority, or it's a pure bomber order to attack capships and ignore fighters.lowercase k -- something undocumented, says something about capships
I would imagine that it's an order to attack a ship being escorted by the hostile faction. Alternatively, it could be an order to fly in formation.F,f (flagship?) -- Ship being escorted.
Could be a shortcut for "Leave" - ships heading out.L,l -- undocumented, like F but has complicated formation rules
I'd say it is "escort", escort a designated ship.E,e -- half of this is copy and pasted from L but I have no idea
That's really useful stuff, thanks alot. I initially thought that the standard xml AI was the only way to influence ship behaviour, but that opens the doors for some more sophisticated missions.You can also add a "." to the end to ensure that the unit will not change targets on its own. Also, a capital letter overrides the AI script, and lower case will allow it to be changed.
Couldn't this be the problem with the drone spinning around? Trying to target itself?You could try something like making it target itself
Ok, my fault As I said, just stumblin' aroundPyramid did it properly.
I'm more concerned about the drone keeping up its behaviour. In PU we have multiple missions featuring wingmen, and alas, we have confeds, militia, and stuff, attacking their own bases, their own escorts, their own buddies. Somebody recently figured out that this behaviour probably applies at the time you target the item. Might be coincidence though. But as I said, the override stuff is probably the solution for all those things.I suppose it might be harder to make it fly on its own... I guess you might be able to set a constant velocity with SetVelocity.
-
- Expert Mercenary
- Posts: 988
- Joined: Thu Jun 15, 2006 1:02 am
- Location: Somewhere in the vastness of space
- Contact:
That's definitely where we should be heading. I've taken the liberty to copy parts of this discussion to http://vegastrike.sourceforge.net/wiki/ ... _Campaigns where I'm intending to document mission related python stuff. Please add to it as desired.This should probably go to the wiki sometime
Actually scripts continue to be run when you are docked. Just let Execute() print something and you'll get the stdout when in base. As I am getting some experience with the scripting, I'm finding more fun in doing it. For this particular problem I came up with this solution so far, which is actually quite nice. It checks after undocking if the player ship is a specified distance of meters away from the station, and only then sets the stage advancement:
Code: Select all
def hasUndockedFromAtlantis (self):
self.startplanet = unit.getUnitByName('Atlantis')
#print "planet.isDocked: " + str(self.startplanet.isDocked(self.playa))
if (self.startplanet.isDocked(self.playa)):
#print "--- tutorial: player is docked ---"
self.dockeddistance = self.startplanet.getDistance(self.playa)
if (not self.startplanet.isDocked(self.playa) and self.startplanet.getDistance(self.playa)>(self.dockeddistance+5000)):
#print "--- tutorial: player is away from station ---"
#print "distance: " + str(self.startplanet.getDistance(self.playa))
self.stage=STAGE_AWAY
I'm even thinking of doing much later a small collection of functions useful to quest scripts.
Please forget about the dancing. This was just a placeholder to see if the ship stays with me. It's not a particularly elegant solution and meanwhile I have another one. Maybe I'll just commit the quest_tutorial to SVN without actually binding it to the game so that we can stay on the same page. Just for the curious, it's something in the lines of (which is still stupid and a placeholder, but stops with the jerky dance):
Code: Select all
vec = Vector.Sub(self.playa.Position(), self.drone.Position())
vec = Vector.SafeNorm(vec)
self.drone.SetVelocity(vec)
I tried to create a mission xml. I do start in the right system, but get an awfully bouncing sound like a hammer hitting my hull, the hull keeps vanishing and i can't even spec to atlantis. (Again, lack of experience). Anyway, here's the file:
Code: Select all
<mission>
<settings>
<origin planet="earth" x="0000" y="100" z="000.0"/>
</settings>
<variables>
<var name="defaultplayer" value="blue"/>
<var name="system" value="Crucible/Cephid_17" />
</variables>
<flightgroups>
<flightgroup name="blue" faction="confed" type="Llama.begin" ainame="default" waves="1" nr_ships="2">
<pos x="0400" y="-35400" z="47200000"/>
</flightgroup>
</flightgroups>
<python>
from quest_tutorial import quest_tutorial
my_obj=quest_tutorial_factory()
</python>
</mission>
-
- Expert Mercenary
- Posts: 988
- Joined: Thu Jun 15, 2006 1:02 am
- Location: Somewhere in the vastness of space
- Contact:
I've put the basic script into svn
http://vegastrike.svn.sourceforge.net/v ... utorial.py. It's not bound to the game, since it's a draft only and a field for experimenting.
In order to experiment it you'll need to add the following lines:
* to mission_lib.py:
* to adventure:
Currently, it only works with a new campaign when launching from Atlantis. The only implemented features is launching a drone, making it say a few words, and following the player ship all around.
Now, I'd like to enable the player to communicate with the drone (drone communicates with the player already). Is there a way of adding possible communication lines to the comm via python?
What I'm intending is, instead of communicating via pantomime (if you agree, please stop your ship), I'd rather add a key binding (e.g. F5 to reply something like "Okey dokey. Show me how to fly") for a possible reply.
http://vegastrike.svn.sourceforge.net/v ... utorial.py. It's not bound to the game, since it's a draft only and a field for experimenting.
In order to experiment it you'll need to add the following lines:
* to mission_lib.py:
Code: Select all
import adventure
Code: Select all
import quest_tutorial
Code: Select all
adventures = {
"Crucible/Cephid_17":quest_tutorial.quest_tutorial_factory(),
Now, I'd like to enable the player to communicate with the drone (drone communicates with the player already). Is there a way of adding possible communication lines to the comm via python?
What I'm intending is, instead of communicating via pantomime (if you agree, please stop your ship), I'd rather add a key binding (e.g. F5 to reply something like "Okey dokey. Show me how to fly") for a possible reply.
-
- Lead Network Developer
- Posts: 2560
- Joined: Sun Jan 12, 2003 9:13 am
- Location: Palo Alto CA
- Contact:
I see
<pos x="0400" y="-35400" z="47200000"/>
make sure that isn't inside of the sun.
What I usually do is add a few more 0's to the biggest coordinate to put you in the middle of space.
A better way would be to open up "New_Game" and copy those three coordinates into your file since that gives you a nice position next to Atlantis.
<pos x="0400" y="-35400" z="47200000"/>
make sure that isn't inside of the sun.
What I usually do is add a few more 0's to the biggest coordinate to put you in the middle of space.
A better way would be to open up "New_Game" and copy those three coordinates into your file since that gives you a nice position next to Atlantis.
-
- Elite Hunter
- Posts: 1149
- Joined: Mon Aug 14, 2006 3:56 pm
- Location: Black Forest, Germany
-
- Expert Mercenary
- Posts: 988
- Joined: Thu Jun 15, 2006 1:02 am
- Location: Somewhere in the vastness of space
- Contact:
Indeed. Nothing more obvious than that (and still overlooked).ace123 wrote:<pos x="0400" y="-35400" z="47200000"/>
make sure that isn't inside of the sun.
I've got the mission loaded from the xml mission script by including:
Code: Select all
<python>
from quest_tutorial import quest_tutorial
my_obj=quest_tutorial()
</python>
-
- Lead Network Developer
- Posts: 2560
- Joined: Sun Jan 12, 2003 9:13 am
- Location: Palo Alto CA
- Contact:
In order for it to work properly, it must inherit the Director.Mission class *and* call its constructor.
Unfortunately quests must inherit from the quest class, so you need to use a wrapper class.
I'm thinking a class that takes an instance of a class as an argument:
This is a very simple class, and it's similar to what privateer.py does.
I'm just making it general by passing the list of classes as an argument...
Then, to use it, go to your mission file and do:
Vega Strike needs the Director.Mission constructor to be called in order to create the mission in C++... otherwise it will never know to call the Execute function.
As far as the communications go, I found a variable in cockpit that holds what the VDU screen shows as possible options...
Unfortunately the Communications system is not scriptable at the moment... I have a feeling that fixing that might require changing a bit of code, but I am not sure.
Unfortunately quests must inherit from the quest class, so you need to use a wrapper class.
I'm thinking a class that takes an instance of a class as an argument:
Code: Select all
import Director
class Executor(Director.Mission):
def __init__(self, classesToExecute):
Director.Mission.__init__(self)
self.classes = classesToExecute
def Execute(self):
for c in self.classes:
c.Execute()
I'm just making it general by passing the list of classes as an argument...
Then, to use it, go to your mission file and do:
Code: Select all
<python>
from quest_tutorial import Executor, quest_tutorial
tmpvar=Executor([quest_tutorial()])
</python>
As far as the communications go, I found a variable in cockpit that holds what the VDU screen shows as possible options...
Unfortunately the Communications system is not scriptable at the moment... I have a feeling that fixing that might require changing a bit of code, but I am not sure.
-
- Expert Mercenary
- Posts: 988
- Joined: Thu Jun 15, 2006 1:02 am
- Location: Somewhere in the vastness of space
- Contact:
-
- Expert Mercenary
- Posts: 988
- Joined: Thu Jun 15, 2006 1:02 am
- Location: Somewhere in the vastness of space
- Contact:
Wiki documentation has started and is progressing slowly: http://vegastrike.sourceforge.net/wiki/ ... _Campaigns.
There are still many things I must find out by trial and error. Mostly is how to call existing functions, but also other things like timing, objectives, saving of the status, verification of actions.
Right now I have started integrating comm images. Two questions related to that.
1) My comm images in data have alpha channel with partial transparency, however the transparency is not shown (the background of Oswald, the tutor). Is there any way to make it happen?
2) Currently comm vdu is overlayed with the target vdu (lower right corner). I can separate the comm vdu but then the communication key bindings (potential replies) always show. This might not look so good in the game. Is there any option to change the behavior and toggle the answers with a key?
There are still many things I must find out by trial and error. Mostly is how to call existing functions, but also other things like timing, objectives, saving of the status, verification of actions.
Right now I have started integrating comm images. Two questions related to that.
1) My comm images in data have alpha channel with partial transparency, however the transparency is not shown (the background of Oswald, the tutor). Is there any way to make it happen?
2) Currently comm vdu is overlayed with the target vdu (lower right corner). I can separate the comm vdu but then the communication key bindings (potential replies) always show. This might not look so good in the game. Is there any option to change the behavior and toggle the answers with a key?
-
- Lead Network Developer
- Posts: 2560
- Joined: Sun Jan 12, 2003 9:13 am
- Location: Palo Alto CA
- Contact:
I think for performance reasons the comms might only have 1-bit alpha (completely on or off).
Not sure about the comms... this is one of those cases where it would be nice to allow python to handle this.
Not sure what to say--it would probably require source modification.
One thing you can try is putting the comm screen off the edge (at like 10.0).
Not sure about the comms... this is one of those cases where it would be nice to allow python to handle this.
Not sure what to say--it would probably require source modification.
One thing you can try is putting the comm screen off the edge (at like 10.0).
-
- Expert Mercenary
- Posts: 988
- Joined: Thu Jun 15, 2006 1:02 am
- Location: Somewhere in the vastness of space
- Contact:
Actually having the answer proposals available might be helpful in some cases, so i wouldn't like to put them off screen. will have a look into the code when i come around to it. right now building the tutorial is my first prio.
i have noticed that the function does not return the correct vector when the ship is in spec. E.g for the Llama if my set speed is at 300 and i enter manual spec or spec autopilot, the vector magnitude will be still 300. Don't think this is intended, or am i mistaken?
EDIT: The correct velocity is given when engaging overdrive (and even overdrive while specing ).
i have noticed that the function
Code: Select all
VS.Unit.GetVelocity()
EDIT: The correct velocity is given when engaging overdrive (and even overdrive while specing ).
Last edited by pyramid on Sat Apr 12, 2008 12:16 am, edited 1 time in total.
-
- Elite Hunter
- Posts: 1149
- Joined: Mon Aug 14, 2006 3:56 pm
- Location: Black Forest, Germany
Not quite elegant, but assuming you've disabled your cockpit you could alter the cockpit files for disabled-cockpit and change the placement of the nav/comm/anything screen to put it a bit more into the middle.pyramid wrote:Currently comm vdu is overlayed with the target vdu (lower right corner). I can separate the comm vdu but then the communication key bindings (potential replies) always show. This might not look so good in the game. Is there any option to change the behavior and toggle the answers with a key?
-
- Expert Mercenary
- Posts: 988
- Joined: Thu Jun 15, 2006 1:02 am
- Location: Somewhere in the vastness of space
- Contact:
Placement is no issue. For testing I have placed the comm vdu in the top right corner. The thing is that comm vdu plays 2 roles in the engine: 1) display the comm animations, 2) display the possible conversations/answers and their comm key bindings. Both images from previous post are in the same corner. When i don't want the comm animation to display permanently and limit the comm animation time, the answers will be blended in. A better approach would be to assign a key to toggling the answers part so that the user can decide if he wants the conversation proposals displayed or not. This would require some rewriting of code.
-
- Elite Hunter
- Posts: 1149
- Joined: Mon Aug 14, 2006 3:56 pm
- Location: Black Forest, Germany
Don't know if it's of any help, but you can determine the type of displays a VDU can bring to screen.
This way you could force the answers to be on the side of your choice. Or try to take COMM out of the types, maybe it won't display anymore, but if you're lucky it will disappear the time you put in your answer and only reappear if you hit c again.whatever-cockpit.cpt wrote:<VDU TextRows="15" TextCols="25" type="Objectives Weapon View Damage Manifest COMM TargetManifest" file ="rvdu.spr" xcent="-.3809" ycent="-.2318"/>
<VDU TextRows="15" TextCols="25" type=" Nav Target " file="lvdu.spr" xcent=".2227" ycent="-.2318"/>
-
- Expert Mercenary
- Posts: 988
- Joined: Thu Jun 15, 2006 1:02 am
- Location: Somewhere in the vastness of space
- Contact:
-
- Lead Network Developer
- Posts: 2560
- Joined: Sun Jan 12, 2003 9:13 am
- Location: Palo Alto CA
- Contact:
-
- Expert Mercenary
- Posts: 988
- Joined: Thu Jun 15, 2006 1:02 am
- Location: Somewhere in the vastness of space
- Contact: