Jump to content

[TOOL] 50p's MTA:SA Map Exporter (3DS MAXScript) v0.3


50p

Recommended Posts

  • Replies 99
  • Created
  • Last Reply

Top Posters In This Topic

bad diea to replace that obj, the landbit in that map will be spoiled

The Max script generates code that replaces models starting with ID 4000. That's just a random number that came to my mind at scripting time. Also, I was aiming to "race" mappers, so it doesn't really matter what model is replaced since race maps are fully custom. I may add a text box which will let user insert their own ID. I also thought of a feature that will let users set their spawn points straight in 3DS Max.

[miLKy_wAy], I managed to get MTA to work and I'll test some maps including yours. Just post your latest resource here and I'll try to figure out what is wrong.

Link to comment
bad diea to replace that obj, the landbit in that map will be spoiled

The Max script generates code that replaces models starting with ID 4000. That's just a random number that came to my mind at scripting time. Also, I was aiming to "race" mappers, so it doesn't really matter what model is replaced since race maps are fully custom. I may add a text box which will let user insert their own ID. I also thought of a feature that will let users set their spawn points straight in 3DS Max.

[miLKy_wAy], I managed to get MTA to work and I'll test some maps including yours. Just post your latest resource here and I'll try to figure out what is wrong.

<!-- Meta.xml generated with 50p MTA:SA MAXScript v0.1 (23/04/2010) -->
<meta>
<info author="" gamemodes="race" type="map" name="pool01" />
<script src="pool01.lua" type="client" />
<map src="pool01.map" />
 
<file src="pool01.dff" />
<file src="pool01.col" />
</meta>

my map file

<map edf:definitions="race,editor_main">
<object name="pool01" model="4000" posX="-56.6282" posY="-119.069" posZ="0.0" rotX="-89.8685" rotY="0.816823" rotZ="95.4547" />
</map>

my lua file

-- Script generated with
-- 50p MTA:SA MAXScript v0.1 (23/04/2010)
 
modelNames = { "pool01", }
 
function reloadModels( )
  for i, modelName in ipairs( modelNames ) do
     local temp = engineLoadDFF( modelName .. ".dff", 0 );
     engineReplaceModel( temp, i + 4000 );
     temp = engineLoadCOL( modelName .. ".col" );
     engineReplaceCOL( temp, i + 4000 );
  end
end
addEventHandler( "onClientResourceStart", getResourceRootElement(), reloadModels );
addCommandHandler( "reload", reloadModels );

Link to comment

[miLKy_wAy], I've been testing and fixing the bugs that may cause models not to be replaced. I forgot that for loops in MAXScript start with 0 whereas Lua's tables start with 1. So if you try to replace 1 model, it will not be replaced because the for loops in Lua script tries to replace model with ID 4001 but model ID in map file starts with 4000. You can fix it by changing 1 thing in Lua script. Change the followings:

engineReplaceModel( temp, i + 4000 );
 
engineReplaceCOL( temp, i + 4000 );
 
-- to this:
 
engineReplaceModel( temp, (i-1) + 4000 );
 
engineReplaceCOL( temp, (i-1) + 4000 );

Also, if you want your models to be visible from long distance (max 300 units), add this line below engineReplaceCOL:

engineSetModelLODDistance( (i-1) + 4000, 300 );

EDIT:

I just found out that sometimes when you want to restart the custom map resource and you made some changes by 3DS Max (like re-exported the map), it may fail to restart and output an error: "Couldn't parse meta.xml for 'yourresourcename'". This is caused by 3DS Max not closing the file properly and MTA can't open it. To fix this, you have to close 3DS Max and "refresh" server (it's a refresh command that you type in console or in-game) to try and parse meta.xml again. I can't figure out why it happens but I'm sure it may be annoying to close 3DS Max and open it to re-export.

mapexporter.th.png

Link to comment

it looks like this now..

-- Script generated with
-- 50p MTA:SA MAXScript v0.1 (23/04/2010)
 
modelNames = { "pool01", }
 
function reloadModels( )
for i, modelName in ipairs( modelNames ) do
local temp = engineLoadDFF( modelName .. ".dff", 0 );
engineReplaceModel( temp, (i-1) + 4000 );
     temp = engineLoadCOL( modelName .. ".col" );
