Forum

getting centerprint to player when they aren't activator

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

getting centerprint to player when they aren't activator

Postby rj » Sun Feb 14, 2010 9:55 pm

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: Select all
   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 :)
rj
 
Posts: 5
Joined: Thu Jul 03, 2008 9:23 pm

Postby Sajt » Mon Feb 15, 2010 12:53 am

Code: Select all
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.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby rj » Mon Feb 15, 2010 7:26 pm

legend :D

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 :)
rj
 
Posts: 5
Joined: Thu Jul 03, 2008 9:23 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest