Jump to content
  • 0
Sign in to follow this  
bWolfie

Forcing emotes from other NPCs?

Question

Hi,

 

I am struggling to get my script to force an emotion from an NPC from another script. 

 

Bit of info:

- Both NPCs are on the same map.

- Player cannot see both NPCs at the same time on their screen (too far apart).

- NPC 1 (who you are talking to) warps you in front of NPC 2, who talks a bit then responds with emotions.

 

What is wrong with this? Thank you in advance for any help.

 

prontera,100,100,5    script    NPC1    53,{
  mes "[NPC1]";
  mes "I am now warping you to NPC2";
  next;
  warp "prontera",150,150,0;
  mes "[NPC1];
  mes "This is NPC2. Say hello to the player, NPC2.";
  set .@emote, e_paper;
  next;
  donpcevent "NPC2::OnEmote";
  //Conversation 'mes' continues from here
 
//At the bottom of NPC1's script (but still inside it)
OnEmote:
  emotion .@emote;
  end;
}

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

OnEmote label should be put in NPC2, because you invoke donpcevent "NPC2::OnEmote";
 

 

*donpcevent "<NPC object name>::<event label>";

This command invokes the event label code within an another NPC or NPCs. 
It starts a separate instance of execution, and the invoking NPC will 
resume execution its immediately.

If the supplied event label has the form "NpcName::OnLabel", then only 
given NPC's event label will be invoked (much like 'goto' into another 
NPC). If the form is "::OnLabel" (NPC name omitted), the event code of all 
NPCs with given label will be invoked, one after another. In both cases 
the invoked script will run without an attached RID, whether or not the 
invoking script was attached to a player. The event label name is required 
to start with "On".

This command can be used to make other NPCs act, as if they were 
responding to the invoking NPC's actions, such as using an emotion or 
talking.

	place,100,100,1%TAB%script%TAB%NPC%TABS,{
		mes "Hey NPC2 copy what I do";
		close2;
		@emote = rand(1,30);
		donpcevent "NPC2::OnEmote";
	OnEmote:
		emotion @emote;
		end;
	}

	place,102,100,1%TAB%script%TAB%NPC2%TABS,{
		mes "Hey NPC copy what I do";
		close2;
		@emote = rand(1,30);
		donpcevent "NPC::OnEmote";
	OnEmote:
		emotion @emote;
		end;
	}

Whichever of the both NPCs is talked to, both will show a random emotion 
at the same time. 

Command returns 1 or 0 on success and failure.
A debug message also shows on the console when no events are triggered.

 

 

 

In docs there OnEmote label in first NPC because second NPC2 invokes it.

Edited by kenik

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.