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

Everything else about resources.

Moderators: Scripting Moderators, Moderators, MTA Team

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

Postby 50p on Fri Apr 23, 2010 6:49 pm

Map Exporter v0.3

Image

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 (<file/>)

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 <map name>.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!)
Last edited by 50p on Tue May 18, 2010 10:31 am, edited 2 times in total.
User avatar
50p
Scripting Section Moderator
 
Posts: 2846
Joined: Fri Jan 19, 2007 5:55 pm
Gang: Lua Masters :P

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby Johnline on Fri Apr 23, 2010 7:33 pm

awesome work, i'll sure use this :)
maybe you could do semi-texture scripting support by having a spinner that defines the number of txd archives being used, and then the placeholder code is there to edit manually
ImageImageImage
User avatar
Johnline
MTA Contributor
 
Posts: 76
Joined: Mon Mar 21, 2005 9:40 pm
Location: London
Gang: [DK]

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby Arctos on Sat Apr 24, 2010 5:12 am

your script works with every version of 3DS Max or with latest? Especcially wanna ask if it works with 3DS Max 6? :D
User avatar
Arctos
Rat
 
Posts: 44
Joined: Mon Jan 23, 2006 4:22 pm
Location: Poland
Gang: ANO

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby SATAN on Sat Apr 24, 2010 6:58 am

this is awesome .. gonna try it out as soon as possible. :)
User avatar
SATAN
Playa Partner
 
Posts: 500
Joined: Wed May 14, 2008 3:11 pm
Location: Berlin - Germany

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby 50p on Sat Apr 24, 2010 11:45 am

Arctos wrote: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.
User avatar
50p
Scripting Section Moderator
 
Posts: 2846
Joined: Fri Jan 19, 2007 5:55 pm
Gang: Lua Masters :P

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby snoopsback on Wed May 05, 2010 7:17 pm

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?

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


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

keep it up
Last edited by Towncivilian on Sun May 09, 2010 8:33 pm, edited 1 time in total.
Reason: Put LUA in [code=lua][/code] tags.
snoopsback
Vic
 
Posts: 9
Joined: Wed May 05, 2010 6:38 pm
Gang: Lost MC

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby snoopsback on Fri May 07, 2010 3:06 pm

Sorry for bumping but I just want to know how can I show up the map in the editor after exporting with this script ?
snoopsback
Vic
 
Posts: 9
Joined: Wed May 05, 2010 6:38 pm
Gang: Lost MC

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby 50p on Sun May 09, 2010 3:43 pm

snoopsback wrote: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?
User avatar
50p
Scripting Section Moderator
 
Posts: 2846
Joined: Fri Jan 19, 2007 5:55 pm
Gang: Lua Masters :P

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby snoopsback on Sun May 09, 2010 7:40 pm

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:

  1. function attemptReplace()
  2.    local txd = engineLoadTXD('racehighway.txd')
  3.    -- TXD
  4.    engineImportTXD(txd, 9247)
  5.    -- COL
  6.    local col = engineLoadCOL("racehighway.col")
  7.    engineReplaceCOL(col, 9247)
  8.    -- DFF
  9.    local dff = engineLoadDFF("racehighway.dff", 0)
  10.    engineReplaceModel(dff, 9247)
  11. end
  12. addEventHandler('onClientResourceStart', resourceRoot, attemptReplace)
  13. addCommandHandler('replace', attemptReplace)


meta.xml of the first resource:

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


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.
Last edited by Towncivilian on Sun May 09, 2010 8:33 pm, edited 1 time in total.
Reason: Put LUA in [code=lua][/code] tags.
snoopsback
Vic
 
Posts: 9
Joined: Wed May 05, 2010 6:38 pm
Gang: Lost MC

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby 50p on Mon May 10, 2010 9:15 pm

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.
User avatar
50p
Scripting Section Moderator
 
Posts: 2846
Joined: Fri Jan 19, 2007 5:55 pm
Gang: Lua Masters :P

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby snoopsback on Tue May 11, 2010 3:30 pm

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).
snoopsback
Vic
 
Posts: 9
Joined: Wed May 05, 2010 6:38 pm
Gang: Lost MC

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby 50p on Tue May 11, 2010 11:49 pm

snoopsback wrote: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:


Did you modify meta.xml or is it how it was generated with my Max script?
User avatar
50p
Scripting Section Moderator
 
Posts: 2846
Joined: Fri Jan 19, 2007 5:55 pm
Gang: Lua Masters :P

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby snoopsback on Wed May 12, 2010 12:30 am

Not working and nope I've modified anything. :-k
snoopsback
Vic
 
Posts: 9
Joined: Wed May 05, 2010 6:38 pm
Gang: Lost MC

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby 50p on Wed May 12, 2010 2:03 pm

snoopsback wrote: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.
User avatar
50p
Scripting Section Moderator
 
Posts: 2846
Joined: Fri Jan 19, 2007 5:55 pm
Gang: Lua Masters :P

Re: [REL] 50p's MTA:SA Map Exporter (3DS MAXScript)

Postby snoopsback on Wed May 12, 2010 5:26 pm

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:
  1. <file name="red.dff" />


Into this:


No more error now.

meta.xml:

  1. <!-- Meta.xml generated with 50p MTA:SA MAXScript v0.1 (23/04/2010) -->
  2. <meta>
  3.    <info author="" gamemode="race" name="qube" />
  4.    <script src="qube.lua" type="client" />
  5.    <map src="qube.map" />
  6.  
  7.    <file src="red.dff" />
  8.    <file src="red.col" />
  9.    <file src="blue.dff" />
  10.    <file src="blue.col" />
  11.    <file src="green.dff" />
  12.    <file src="green.col" />
  13.    <file src="yellow.dff" />
  14.    <file src="yellow.col" />
  15. </meta>
snoopsback
Vic
 
Posts: 9
Joined: Wed May 05, 2010 6:38 pm
Gang: Lost MC

Next

Return to Resources

Who is online

Users browsing this forum: No registered users and 4 guests