Jump to content

Loop throught all entities on loaded map :


YouGroove
 Share

Recommended Posts

I don't understand very well your example.

And i don't want callback.

 

In fact i place NPC characters entities in the editor.

And loading the map by code, i would need to find where are the entities placed in the level in the editor, and drive them by code in C++.

 

like

 

LoadMap init () {

 

-> load map

 

TableEntities = find All Entites characters on loaded Map

 

}

 

Load Map loop {

 

For each Entity on table (){

 

entity.update();

 

}

 

I mean more simple code, and just managing entities on a loaded map on some array or table.

Stop toying and make games

Link to comment
Share on other sites

You have to use a callback at this time to loop over the entities loaded in your map. This callback is fired each entity when you call Map:Load. You can then process them in the callback or store them in an array/list and loop over them at a later time.

 

Your other option is to use the individual entity scripts attached to each entity and handle all your game logic there.

Link to comment
Share on other sites

Ok i found by reading again the tutorial comments.

 

You need to attach some empty script even for models to have them finded in the Map at loading.

And it's to you to manage to load them by their name, they won't be loaded with map loading.

 

Other engines load the models you have placed, why LE3 don't do that sad.png

 

I can't imagine the workflow, having to do that for 20 different characters you have to place.

You will need to create them by code by their name, and on editor each time not forget to attach some script at level creation.

 

Let's hope LE3 to grow up instead on relying on LE2 system too much.

Stop toying and make games

Link to comment
Share on other sites

You only need to use that workaround for CSG Level Geometry that you want to access in code.

All other entities are accessible straight away.

 

Also nothing against Ricks tutorial but the save and load tutorial by Aggror is a bit more complete in that part. including a full list of all entities in your map.

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