View unanswered posts | View active topics It is currently Sat Oct 19, 2019 6:41 pm



Reply to topic  [ 4 posts ] 
 CreateActor ID Problem (ID 255)(Solved) 
Author Message

Joined: Thu Sep 11, 2014 5:37 pm
Posts: 16
Reply with quote
Post 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:
Code:

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


Thanks in advance.


Last edited by phezel on Thu Oct 09, 2014 8:26 pm, edited 1 time in total.



Wed Oct 08, 2014 5:42 pm
Profile

Joined: Fri Nov 23, 2012 5:42 am
Posts: 143
Reply with quote
Post 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.


Last edited by clunatic on Wed Oct 08, 2014 8:29 pm, edited 1 time in total.



Wed Oct 08, 2014 7:48 pm
Profile

Joined: Thu Sep 11, 2014 5:37 pm
Posts: 16
Reply with quote
Post Re: CreateActor ID Problem
Thanks clunatic, I will try the UniqueID property and post how it went.


Wed Oct 08, 2014 8:02 pm
Profile

Joined: Thu Sep 11, 2014 5:37 pm
Posts: 16
Reply with quote
Post Re: CreateActor ID Problem
It worked perfectly, this also helped me a lot with a mod I'm making, thanks clunatic.


Thu Oct 09, 2014 6:07 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.016s | 15 Queries | GZIP : Off ]