Jump to content

Adding entities to the Leadwerks editor


smashthewindow
 Share

Recommended Posts

in the editor's asset list on the right, you have the models available to drag into a scene... if you double click on the model icon in the list it will open the script editor and the model's lua script... this is where you can add properties... look at the standard models that come with the SDK to see what is in their object scripts to see how this is accomplished...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

in the editor's asset list on the right, you have the models available to drag into a scene... if you double click on the model icon in the list it will open the script editor and the model's lua script... this is where you can add properties... look at the standard models that come with the SDK to see what is in their object scripts to see how this is accomplished...

 

thanks for the reply

I've been looking at the point light's LUA example and trying to find "light_point" string(which is it's class name). But there isn't on the LUA file.

Help?

Blog & Portfolio

 

Current project: moon.chase.star

Link to comment
Share on other sites

The mess with the entitykeys: name, class, model, classname, has been always horrible, because they used to change from one engine version to another.

I just hope it stays like it is now:

1) name = the name of the entity (can be anything you want, like Joe, John, Josh, Player1, Enemy1, Hummer, etc...)

2) class = the entitytype of the entity (mesh, light, corona, etc...)

3) collisiontype = the collisiontype (can be mistaken as entitytype, so I think using class and collisiontype is better, like it is now)

GameLib used to use classname, because it was used first by the engine for additional type designation of entities, but then it got lost somewhere after LE 1.15 or so.

GameLib has been still using it, hoping that it will come back some day, but it never did.

Now I decided to rename it to type, because class is already taken by the engine, and looking at the Wikipedia for typology, the term type actually sounds logical.

So with the next gamelib release, type will designate what kind/type an entity is, for example: weapon, player, enemy, car, etc....

It should be easy to remember.

All models need the one additional line in their lua script which adds the type string input for Editor.

This is easy to add, for example if you have a new model with no Lua script at all yet, the whole Lua script would look like this:

require("scripts/class")

local class=CreateClass(...)

function class:InitDialog(grid)
local group
self.super:InitDialog(grid)
group=grid:FindGroup("General")
group:AddProperty("Type",PROPERTY_STRING)
end

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

What about setting entity keys that are readable in code? (using LoadModel() no LoadScene() )

 

Would something like this work?:

require("scripts/class")
local class=CreateClass(...)

function class:CreateObject(model)
local object=self.super:CreateObject(model)
selt.object:SetKey( "Type", "weapon" )  // or self.model or self.super ?? .. when do you use what exactly ?
end

Link to comment
Share on other sites

Guest Red Ocktober

paramecij...

 

selt.object:SetKey( "Type", "weapon" )  // or self.model or self.super ?? .. when do you use what exactly ?

you'd get an error message at this line when you tried to compile or execute your code above...

 

selt not defined... :)

 

:D

 

--Mike

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...