Jump to content

Custom map objects.


Guest Arvis

Recommended Posts

Can someone give me piece of code for importing in custom map object?

Few months ago i saw that you guys got "de_aztec" from CSS in MTA,

i want to get in my .dff, .txd and .col into MTA, but im seeing only scripts for custom

vehicle models.

I hope you can help me.

Link to comment
txd_floors = engineLoadTXD ( "models/office_floors.txd" ) 
engineImportTXD ( txd_floors, 3781 ) 
col_floors = engineLoadCOL ( "models/office_floors.col" ) 
dff_floors = engineLoadDFF ( "models/office_floors.dff", 0 ) 
engineImportCOL ( col_floors, 3781 ) 
engineReplaceModel ( dff_floors, 3781 ) 

But I do not know where the IDs of the objects can find

Link to comment

Probably im doing something wrong, but here's my code: (i used that riot_shield from seatlh gamemode)

  
function customObj () 
    txd_customObj = engineLoadTXD("riot_shield.txd") 
    engineImportTXD(txd_customObj,1337) 
    col_customObj = engineLoadCOL("riot_shield.col") 
    dff_customObj = engineLoadDFF("riot_shield.dff", 0 ) 
    engineReplaceCOL(col_customObj,1337) 
    engineReplaceModel(dff_customObj,1337) 
end 
addEventHandler ( "onResourceStart", getRootElement(), customObj ) 
  
  
function mapLoad ( name ) 
  
   -- create an object at a specified position with a specified rotation 
   createObject ( 1337, 100, 100, 2, 90, 0, 0 ) 
end 
addEventHandler ( "onResourceStart", getRootElement(), mapLoad ) 
  

Console gives me error:

  
ERROR: ..server/mods/deatchmatch/resources/mapload/mapload.lua:2: attemt to call global "engineLoadTXD" <a nil value> 
  

(In-game i just see object with ID 1337, not riot_shield).

Link to comment

Don't know if this works but you can try

Rember! This is a CLIENT SIDE function so you need to use this in your meta file!

  
function customObj () 
    txd_obj = engineLoadTXD ( "riot_shield.txd" ) 
    engineImportTXD ( txd_obj, 1337 ) 
    col_obj = engineLoadCOL ( "riot_shield.col" ) 
    engineImportCOL ( col_obj, 1337 ) 
    dff_obj = engineLoadDFF ( "riot_shield.dff", 1337 ) 
    engineReplaceModel ( dff_obj, 1337 ) 
end 
addEventHandler ( "onResourceStart", getRootElement(), customObj ) 
  

Link to comment

Wrong.

I did it, look at my code:

  
function customObj () 
    txd_obj = engineLoadTXD ( "riot_shield.txd" ) 
    engineImportTXD ( txd_obj, 1337 ) 
    col_obj = engineLoadCOL ( "riot_shield.col" ) 
    engineImportCOL ( col_obj, 1337 ) 
    dff_obj = engineLoadDFF ( "riot_shield.dff", 1337 ) 
    engineReplaceModel ( dff_obj, 1337 ) 
end 
addEventHandler ( "onResourceStart", getRootElement(), customObj ) 
  
  
function mapLoad ( name ) 
  
   -- create an object 
   createObject ( 1337, 100, 100, 5, 90, 0, 0 ) 
end 
addEventHandler ( "onResourceStart", getRootElement(), mapLoad ) 
  
  

meta.xml:

<meta> 
    <info name="mapload" description="..." author="<Arvis>"/>   
    <script src="mapload.lua" type="client" /> 
    <file src="riot_shield.dff" /> 
    <file src="riot_shield.txd" /> 
    <file src="riot_shield.col" /> 
</meta>  

All files are in the same folder.

Link to comment

hi, i have a question :wink:

first, look at these pictures

http://www.mtasa.com/potd/15/mta-screen0042.png

http://www.mtasa.com/potd/15/1mta-screen0022.png

Now my questions:

[1] whats called the full script to create new objects (not cars!)?

