Page 1 of 1

Project Needs Python Help!

Posted: Mon Nov 05, 2007 10:37 am
by tillias
Hi!

After more then 1,5 years of collecting Trek-3dModels, fixing, arming and other stuffage we started working over dynamical missions for VegaTrek.

I've no knowledge of Python at all so I ask some help in creating our first mission.

To our convinience I've painted mission plan:

1. When mission starts, player's ship is placed into point (X0, Y0, Z0) in terms of 3d-space.

2. Somewhere in space there is located some planet ( coordinates X1, Y1, Z1 ).

3. Planet has radius Rs ( abbr. Radius small )

4. The goal of mission is to put player's ship very close to planet ( under radius Rb )

--
The best analogy is scanning mssion. E.g. in order to scan some object, you need to get to some critical distance to object. Then mission is accomplished

Posted: Mon Nov 05, 2007 10:39 am
by tillias
So is it possible to make such a python-mission, which scans how close to target object ( let it be some planet ) player's ship is and if it is close enough there appear some poup-up mesage, like "Mission is accomplished"?

Posted: Mon Nov 05, 2007 12:06 pm
by Dilloh
From my limited knowledge I assume such a kind of mission already exists - like you mentioned the scan mission (which itself is a cleansweep without enemies).

Cargo missions within campaigns work the same way, I guess having no cargo would result in a mission success while "just" in orbit.

Posted: Mon Nov 05, 2007 12:59 pm
by tillias
Dilloh wrote:From my limited knowledge I assume such a kind of mission already exists - like you mentioned the scan mission (which itself is a cleansweep without enemies).

Cargo missions within campaigns work the same way, I guess having no cargo would result in a mission success while "just" in orbit.
Can you point me to module's sources please?

Posted: Tue Nov 06, 2007 12:23 pm
by Dilloh
Note that I'm always refering to PR1.2 modules, but there should be a lot of similarities.

/modules/cargo_mission.py

Code: Select all

def __init__ (self,factionname, numsystemsaway, cargoquantity, missiondifficulty, creds, launchoncapship, time_to_complete, category,jumps=(),var_to_set=''):
cargo_mission doesn't seem to have a distance var, so it either needs to be added or we'll try another kind of mission which is already there.

/modules/cleansweep.py

Code: Select all

def __init__(self,numsystemsaway, num_points,distance,creds,jumps,donevar,minships,maxships,encounterprob,capshipprob,faction, forceattack,canrunaway):
An example on how to use this in a static campaign:

Code: Select all

'cleansweep',(0,8,50,0,('Gemini/Newcastle','Gemini/Metsor',),rf.name+"_mission",1,2,.9,0,['unknown','retro','pirates'],1,1),
Note I might be totally wrong with "distance" being the scanning distance. You should try to create a cleansweep mission which has no foes in first case, and modify it long enough until you have a suitable state.

Re: Project Needs Python Help!

Posted: Sat Mar 09, 2019 6:13 am
by lacy1809
Hello All,

I am newbie to python. And i'm practicing at home to see the youtube videos.
I was trying to use a=zeros(5) in python, but getting the error. Please check it and help me to solve

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'zeros' is not defined

Please help me with this or suggest me any of the python tutorial where i can learn the deep concept of python.

Thanks in advance!

Re: Project Needs Python Help!

Posted: Sat Mar 09, 2019 7:31 pm
by shadowmane20
You could just dig in to the documents for this game. Specifically working with scrypting missions, campaigns and quests. There's tons of python used here, and most of the python scripts in this game have helpful comments to tell you what stuff does.