Inside3D!
     

getting centerprint to player when they aren't activator

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
rj



Joined: 03 Jul 2008
Posts: 5

PostPosted: Sun Feb 14, 2010 9:55 pm    Post subject: getting centerprint to player when they aren't activator Reply with quote

this should be really simple but i'm failing and wondered if anyone here could offer a tidbit of advice.

i want a centerprint message sequence to play to the player via various trigger_relays. the only problem is that it's activated by a bot triggering its own special entity, so messages won't display due to this section in SUB_UseTargets:

Code:

   if (activator.classname == "player" && self.message != "")
   {
      centerprint (activator, self.message);
      if (!self.noise)
         sound (activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
   }


i'm trying to modify it so regardless of the activator, the centerprint will always show to the player (or any player in the game, if it's a coop match)

any ideas?

thanks in advance Smile
Back to top
View user's profile Send private message
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Mon Feb 15, 2010 12:53 am    Post subject: Reply with quote

Code:

local entity ent;

if (self.message != "")
{
    ent = find(world, classname, "player");
    while (ent != world)
    {
        centerprint(ent, self.message);
        if (!self.noise)
            sound(ent, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
        ent = find(ent, classname, "player");
    }
}

_________________
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Back to top
View user's profile Send private message
rj



Joined: 03 Jul 2008
Posts: 5

PostPosted: Mon Feb 15, 2010 7:26 pm    Post subject: Reply with quote

legend Very Happy

i was barking up the wrong tree trying to use checkclient but that looks a lot cleaner. should be useful for displaying messages triggered by monsters too when they get killed by something other than the player

cheers Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2004 phpBB Group