[2] it is possibly to create the new models with a own ID like 9999999 ? because i dont want to replace a object in san andreas ;)

[3] can i have the southpark models or the race track?

Link to comment
hi, i have a question :wink:

first, look at these pictures

http://www.mtasa.com/potd/15/mta-screen0042.png

http://www.mtasa.com/potd/15/1mta-screen0022.png

Now my questions:

[1] whats called the full script to create new objects (not cars!)?

[2] it is possibly to create the new models with a own ID like 9999999 ? because i dont want to replace a object in san andreas ;)

[3] can i have the southpark models or the race track?

Put up this script somewhere! upload plz :)

------------------------------

I do not speak in English!

Link to comment
hi, i have a question :wink:

first, look at these pictures

http://www.mtasa.com/potd/15/mta-screen0042.png

http://www.mtasa.com/potd/15/1mta-screen0022.png

Now my questions:

[1] whats called the full script to create new objects (not cars!)?

[2] it is possibly to create the new models with a own ID like 9999999 ? because i dont want to replace a object in san andreas ;)

[3] can i have the southpark models or the race track?

Put up this script somewhere! upload plz :)

------------------------------

I do not speak in English!

He's asking questions not showing a script.

1. Can't remember this one.

2. As far as I know; no, it is not possible to add new object to game with its own ID. In SP it was quite possible.

3. If you show us your screenshots I guess you have them.

BTW, I can't get texture to be loaded, don't know what may be wrong.

Here are my screenshot and rendered object how it should look like:

http://img88.imageshack.us/img88/1824/m ... 001xb4.png

http://img182.imageshack.us/img182/5512/renderfc3.png

Link to comment

3. If you show us your screenshots I guess you have them.

lol this is not a model from me ;) its from the Picture of the Day on MTASA.com

BTW, I can't get texture to be loaded, don't know what may be wrong.

Here are my screenshot and rendered object how it should look like:

http://img88.imageshack.us/img88/1824/m ... 001xb4.png

http://img182.imageshack.us/img182/5512/renderfc3.png

50p can you pleas tell me waht script you used to load this models?

Link to comment

3. If you show us your screenshots I guess you have them.

lol this is not a model from me ;) its from the Picture of the Day on MTASA.com

pwned, forgot about them! There ware so many screenshots that I can't remember them all, lol.

BTW, I can't get texture to be loaded, don't know what may be wrong.

Here are my screenshot and rendered object how it should look like:

http://img88.imageshack.us/img88/1824/m ... 001xb4.png

http://img182.imageshack.us/img182/5512/renderfc3.png

50p can you pleas tell me waht script you used to load this models?

I used my own simple script.

Placed it in a function and added to event: onClientResourceStart (obviously it is client-sided script)

  
    dff = engineLoadDFF( "map/box.dff", 2918 ) 
    engineReplaceModel( dff, 2918 ) 
    txd = engineLoadTXD( "map/box.txd", 2918 ) 
    engineImportTXD( txd, 2918 ) 
  

Then just used command to create object '2918' (I can't remember which resource has that command).

Col file is not required in my objects, because I attach it to the object itself.

Link to comment

Try this:

function replaceTheObjs() 
     dff = engineLoadDFF( "map/box.dff", 2918 ) 
    engineReplaceModel( dff, 2918 ) 
    txd = engineLoadTXD( "map/box.txd", 2918 ) 
    engineImportTXD( txd, 2918 ) 
  
    createObject( 2918, 0,0,3 ) 
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), replaceTheObjs ) 

It is client-sided script. It should replace the object 2918 and load its texture, then create the object at given co-ords (when resource starts). You can do it in onPlayerConnect, but don't create object then, since you'd create lots of objects at the same place, causing slowing down all connected PCs.

Link to comment

Well, i got some info and code, but i won't post it atm,

it's long and bug-full, hopefully bugs will be fixed in future releases.

(Please don't ask me for that piece of code via pm or in any other way, we should wait for next release).

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