Data Realms Fan Forums

CreateActor ID Problem (ID 255)(Solved)
Page 1 of 1

Author:  phezel [ Wed Oct 08, 2014 5:42 pm ]
Post subject:  CreateActor ID Problem (ID 255)(Solved)

Hello everyone, I'm having a problem with the CreateActor function, when I create an actor it spawns with ID 255.
This is no problem if it's only one actor, because I use it to spawn a cursor and I destroy it when not used. Each player can only have one cursor at the time.
But when there is two or more players and both of them try to use the cursor, the two cursors have the ID 255. This is a problem to identify each one.
I'm doing something wrong? How can I give them different IDs?

Here is the code I'm using:

   actor.cursor = CreateActor("Phezel Cursor");
   actor.cursor.Pos = actor.Pos;
   actor.cursor.Team = actor.Team;
   actor.parentplayer = actor:GetController().Player;
   ActivityMan:GetActivity():SwitchToActor(actor.cursor, actor:GetController().Player,actor.Team);
   actor:SetControllerMode(Controller.CIM_DISABLED, -1);

Thanks in advance.

Author:  clunatic [ Wed Oct 08, 2014 7:48 pm ]
Post subject:  Re: CreateActor ID Problem

moID 255 is reserved for MOs that have HitsMOs and/or GetsHitByMOs set to 0 (I can never remember which it is). There are a couple of ways to get around it.

you can:

-check the presetname + team instead of the ID to find the right actors. (this should work fine, as long as only 1 actor per team is spawned)
-make an actor using the null.bmp sprite with HitsMOs and GetsHitByMOs set to 1 and then just attached an object with the cursor sprite and HitsMOs and GetsHitByMOs set to 0. (this should assign a unique ID to the actor that you can use, in theory at least)
-use the UniqueID property. (I have no idea if this actually works with MOs with the 255 id.)

some experimentation required.

Or you could just set the actors HitsMOs and/or GetsHitByMOs to 1, but I'm assuming that's not practical for the purpose of making a cursor.

Author:  phezel [ Wed Oct 08, 2014 8:02 pm ]
Post subject:  Re: CreateActor ID Problem

Thanks clunatic, I will try the UniqueID property and post how it went.

Author:  phezel [ Thu Oct 09, 2014 6:07 pm ]
Post subject:  Re: CreateActor ID Problem

It worked perfectly, this also helped me a lot with a mod I'm making, thanks clunatic.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group