smashthewindow Posted September 21, 2011 Share Posted September 21, 2011 As the title, how would I be able to add new entities? I've seen into gamelib example of scene loading and it loads some keys from entities such as class name and so, where would I set this? Quote Blog & Portfolio Current project: moon.chase.star Link to comment Share on other sites More sharing options...
macklebee Posted September 21, 2011 Share Posted September 21, 2011 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... Quote 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 More sharing options...
smashthewindow Posted September 21, 2011 Author Share Posted September 21, 2011 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? Quote Blog & Portfolio Current project: moon.chase.star Link to comment Share on other sites More sharing options...
Canardia Posted September 21, 2011 Share Posted September 21, 2011 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 Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
paramecij Posted September 21, 2011 Share Posted September 21, 2011 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 Quote Link to comment Share on other sites More sharing options...
smashthewindow Posted September 21, 2011 Author Share Posted September 21, 2011 All of your answers have been a big help. Thanks a lot guys, got exactly what I wanted to work. Quote Blog & Portfolio Current project: moon.chase.star Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted September 22, 2011 Share Posted September 22, 2011 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... --Mike Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.