Page 1 of 1

where to add a fixer

Posted: Thu Nov 06, 2008 1:41 pm
by philhelm
Ok, so I have read some information about adding fixers, namely

C:/VegaStrike/win32/data/documentation/fixers_howto.html

however, it is not clear to me after reading this where I would put my code. I get that I need to use the node/conversation classes and that i need to write python code to do it.. and that queueFixer() adds the fixer to the game.. but:

do i create a new python script and if so where do i put it? do i add to an existing one? which one? where do i put the changes?

what i really want to do is, when the user goes into the bar in the intro quest, for my new fixer to be sitting there. which leads to another question: where would i put the fixer image, and how/where does it get loaded?

Thanks
Phil

(i posted this last night on the modder forum but this seemed like a more appropriate place)

Re: where to add a fixer

Posted: Fri Nov 07, 2008 6:00 am
by ace123
Check out modules/quests/quest_intro.py, quest_intro2.py (not sure about the difference) and quest_tutorial.py for an example of the fixers system.
The html page you linked to describes how to use this quest system.

For extended missions, there is a campaign system that is good for longer campaigns. The campaign here is in "modules/campaigns.py" (and campaign_lib.py is the associated campaign library). Unfortunately the documentation for this is sparse but there are also examples if you look at Privateer of a few really long campaigns written using this system.

There is also a way to make simple fixers that just appear in the bar and give out individual missions but have no plot.

All three of these systems are mostly independent. The main distinction is that every campaign is always active... and its state is stored in a save variable that is a list of which path was chosen on each branch. Quests have the state stored in individual variables that you set.

I would just go through all of these examples and see which you find easiest to customize.

Re: where to add a fixer

Posted: Fri Nov 07, 2008 2:00 pm
by philhelm
thanks for the reply ace. i did read through those scripts.. i see the jenek fixer code is in the quest_intro.py. i am trying to add a fixer in the same way, but it's just not clear to me how it works. i see that there are methods like

getJenekConversation()
interactWithJenek()
okayDrawJenek()

and these appear to define the fixer and what he does; however i cant figure out how these get called and from where. the FIXER_TEXT variable at the top seemed to be the key, but i cant figure out where that variable is used. i think i am trying to do the last of your options, add a fixer to just do simple campaigns not connected with anything. really what i want to do is add some algorithms to control the behavior of the fixer in this world. its good to know that the quests stay "in memory", that will probably make it feasible to do what i want. i think if i can just get my fixer in things might get easier - i am not a python expert so this is becoming struggle to get going.

just to try to get something (anything) working, i turned on the debug and read through which python scripts were compiled - and i ran into bartender_default.py that gets compiled every time you click on the bartender. so, i figured i might be able to trigger off of this (for lack of anything else that was working). i added these two lines to the bartender_default.py:

import fixers
fixers.queueFixer(1, "Scorpius", "C:\VegaStrike\win32\data\bases\scorpius.py", overwrite=0)

but i keep getting

Traceback (most recent call last):
File "C:\VegaStrike\win32\data/.vegastrike/bases/bartender_default.py", line 4, in ?
NameError: name 'queueFixer' is not defined

i tried 'from fixers import *' and just calling queueFixer (without the 'fixers' prefix) but no luck. unless you have any ideas i guess ill just keep playing around to see what i can get working.

phil

Re: where to add a fixer

Posted: Sat Nov 08, 2008 7:04 pm
by philhelm
Ok, so I figured out how to get the queueFixer() method called - bartender_default.py calls bartenter.Speak(), so in Speak() there were already working references to the fixers object, so i just added a call to queue fixer from speak .. so when the bartender is clicked, my fixer gets queued.

now, i do see the queueFixer() method called, because I put in some print lines - but I am not sure what it is actually doing. my queueFixer call looks like this

fixers.queueFixer(1, "Scorpius", "/bases/scorpius.py", overwrite=0)

now, keep in mind I have NO IDEA what these values should be, I am just guessing... the scorpius.py file just looks like this:

def getScorpius2Conversation ():
print 'PHIL got in scorpius'
sn = SubNode()
sn.text = "Howdy folks!"
sn.conditions = [str(TRIGGER_SAVE) + '#' + str(TRIGGER_VALUE)]
sn.choices = ["bases/fixers/no.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"nojump\")|Sorry, what else do you have?", "bases/fixers/yes.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"yesjump\")|Yeah, I'm interested."]
sn.sprite = "bases/fixers/merchant5.spr"
sn.motext = "Talk to Jenek about the jump drive."


con = Conversation("Scorpius", ['#\nimport quest_intro\nresult = quest_intro.okayDrawScorpius()'])
roo = RootNode()
roo.addSubNode(sn)
con.addNode(roo)
return con

