Jump to content

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


50p

Recommended Posts

Map Exporter v0.3

MapExporter.PNG

DOWNLOAD

Intro:

Modellers know how time consuming setting up custom maps is. This tool lets modellers generate .map file automatically along with meta.xml and basic Lua script which replaces models for them (no texture support though since some custom maps only use 1 .txd file and some maps use more).

Exporting maps from 3DS Max looked as follows:

- export each part (model) of the map

- export collision for them all

- make a Lua script to replace models (not every modeller knows how to do it)

- make a map file with Map Editor (it may take some time to align all the models to look seamless)

- make a meta.xml with all models included in it ()

With this script, the process changes to:

- export COL files for all your models

- select all map models in 3DS Max that should be included in map file (make sure they have materials applied!)

- hit "Export to .map" button (uncheck boxes if Lua script, meta.xml or DFF files are not needed, i.e. already exported)

How to install and run the script:

Just extract the MapExporter.ms file from MapExporter.zip to <3ds max>\Scripts\(Startup) (you don't have to extract it to Startup folder unless you want the script to be started with 3DS Max).

(If you haven't installed it to \Startup folder, keep reading)

Run the script from 3DS Max, "MAXScript -> Run script..." (find the MapExporter.ms script)

Once the script is running, you should notice new rollout in Utilities tab "50p's MTA:SA Scripts".

How to use:

Select all the models you want to be exported to .map file (optionally .lua script, meta.xml and DFF models), check/uncheck the appropriate boxes and hit "Export to .map" button.

Then you will be asked where to save the map file.

Facts to remember:

- all the files are recreated every time you export the .map, so if you have created meta.xml or .lua file already, they will be overwritten every time you export your map

- If you generate Lua script, the models which will be replaced by the script start from model ID 4000+

- .lua file name is the same as .map file name

- .lua and meta.xml files are created in the same directory as the .map file

- .col files should be placed in the same directory as the .dff files (which is (exported map folder)\map\ )

Any questions, suggestions or bug reports please post in this topic. Thank you.

NOTE: This script doesn't export .dff nor .col files. For that, you still need to use KAM's or daniska's scripts. My script generates .map, .lua and meta.xml files only to speed up map/resource creation.

Didn't really know where to release this script but I think this is the most suitable place.

Changelog:

v0.1:

- initial release

v0.3

- fixed: typos in Lua and meta.xml generated files

- added: selecting map spawn position by clicking GTA map

- added: exporting models to DFF (KAM's scripts installed required!)

Edited by Guest
Link to comment
  • Replies 99
  • Created
  • Last Reply

Top Posters In This Topic

your script works with every version of 3DS Max or with latest? Especcially wanna ask if it works with 3DS Max 6? :D

I made it in 2010 and tested with 8 but I haven't used functions which were added in 2010... It should work with most of 3DS Max versions. I haven't tested with versions lower than 8. Give it a try and reply here.

Link to comment
  • 2 weeks later...

Kickass tool man really helpfull for 3d modellers ! so I already imported custom maps with succes before (it take ages like you said) but here s i'm stuck now and i have few questions for you:

how can i see the map in the ingame editor ? do i have to create a second resource ?? if yes what I need to add?

in the lua file i need to add the texture (txd) below the col code like this?

temp = engineLoadtxd( modelName .. ".txd" );
	engineReplacetxd( temp, i + 4000 );

all i have to say is that kind of tool is great, makes modding easier.

keep it up

Edited by Guest
Link to comment
Sorry for bumping but I just want to know how can I show up the map in the editor after exporting with this script ?

I'm sorry for not replying. My PC broke last week and have just got new graphic card.

Anyway, if you want to see your custom map in map editor, you need to make new resource.. Well, this script almost makes the resource for you because it generates meta.xml, Lua script and a map file. All you need to do is export all the models separately to .dff. Just make new folder and export your map to that folder.

I'm working on a new version of this script which will export models to .dff as well with use of KAM's script. I still can't figure out how to export .col because Kam encoded his collision exporter and I don't know what functions it has that I could use... I can't even get in touch with him since he hasn't got a PC and last time he was online was 4 years ago (when he released his Max scripts)

I need your suggestions for next release. I want to export map so that you won't have to use map editor to place your objects. Currently, it looks like this: http://i42.tinypic.com/w0ku4i.png

How would you like it to work? Any suggestions?

Link to comment

I was just impatient to see an answer :mrgreen: congrats for your new cg.

I already did that, I created a resources edited a bit and added dff, col and txd files, the problem is, in the editor I can't see my resource appeard as a map so I tried to start the resource via the console and its says "resource started" but anything appeard so... what the f*** ?

My old custom map was made in a different way, first I created a map in the map editor I added a default sa object saved and quit. Once on the desktop I created an other resource called "customcontent" with dff,col... files and of course the lua one in it.

After all the coding work finished I get back in the editor load the map and start the resource "customcontent" to replace the default sa object and it works.

the lua file:

function attemptReplace()
local txd = engineLoadTXD('racehighway.txd')
-- TXD
engineImportTXD(txd, 9247)
-- COL
local col = engineLoadCOL("racehighway.col")
engineReplaceCOL(col, 9247)
-- DFF
local dff = engineLoadDFF("racehighway.dff", 0)
engineReplaceModel(dff, 9247)
end
addEventHandler('onClientResourceStart', resourceRoot, attemptReplace)
addCommandHandler('replace', attemptReplace)

meta.xml of the first resource:

<meta>
   <include resource="customcontent" />
   <info gamemodes="race" type="map" name="racehighway" author="snoopsback" version="1.0.0" />
   <map src="racehighway.map" dimension="0" />
   <settings>
...

So what do you think ? I'm not skilled at all in coding it was hard to me to do that with a lot of help I finally did it.

Now I prefer to switch to your 3ds script it's a lot faster for me but if I have to do some more coding work I'll turn insane :twisted:

Nice update, but map editor is necessary if you want to add checkpoints on custom tracks and spawnpoints.

Edited by Guest
Link to comment

I'm not sure if I understood your correctly.

My script generates Lua script (which replaces the models included in the resource it creates and adds a /reload command) and meta.xml (which includes paths to .dff models). So your custom content should be inside the map resource generated by Max script. Check meta.xml to see paths of models that are included with the resource which my script generates.

Link to comment

That's what I've done from the begining.

Yeah it seems that you don't understand me.. so I made a resource with a cube cut in 4 .dff and .col with meta.xml, map and lua exported straight from your script, now what I want you to do is to try the resource on your map editor and see if the map works and if not then edit the resource so I can see what you've done.

It Should be faster that way for you and for me :mrgreen: (maybe for other ppl too).

http://rapidshare.com/files/386151559/qube.zip.html

btw the cube is located in south-east of los santos(near the stadium).

Link to comment
That's what I've done from the begining.

Yeah it seems that you don't understand me.. so I made a resource with a cube cut in 4 .dff and .col with meta.xml, map and lua exported straight from your script, now what I want you to do is to try the resource on your map editor and see if the map works and if not then edit the resource so I can see what you've done.

It Should be faster that way for you and for me :mrgreen: (maybe for other ppl too).

http://rapidshare.com/files/386151559/qube.zip.html

btw the cube is located in south-east of los santos(near the stadium).

Unfortunately, MTA has stopped working for me after installing new graphics card :/ I've tried almost everything to try and fix it... I asked on IRC but without luck. So I have to disappoint you but I am not able to check your resource.

But I'll download your resource and check if anything is wrong.

EDIT:

I'm not sure (since I can't test it) but I think the problem is that map is not added to meta.xml. So, add this to your meta.xml:

<map src="qube.map" />

Did you modify meta.xml or is it how it was generated with my Max script?

Link to comment
Not working and nope I've modified anything. :-k

Show me your new meta.xml then. As you may know, meta.xml file tells server which files each resource use. If there is no map in meta.xml, then server doesn't even know the file is there.

Link to comment

I found an error in the console when the resource started:

WARNING: Missing 'src' attribute from 'file' node of 'meta.xml' for resource 'qube', ignoring

So I edited this:

<file name="red.dff" />

Into this:

<file src="red.dff" />

No more error now.

meta.xml:

[color=#BF40FF]<!-- Meta.xml generated with 50p MTA:SA MAXScript v0.1 (23/04/2010) -->
<meta>
<info author="" gamemode="race" name="qube" />
<script src="qube.lua" type="client" />
<map src="qube.map" />
 
<file src="red.dff" />
<file src="red.col" />
<file src="blue.dff" />
<file src="blue.col" />
<file src="green.dff" />
<file src="green.col" />
<file src="yellow.dff" />
<file src="yellow.col" />
</meta>[/color]

Link to comment

Oh, I thought it was generating with 'src'. Sorry for little "bug". Anyway, good to hear you found out what the problem was. If you'll use this script very often, then I suggest you modify the Max script rather than meta.xml every time you generate new meta.xml or re-download the script.

Here is the solution, in case you decide to fix it yourself:

Open MapExporter.ms script with notepad and replace lines 88 and 89 with these 2 lines:

format "\t<file src=\"%.dff\" />\n" obj.name to:metaXML;
format "\t<file src=\"%.col\" />\n" obj.name to:metaXML;

Link to comment

the generated meta.xml should also contain: type="map" in the info tag and im not sure if this is a mistake or it works like this too but instead of gamemode="race" it should be gamemodes="race"

also in the tag it adds dimension="0", this makes the map not run on my servers, so in case this is not a personal bug you should remove that

in the lua script i think there was a typo: engineLoadCol instead of engineLoadCOL, same typo for engineReplaceCOL

also in the .map file instead of generating it sets it to "deathmatch"

hope this helps

Link to comment

Yay !

It's working... finally! thanks a lot Adiboy awesome :thumbleft:

it was a pain in the ass for me so please next time test your stuff before releasing 50p :mrgreen:

anyway I learned some coding so it's not that bad.

Now I want to add my txd file so where put the code ?

-- Script generated with
-- 50p MTA:SA MAXScript v0.1 (23/04/2010)
 
modelNames = { "red", "blue", "green", "yellow", }
 
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 );

thaaaaaanks !

Link to comment
Yay !

It's working... finally! thanks a lot Adiboy awesome :thumbleft:

it was a pain in the ass for me so please next time test your stuff before releasing 50p :mrgreen:

anyway I learned some coding so it's not that bad.

Now I want to add my txd file so where put the code ?

-- Script generated with
-- 50p MTA:SA MAXScript v0.1 (23/04/2010)
 
modelNames = { "red", "blue", "green", "yellow", }
 
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 );

thaaaaaanks !

I couldn't test it for some reason. Though I test every script before I release.

At least I can see people use the script :) Thanks for spotted typos AdiBoy, they'll be corrected in next release.