engineReplaceCOL( temp, (i-1) + 4000 );
end
end
addEventHandler( "onClientResourceStart", getResourceRootElement(), reloadModels );
addCommandHandler( "reload", reloadModels );

But there are still no custom models o.O

Link to comment
it looks like this now..
-- Script generated with
-- 50p MTA:SA MAXScript v0.1 (23/04/2010)
 
modelNames = { "pool01", }
 
function reloadModels( )
for i, modelName in ipairs( modelNames ) do
local temp = engineLoadDFF( modelName .. ".dff", 0 );
engineReplaceModel( temp, (i-1) + 4000 );
     temp = engineLoadCOL( modelName .. ".col" );
engineReplaceCOL( temp, (i-1) + 4000 );
end
end
addEventHandler( "onClientResourceStart", getResourceRootElement(), reloadModels );
addCommandHandler( "reload", reloadModels );

But there are still no custom models o.O

Have you noticed there is a new release? :) Try the new one (v0.3) and see whether it works for you now.

Link to comment

hey dude, great stuff. Thx a lot.

Is it possible to manually select the map location by typing in the co-ordinates? You've used the edittext tag in the script, but it only shows the coords, i cant edit those in the "choose location" window. i would like the map to be 5000 units to the right so it's at sea.

Link to comment
hey dude, great stuff. Thx a lot.

Is it possible to manually select the map location by typing in the co-ordinates? You've used the edittext tag in the script, but it only shows the coords, i cant edit those in the "choose location" window. i would like the map to be 5000 units to the right so it's at sea.

I do not recommend spawning maps that far away. There are many issues with maps that are spawned outside SA map (mainly camera clipping) so more than 3000 is not recommended. I will add one more text box with Z where you can change Z but not X and Y (maybe in the far future).

Link to comment
  • 5 weeks later...

normally I build my custom map in the MTA editor, its work I can see my models+texture and its like a normal san andreas object, I can move rotate and the collision work perfect after I save the map and I can play it if I include the script of my custom models of course in the meta.xml :

gtasa2010062113122034.png

gtasa2010062113144920.png

Good work I can use this to save time, because is long to build the script and the meta when you have a lot of models (in the script you have to write where the files are and in the meta too, is long.)

Link to comment

I cant very help you, because im bad in script sorry 50p im just a mapper, a good mapper, but a mapper, what I do to play with my custom models (rotate moving like a normal sa object xD) in the MTA map editor, I do these steps and its long, but not too long, I dont have to build the map in 3ds max. :

1)Think in your head what the map look like

2) make your custom model + texture + the collision (collision very easy copy your model and add a .col shader)

3) make another custom model and look if they fit correctly, the both, togheter for a race map example

4)export in gta sa engine

5)I have a resource named test2 in my resource folder, the script to show the custom model in MTA is there, I just have to put my .dff .txd and .col in this folder and make sure the script + meta target the custom models files

6) start a serve write start editor in it and start test2 (my custom model script)

7) begin a new map and place your custom models where you want for your map, result build the map in MTA map editor.

Maybe you can make a tool to creat a script for your custom models like my resource test2, so you build the map in MTA map editor and not 3ds max here my script in the resource test2 :

addEventHandler('onClientResourceStart', resourceRoot, 
function() 
 
local txd = engineLoadTXD('files/akina.txd')
   engineImportTXD(txd, 2052)
engineImportTXD(txd, 2053)
engineImportTXD(txd, 2054)
engineImportTXD(txd, 2371)
engineImportTXD(txd, 2372)
 
local col = engineLoadCOL('files/akina1.col') 
engineReplaceCOL(col, 2052)
local col = engineLoadCOL('files/akina2.col') 
engineReplaceCOL(col, 2053)
local col = engineLoadCOL('files/akina3.col') 
engineReplaceCOL(col, 2054)
local col = engineLoadCOL('files/akina4.col') 
engineReplaceCOL(col, 2371)
local col = engineLoadCOL('files/akina5.col') 
engineReplaceCOL(col, 2372)
 
local dff = engineLoadDFF('files/akina1.dff', 0) 
engineReplaceModel(dff, 2052)  
local dff = engineLoadDFF('files/akina2.dff', 0) 
engineReplaceModel(dff, 2053)
   local dff = engineLoadDFF('files/akina3.dff', 0) 
engineReplaceModel(dff, 2054)  
local dff = engineLoadDFF('files/akina4.dff', 0) 
engineReplaceModel(dff, 2371)
   local dff = engineLoadDFF('files/akina5.dff', 0) 
engineReplaceModel(dff, 2372)	
 
engineSetModelLODDistance(2052, 500)
engineSetModelLODDistance(2053, 500)
engineSetModelLODDistance(2054, 500)
engineSetModelLODDistance(2371, 500)
engineSetModelLODDistance(2372, 500)
 
end 
)

