Results 1 to 3 of 3

Thread: Creating Entity on different map

  1. #1

    Default Creating Entity on different map

    CreateEntity(Map:test(), Vector2( 900, 560 ), "weapons/dagger/daggerI.lua");

    im trying to create an entity with the script daggerI.lua on map test but the code above isnt working....i dont know why, any help?

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002


    Hmm, what is Map:test()? I don't think you can do it that way..

    Instead, try this:

    //first, remember the currently active map so we can switch back to it
    originalMapName = nill
    if (GetMapManager:GetActiveMap() != nil) then
         originalMapName = GetMapManager:GetActiveMap():GetName();
    GetMapManager:SetActiveMapByName("Test"); //Assuming test is the name of the map
    CreateEntity(GetMapManager:GetActiveMap(), Vector2( 900, 560 ), "weapons/dagger/daggerI.lua");
    //now switch back if we can
    if (originalMapName != nil) then
    Untested code above, may have errors.

    I'm kind of puzzled why I don't have a GetMapManager:GetMapByName("test") function. Strange, but this work around should do it.
    Seth A. Robinson
    Robinson Technologies

  3. #3

    Default Thanks

    thanks that works but i also found another way around it, instead i put an invisible entity on the map and named it something like "test" then i used the code...

    ent = GetEntityByName("test");
    CreateEntity(ent:GetMap(), Vector2( 375, 75 ), "weapons/dagger/daggerI.lua");
    so it looks for that entity, gets the map that entity is one and then creates the entity i wanted it to there, and it seems to be working fine for now :P

Similar Threads

  1. Creating my own image provider.
    By lilezek in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 06-20-2011, 01:43 PM
  2. Creating CL_Colorf in clanlib 0.9
    By rombust in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 07-14-2008, 07:31 AM
  3. creating exe files
    By attle in forum Novashell Game Creation System
    Replies: 2
    Last Post: 02-04-2008, 09:36 AM
  4. Creating add-ons for games and NovaShell?
    By whisperstorm in forum Novashell Game Creation System
    Replies: 2
    Last Post: 11-28-2006, 12:45 AM
  5. Creating TGA files...
    By Akolade in forum RTsoft Tavern
    Replies: 3
    Last Post: 02-20-2003, 04:31 PM



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts