From The Mana World
< User:Wombat
Revision as of 00:26, 21 October 2009 by Wombat (talk | contribs) (NPC scripting tutorial started)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Here are some basic NPCs that can be used as templates and to learn scripting with. While they use the botcheck map, that is mainly for testing purposes.

Guy

Guy is an NPC you can use for giving information to characters when they question it.

//

botcheck.gat,13,18,0 script Guy	102,{
	mes "[Guy]";
	mes "\"I'm just talking.\"";
	next;
	menu "Good",L_Good,"Bad",L_Bad,"Go on..",L_Goon;
	
L_Good:
	mes "[Guy]";
	mes "\"You selected good.  Good for you!\"";
	close;
	
L_Bad:
	mes "[Guy]";
	mes "\"You selected bad.  You suck!\"";
	close;
	
L_Goon:
	mes "[Guy]";
	mes "\"I'm going to talk for a little bit since you wanted me to go on.\"";
	next;
	mes "[Guy]";
	mes "\"Here I am talking for a second time.  That is if I did this right :D\"";
	next;
	mes "[Guy]";
	mes "\"Here I am talking a third time.  I am running my mouth today!\"";
	close;
}

Dude

This NPC communicates with the NPC "Someone", another NPC. Changing the script can make this a basic message sent and received quest.

//

botcheck.gat,14,19,0	script	Dude	102,{
    if (Dude == 1) goto L_Dude_Notdone;
    if (Dude == 2) goto L_Dude_Done;
    if (Dude == 3) goto L_Dude_Again;
	mes "[Dude]";
    mes "\"Hey, I'm wanting to talk to Someone.\"";
    next;
    menu 
        "I'll talk to him.", L_Talk,
        "I won't talk to him.", L_Notalk;
    close;
    
L_Talk:
    set Dude, 1;
    mes "[Dude]";
    mes "\"Thanks.\"";
    close;
    
L_Notalk:
    mes "[Dude]";
    mes "\"Whatever.\"";
    close;
    
L_Dude_Notdone:
    mes "[Dude]";
    mes "\"I thought you were going to talk to Someone for me!\"";  
	next;
	mes "\"Please do.\"";
    close;
    
L_Dude_Done:
    set Dude, 3;
    mes "[Dude]";
    mes "\"Did you talk to him?\"";
	menu "I did.", -;
    mes "\"Awesome!\"";
    close;
    
L_Dude_Again:
    mes "[Dude]";
    mes "\"Good to see you again!\"";
    close;
}

Someone

//

botcheck.gat,15,20,0 script Someone 102, {
    if (Dude == 1) goto L_Talktodude;
    mes "[Someone]";
    mes "\"Hi there!\"";
    close;
    
L_Talktodude:
    set Dude, 2;
    mes "[Someone]";
    mes "\"You talked to me for Dude.\"";
    close;
}