I just tried to copy the Jenek stuff - but I don't see anything happening, nor do I know if I should. I kind of thought queueFixer meant my fixer would show up and/or i would see my scorpius.py script get compiled/executed.

I'll just keep tinkering unless someone has any thoughts.

Re: where to add a fixer

Posted: Sat Nov 08, 2008 10:26 pm
by philhelm
just for clarfication, this is all i am trying to do at this moment:

"There is also a way to make simple fixers that just appear in the bar and give out individual missions but have no plot."

is what i am doing in the above posts on the right track?

Re: where to add a fixer

Posted: Mon Nov 10, 2008 2:48 am
by philhelm
ok, clearly we are in a murky area here, since there have been no replies (or - gasp - everyone is busy!)

i think i found the place where i need to plug in my fixer... its in fixers.CreateMissionFixers_real. What i cant figure out is what exactly this method is doing:

def CreateMissionFixers_real(room,locations,j,fixerinfo):
for miss in fixerinfo:
if j==len(locations):
return j
f=MakeFixer(miss,room)
append=''
if len(locations[j])>4:
append=locations[j][4]
f.drawobjs (room,locations[j][0],locations[j][1],locations[j][2],locations[j][3],append)
j+=1
return j

adding print statements to this cause an error when starting the game (cannot create room - guessing its a python quirk, but im not an expert) so i cant seem to follow the flow or see what "fixerinfo" or room or miss or whatever else's value... anyone know either what these values mean or why i cant get my print lines in?

Re: where to add a fixer

Posted: Mon Nov 10, 2008 9:34 am
by pyramid
Usually the "cannot create room" error appears when a python script is wrong. Do you get any errors on the console, like indentation or syntax, when putting in your print statements?

Re: where to add a fixer

Posted: Mon Nov 10, 2008 1:05 pm
by philhelm
no, there are no console errors. there is also nothing in the stdout or stderr that indicates a problem... ive triple tested it - as soon as i add the print lines, it gives me that error.

Re: where to add a fixer

Posted: Mon Nov 10, 2008 1:55 pm
by pyramid
Could you post the code around and including the print lines. It would be easier to remote-debug.

Re: where to add a fixer

Posted: Mon Nov 10, 2008 2:34 pm
by philhelm
sure.... here it is:

def CreateMissionFixers_real(room,locations,j,fixerinfo):
------ for miss in fixerinfo:
------------print 'got in missionfixers'
------------print miss
------------if j==len(locations):
--------------------return j
------------f=MakeFixer(miss,room)
------------print 'made fixer'
------------print f
------------append=''
------------if len(locations[j])>4:
-------------------append=locations[j][4]
------------f.drawobjs (room,locations[j][0],locations[j][1],locations[j][2],locations[j][3],append)
------------j+=1
------ return j

(obviously the dashes are not actually in the code - this forum editor doesnt format out the indentation with whitespace)

i cant paste the entire stderr log, but here are the last few entries:

Loading a VSFileSystem::VSSpriteFile : mouse.spr
TRY LOADING : VSFileSystem::VSSpriteFile C:\VegaStrike\win32\data/sprites/mouse.spr... SUCCESS

BEGINNING OF VSFileSystem::VSSpriteFile
END OF VSFileSystem::VSSpriteFile

Loading a VSFileSystem::TextureFile : basecomputer_loadsave.png
TRY LOADING : VSFileSystem::TextureFile C:\VegaStrike\win32\data/.vegastrike/textures/basecomputer_loadsave.png... NOT FOUND
TRY LOADING : VSFileSystem::TextureFile C:\VegaStrike\win32\data/.vegastrike/textures/mounts/basecomputer_loadsave.png... NOT FOUND
TRY LOADING : VSFileSystem::TextureFile C:\VegaStrike\win32\data/.vegastrike/textures/nav/default/basecomputer_loadsave.png... NOT FOUND
TRY LOADING : VSFileSystem::TextureFile C:\VegaStrike\win32\data/textures/basecomputer_loadsave.png... NOT FOUND
TRY LOADING : VSFileSystem::TextureFile C:\VegaStrike\win32\data/textures/mounts/basecomputer_loadsave.png... NOT FOUND
TRY LOADING : VSFileSystem::TextureFile C:\VegaStrike\win32\data/textures/nav/default/basecomputer_loadsave.png... NOT FOUND

and here is the trail end of the stdout log:

refusing to bind command to joystick (joy-nr too high)
CREATING A LOCAL SHIP : dumbfire
Hi helper play 0
HereInitializing optimizer
pox 119990000000.000000 -9000000.000000 -109990000000.000000
Force feedback support disabled when compiled
Loading completed, now network init
Loading active missions True

