Important Message

You are browsing the archived Lancers Reactor forums. You cannot register or login.
The content may be outdated and links may not be functional.


To get the latest in Freelancer news, mods, modding and downloads, go to
The-Starport

market_ships Question

The general place to discuss MOD''ing Freelancer!

Post Tue Apr 20, 2004 6:45 pm

Okay. Here it is, but it's pretty ugly. Also, I wrote it in QBasic so you'll have to dl a compiler/interpreter from somewhere.

<pre><font size=1 face=Courier>
'(C) Trucidation, Wednesday 21/4/2004
' Contact: [email protected]
' A Freelancer "market_ships.ini" modifier: Zero'ing level requirements.

'Note: This zeroes the requirement for ALL ships. If you only want
' to free up a specific ship of your choice (i.e. you don't want
' to totally screw up the file) then do it by hand, don't run this.


' - - - WARNING - - -
'This was purposely written in QBasic and uncompiled to exe because
'(1) I'm no coder and this ugly thing hasn't been optimized, and
'(2) there is NO ERROR CHECKING because it'd bloat up the code by
' a whole lot more... and besides I don't KNOW how to anyway :p
' I don't want n00bs to screw up their installs then blame me.
' Please read the Instructions and the notes below!
'P.S. It's not using any advanced features of BASIC, you can download
' any BASIC compiler/interpreter and run this.


'- - - INSTRUCTIONS - - -
'1. Go to Freelancer\Data\Equipment\ and make a backup copy of
' the original "market_ships.ini"
'2. Copy "market_ships.ini" from Freelancer\Data\Equipment\ to C:'3. Run this program
'4. Output will be written to "mark_mod.ini" in C:'5. Move "mark_mod.ini" to Freelancer\Data\Equipment\ and rename it
' to "market_ships.ini", replacing the original one (you DID make
' a backup like I told you in step [1, didn't you?)


'- - - HOW IT WORKS - - -
' 1. It reads a line from the original "market_ships.ini"
' 2. Does this line contain ships data? i.e. does it start
' with "marketgoods" (case insensitive)? If no, then just copy it
' over to the output file, since we don't want to change anything
' else.
' 3. If yes, then this line contains ship data. So we need to
' replace it with zero, while preserving the rest of it.
' 4. For example: "marketgood = kfr_package, 10, -1, 0, 0, 1, 1, 1"
' We find the 1st and 2nd commas, those are the ones that
' surround the level requirement.
' 5. Stuff everything to the left of the first comma into a string,
' and everything to the right of the second comma into another string.
' As you can see, by doing this we have neglected to "save" the value
' in between the two commas into either string, namely the level
' requirement. It will be lost.
' 6. So now we have: left part = "marketgood = kfr_package,"
' and right part = ", -1, 0, 0, 1, 1, 1"
' 7. Now join both parts together while sandwiching a zero in between.
' This zero is the new level requirement, i.e. none.
' 8. The result: "marketgood = kfr_package, 0, -1, 0, 0, 1, 1, 1"
' 9. Ta-da! Only the level requirement is zero'ed, everything else is
' left intact. Now this line will be written to the output file.
'10. Repeat until we reach the end of the original "market_ships.ini"
'11. The resulting file should have the SAME number of lines. Now
' follow the Instructions (above) from step [4.


'In case of screwups, restore market_ships.ini from the backup you
' made.

'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

comma1 = 0: comma2 = 0
curLine$ = "": leftPart$ = "": rightPart$ = ""
PRINT : PRINT "Executing."

'Make sure you have market_ships.ini in C:'Check it's 8.3 DOS name, in my case it was "market~1.ini"
'If it's different then replace it in the "Open" statement below.
'BASIC doesn't support long file names, that's why it's like that.

OPEN "C:\market~1.ini" FOR INPUT AS #1
OPEN "C:\mark_mod.ini" FOR OUTPUT AS #2

DO
LINE INPUT #1, curLine$
comma1 = 0: comma2 = 0
leftPart$ = "": rightPart$ = ""

IF LEN(curLine$) > 10 THEN
IF LCASE$(LEFT$(curLine$, 10)) = "marketgood" THEN

comma1 = INSTR(1, curLine$, ","
comma2 = INSTR(comma1 + 1, curLine$, ","
leftPart$ = LEFT$(curLine$, comma1)
rightPart$ = MID$(curLine$, comma2)

'shipLvl$ = MID$(curLine$, comma1 + 1, comma2 - comma1 - 1)
'You don't need this, but I left it in just in case anyone
'wanted to do anything with the current level requirement.

curLine$ = leftPart$ + " 0" + rightPart$
END IF
END IF
PRINT #2, curLine$

LOOP UNTIL EOF(1)
CLOSE

PRINT "Finished. Press any key to continue.": curLine$ = INPUT$(1)

'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
</font></pre>

Post Tue Apr 20, 2004 9:32 pm

to those "unknown" numbers:
i donno exactly, but try to compare with other market files.
my guess is that its some sort of category.
1, 1 for ships
10, 10 for guns
50, 50 for ammo
150, 500 for commodities

0, 0 is always used when its not available for sale.
doesnt look like a binary flag system to me - but it seems to be similar.

Fjord

---------------------------------
Excelcia Mod Leading Developer

Post Wed Apr 21, 2004 5:35 am

yup you are right.
the two zeroes control the ammo of missiles,mines,commodities,etc......
the first of the two zeroes tell you how much ammo you get when you buy the missile or mine etc. the second is the maximum limit of the ammo or commodity that can is being bought..

Edited by - ittan_v on 4/21/2004 6:37:34 AM

Post Wed Apr 21, 2004 5:51 am

I am sorry, but u are completely wrong with this.
those 2 "unknown" numbers have nothing to do with ammo limit or anything similar (prices, ...).
they tell FL in what section of the equipment dealer the stuff appears (this is my guess).
guns, ammo, these things are seperated although all have "equipment" in their good descriptions.
ships and commodities are seperated there.

btw, ammolimit is set in constants.ini - its unfortunately a global value for all ammo types *kicks the one who designed it to be this way*

but there are other ways to limit ammo - check the excelcia 2.0 mod preview in the mod announcement forum, it describes how we solved the problem to give each ammo type something like a limit.

i have tried to mix up the categories (the numbers -tried to use 50 for a gun and 10 for ammo) - it crashed on me - use it as it was meant to be.

i have also no clue how FL decides to put shields and thrusters into their own category - maybe cause they have no [ammunition - like entries. (mines and CMs have those)

Fjord

---------------------------------
Excelcia Mod Leading Developer

Post Wed Apr 21, 2004 7:31 am

try what i have just said above. you can be sure that you will get 50 ammo of anything when you buy it. i will send you an edited file try it in the game.

dont forget to back up the file.

Post Wed Apr 21, 2004 8:14 am

because of this:
constants.ini
MAX_PLAYER_AMMO = 50

if ur theory would be true, then in excelcia u wouldnt be able to buy more than 50 ammo as all ammo entries are similar to the original ones.

but we have this:
MAX_PLAYER_AMMO = 20000
and it works (we limit the amount by giving ammo volume values - ur cargohold is the effective ammolimit then.

and i could fill a train with 5k of the same commodity bought on the same base - thats quite less as the 500 - that'd be the limit in ur theory, right?

Fjord

---------------------------------
Excelcia Mod Leading Developer

Edited by - LordFjord on 4/21/2004 9:30:37 AM

Return to Freelancer General Editing Forum