Page 1 of 1

Make ALL specific spawns talk

Posted: Sat Nov 08, 2014 4:09 pm
by HappyLDE
I have a vote manager with the id 11050 with the following script:

Code: Select all

 public final class VoteManager extends AbstractNpcAI implements IVoicedCommandHandler{..VoteManager(){        super(VoteManager.class.getSimpleName(), VoteManager.class.getSimpleName());..        addFirstTalkId(11050);        addTalkId(11050);        addStartNpc(11050);    }..} 
Then in each town i spawn 11050 npc. How to find spawn to make them say something like thank you with the following code?

Code: Select all

Broadcast.toKnownPlayers(spawn, new NpcSay(spawn.getObjectId(), 0, 13098, "Thank you"));

Re: Make ALL specific spawns talk

Posted: Sat Nov 08, 2014 4:58 pm
by Zealar
You want that npc to say "Thank you" only when he spawn?

Re: Make ALL specific spawns talk

Posted: Sat Nov 08, 2014 11:52 pm
by HappyLDE
I want all the npcs of id 11050 (that are using my VoteManager script) to say Thank you %player_name for voting! at the time a player votes.

Edit: A workaround for now is this (and only the npc the player is talking to will say "Thank you")

Code: Select all

if (player.getTarget() != null && !player.getTarget().isPlayable() && player.getTarget() instanceof L2Character)                    {                        L2Character voteManagerNpc = (L2Character)player.getTarget();                                                Broadcast.toKnownPlayers(voteManagerNpc, new NpcSay(voteManagerNpc.getObjectId(), 0, 11050, "Thank you " + player.getName() + " for voting!"));                    }