Re: where to add a fixer

Posted: Tue Nov 11, 2008 12:30 pm
by pyramid
Initially I've got the error, too, which was fixed by doing 2 adjustments:
* the other lines have tabbed indents, it's best to copy them to your print lines to make sure the error doesn't come from indentation (usual with no room found errors).
* i had to start a new campaign. this is probably not directly related, but just to be on the safe side.
If it still doesn't work, just try it with the first print line only.
And you can insert formatted code by using the code tags:

Code: Select all

def CreateMissionFixers_real(room,locations,j,fixerinfo):
	for miss in fixerinfo:
		print "----got in missionfixers----"
		print miss
		if j==len(locations):
			return j
		f=MakeFixer(miss,room)
		print "made fixer"
		print f
		append=''
		if len(locations[j])>4:
			append=locations[j][4]
		f.drawobjs (room,locations[j][0],locations[j][1],locations[j][2],locations[j][3],append)
		j+=1
	return j

Re: where to add a fixer

Posted: Sat Jun 19, 2010 11:01 am
by esgaroth
"There is also a way to make simple fixers that just appear in the bar and give out individual missions but have no plot."
I have been asking this quite some time ago, but got no answers, so i´ll retry it again- how can i add more and different kinds of these simple fixers that appear randomly in the bars ? The mission system with its fixers i do understand more or less - but i havent found the script or whatever that places these fixers and chooses the mission they offer - nor have i found the place where they are defined. I would need them for the vega trek project, but obviously noone seems to know anything about this....
Any help would be appreciated....

Re: where to add a fixer

Posted: Sat Jun 19, 2010 6:32 pm
by klauss
It is all automatically generated, you should browse the python code starting from random_mission.py I think.

I don't remember the details, but I do remember the system was a bit hard to follow.

Re: where to add a fixer

Posted: Mon Jun 21, 2010 1:48 pm
by esgaroth
The problem is, there is no such random_mission.py in the modules folder. There is a mission_lib.py, but there only is one part related to a fixer, and that one only places a pirate fixer - neither a confed officer, nor a merchant or hunter....
And yes, the system is quite hard to follow....
For any other info i´d be very grateful....

Re: where to add a fixer

Posted: Tue Jun 22, 2010 3:44 pm
by klauss
There

That feeds off the missions created by computer_lib.py I think.

Re: where to add a fixer

Posted: Wed Jun 23, 2010 4:09 pm
by esgaroth
Thanx - but i fear this is way beyond my python capabilities to understand.
AFAIK, this script is called from bar_lib.py, there i found the following:
import fixers
#was:
# -0.53, -0.673333, 0.205, 0.61
#better:
# -0.61, -0.86, 0.4105, 1
func=fixers.CreateFixers
if not createCampaignFixers:
func=fixers.CreateMissionFixers
func(room0,[(-0.80025, -1.0088, 0.776, 1.2416, "_1"),(-0.0725, -0.4058125, 0.1758125, 0.5385, "_2")])#add more locations?
return room0;
AFAIK, this defines the positions of the fixers and their sizes (_1 being the large fixer in the foreground, _2 the small one in the background of the bar).
The big question is: where the heck is it defined (or randomly generated) what kind of fixer is placed ? In vegatrek (based on pu) we have hunter, militia, merchant and confed officer. To print the confed_1.spr, i would expect somewhere some strings defined like "confed", "militia" etc.
However, i havent found this place.
The final goal of all this is to be able to make different bars-so that in a klingon bar i will have klingon officers, in a romulan bar i will have romulan officers etc. However, for that i need to know where the part/script/module/whatever is that defines which fixer is placed....
Sorry for my lack of python, but i have noone elso to do this...

Re: where to add a fixer

Posted: Thu Jun 24, 2010 2:19 am
by klauss
It's probable that the kind of fixer is configured globally, and not per-base, depending on the faction the mission is for.

And the base's allegiance to various factions defines which missions are possible there, so it would be all pretty automatic. Perhaps too automatic?

Re: where to add a fixer

Posted: Thu Jun 24, 2010 8:17 am
by esgaroth
Possible. However, globally or not, faction-specific or not, it must be configured somewhere.....

Re: where to add a fixer

Posted: Sat Jul 03, 2010 1:39 pm
by esgaroth
OK, i think i found it. They are defined in the dynamic_mission.py . This module is called from the planet script. So it should be possible, by having faction-specific scripts (e.g.dynamic_mission_klingon.py) to have different kinds of fixers in different bars. Hope that works....