Jump to content
tipforeveryone

How to get a Collection of entities in map by Cpp?

Recommended Posts

I put some Pivots in Editor around my map and attach a script to each of them, here is the script

function Script:Start()
  self.entity:SetKeyValue("type","spawnPosition")
end

In spawn.php

//#include <iostream> was on top
//#include <list> was on top

std::list<Entity> spawnPosition;

for (int x = 0; x < world->CountEntities(); x++)
{
  Entity* entity = world->GetEntity(x);
  if (entity->GetKeyValue("type") == "spawnPosition")
  {
    spawnPosition.push_back(entity);
  }
}

and I got this error

Severity    Code    Description    Project    File    Line    Suppression State
Error    C2664    'void std::list<int,std::allocator<_Ty>>::push_back(const _Ty &)': cannot convert argument 1 from 'Leadwerks::Entity *' to '_Ty &&'    CSCDVMP    d:\google drive\w3ateam\game development\cscdvmp\projects\windows\playerclass.cpp    160    
 

what is the right way?

  • Sad 1

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...