Link to comment

i just can't fix it .__. I have the same problem that snoopsback had, the map is not shown in the map editor.

my meta.xml

<!-- Meta.xml generated with 50p MTA:SA MAXScript v0.1 (23/04/2010) -->
<meta>
<info author="" gamemodes="race" name="pool01" />
<script src="pool01.lua" type="map" />
<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 );

pls help :<

Link to comment

Why do you ignore what I told you to do? I also told you to read AdiBoy's post CAREFULLY...

the generated meta.xml should also contain: type="map" in the info tag

...

Why did you put type="map" to "script" node when his post clearly says info node?

Refresh the resource every time you make changes to it.

Link to comment
Why do you ignore what I told you to do? I also told you to read AdiBoy's post CAREFULLY...
the generated meta.xml should also contain: type="map" in the info tag

...

Why did you put type="map" to "script" node when his post clearly says info node?

Refresh the resource every time you make changes to it.

I already told you that i don't know anything about the mta things -.-

so where or what is the info node?

//edit:

I got it now.. i can load the map.

meta.xml:

<!-- 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="map" />
<map src="pool01.map" />
 
<file src="pool01.dff" />
<file src="pool01.col" />
</meta>

BUT! The object doesnt change to the custom models when i start test mode o.O it still has got it's normal model.. why :o?

Link to comment

Try this

meta.xml:

<!-- 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="[color=#BF4000]client[/color]" />
  <map src="pool01.map" />
 
  <file src="pool01.dff" />
  <file src="pool01.col" />
</meta>

wth is that test mode ? speak normally please.

All you have to do is to open your map and start it as a resource in your console, "start pool01".

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...