is not complicated :wink:

and you can send your custom models + script to a friend so he can build his custom map by placing the model in MTA map editor, example I send custom tube shape and with it we can make different custom map in MTA map editor like a normal sa object but more funny. :D

and people who make custom race map or just map, share with the other on the community, because they are so nice :D In this topic I speak about hidden custom race map, people made it, but they dont share the good work they do, of course maybe they dont are ready. : https://forum.multitheftauto.com/viewtop ... 93&t=27992

Link to comment

I don't know what you're trying to say by this post benox583. Are you trying to give a suggestion? Are you trying to teach me how to make custom maps? Maybe something else? I'm not very sure... and because of that, I don't know what to reply to you :roll:

Link to comment

I don't know mate... I made the script so it creates new resource for you and all you have to do is:

- export collision mesh yourself manually (I can't figure out how to write collision exporter)

- add some code to change textures of the exported models

You can start the resource in map editor and it should replace the models for you because my MAXScript creates Lua script for you...

Link to comment
  • 3 weeks later...

Yeah man I find it very very helpful thx. Already converted some 7 maps from other games Including the full:

-Nurburgring takes 7 minutes to complete on our F1 server!

-spa-francochamps

-Bathurst and others

check them out on the SKC server ;) Thx again

http://img59.imageshack.us/img59/667/dsfcu.jpg[/img]

http://img717.imageshack.us/img717/20/28160156.jpg[/img]

http://img338.imageshack.us/img338/640/32943567.jpg[/img]

http://img28.imageshack.us/img28/3670/88388483.jpg[/img]

http://img691.imageshack.us/img691/7484/95274446.jpg[/img]

http://img411.imageshack.us/img411/1867/98465799.jpg[/img]

http://img717.imageshack.us/img717/3329/47521074.jpg[/img]

http://img99.imageshack.us/img99/3043/33312254.jpg[/img]

http://img691.imageshack.us/img691/7484/95274446.jpg[/img]

Link to comment

Great to see some work being done by the script! I'm not a fan of racing games/gamemodes but I'm glad it helped you a lot. I wish I could find out how to export collision files as well.. That would speed everything up even more. Keep exporting :) I may improve it in the future somehow but before I do it, please give suggestions, what would you like to see and/or what needs change in your opinion?

Link to comment

OMG ! I try it and its dont work with 3ds max 9, error at these lines in the scripts named MapExporter.ms :

local gtaMap = openBitmap ( ( getDir #scripts ) + @"\MapExporter\gtasa-map-small.jpg" );

and

local marker = openBitmap ( ( getDir #scripts ) + @"\MapExporter\marker.tga" );

error message at start up or when I try to run the script, here the error :

--syntaxe error: at bad, expected factor

--in line local gtaMap = openBitmap ........ and I cant read after, but of course is the two lines

I think he cant find the files :

- gtasa-map-small.jpg

and

- marker.tga

I try to put these files at different places in 3ds max, but nothing change !

:( I did a big work to extrack some models of a map with Med editor !!!

yes I need to test all the things before, but I dont see error on this forum section !

I speak about your new ! I did not try the old Map Exporter.

and kams script work.

Link to comment

thanks for the speed answer, but no this isnt the solution I try it before and I try it again to be sure after your answer, but no d'ont work ! Arggg is bad for a 3D beginner !

Here the best I can do to show what I see :

errorup.png

Message error :

errordeproche.png

For better , want a video xD !

and of course I use win 7.

I cant say its an error its mostly a warning, but a mega killer warning ! Ouch !

Link to comment

OK, now I get it. All you need to do is change the string from this:

@"\MapExporter\gtasa-map-small.jpg"
and
@"\MapExporter\marker.tga"

to

"/MapExporter/gtasa-map-small.jpg"
and
"/MapExporter/marker.tga"

The reason for it is because @ was added in 3DS Max 2008, so the script will work in 2008 and newer versions of 3DS Max. Let me know if this solves the issue.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...