Make ALL specific spawns talk

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
User avatar
HappyLDE
Posts: 123
Joined: Tue Sep 10, 2013 6:22 pm
Location: Belgium
Contact:

Make ALL specific spawns talk

Post 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"));
Thank you for making L2JServer happen! :D
"If you believe you will fail or succeed, in both ways you are right." - Henry Ford
User avatar
Zealar
L2j Veteran
L2j Veteran
Posts: 1236
Joined: Sun Jul 15, 2007 10:29 am

Re: Make ALL specific spawns talk

Post by Zealar »

You want that npc to say "Thank you" only when he spawn?
User avatar
HappyLDE
Posts: 123
Joined: Tue Sep 10, 2013 6:22 pm
Location: Belgium
Contact:

Re: Make ALL specific spawns talk

Post 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!"));                    }
Thank you for making L2JServer happen! :D
"If you believe you will fail or succeed, in both ways you are right." - Henry Ford
Post Reply