Jump to content

editor - doCreateElement


H5N1

Recommended Posts

Hello. Im making plugin to editor which will help with creating DD maps. But I have a problem. I dont know how editor's function 'doCreateElement' works. Arguments are really weird. When i use it my MTA crashes or no object is creating. Please explain this for me, how to use it.

Edited by Guest
Link to comment
function doCreateElement ( elementType, resourceName, creationParameters, attachLater, shortcut ) 

- elementType - the type of the element you want to create (for example "racepickup")

- resourceName - the name of the resource the edf you want to use (for example "race")

- creationParameters - table containing the element properties (for example creationParameters = {position = {0, 0, 0}, type="nitro"}) - i think it's optional

- attachLater - idk... it can be true or false, i think it's optional

- shortcut - idk, i think it's optional

Link to comment

I make this:

exports.editor_main:doCreateElement("object", "toolbox", { model = obecneID, position = {objPoz[1], objPoz[2], objPoz[3]}}, false, nil) 

And my MTA crashes

Roller coaster generator have this:

triggerEvent("doCreateElement", gRootElement, "object", getResourceName(editor_main.resource), { model = 18450, position = position }, false, nil) 

Link to comment
I could help you, but looking at the fact that you're just trying to rip off every functionality of something I've made, including the name, I won't.

Lol, H5N1's toolbox is work name, just like project natal for kinect and NGP for psp2 o0. Every functionality suggested my friends, not your resource.

Link to comment
I could help you, but looking at the fact that you're just trying to rip off every functionality of something I've made, including the name, I won't.

Lol, H5N1's toolbox is work name, just like project natal for kinect and NGP for psp2 o0. Every functionality suggested my friends, not your resource.

Yes, sure.

Link to comment
You can use createObject if I'm not wrong..?

why the hell he would try to use some weird exported funcion, if he just could use createObject?

createObject will not create a entry in a map file, that could be saved in map editor...

@H5N1 do your resource has an EDF file? or do you simply want to create a default obiect?

try "editor_main" instead of "toolbox"

Link to comment

My resource dont have EDF. I will try it.

Edit - it works! But how to set object rotation? When I make this

exports.editor_main:doCreateElement("object", "editor_main", {model = obecneID, position = objPoz, rotation = objRot}, false, false) 

It doesnt work (no objects are creating).

Edit - It works Thanks for help!

Link to comment

I have another problem. Objects which my script creates dont save with cords.

<map edf:definitions="editor_main"> 
    <object id="object (plasticsgate1) (1)" doublesided="false" model="7657" interior="0" dimension="0" posX="3233.4709472656" posY="-1599.8585205078" posZ="6.6665945053101" rotX="270" rotY="0" rotZ="0" /> 
    <object id="object (plasticsgate1) (2)" doublesided="false" model="7657" interior="0" dimension="0" /> 
    <object id="object (plasticsgate1) (3)" doublesided="false" model="7657" interior="0" dimension="0" /> 
    <object id="object (plasticsgate1) (4)" doublesided="false" model="7657" interior="0" dimension="0" /> 

I must click on the object, then object which i clicked will be save with cords. I dont know how to fix this because doCreateElement doesnt return object info (userdata:xxxx).

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