I want to help contribute.

Content and general development discussion, including quest scripts and server code. TMW Classic is a project comprising the Legacy tmwAthena server & the designated improved engine server based on evolHercules.


Forum rules

This forum houses many years of development, tracing back to some of the earliest posts that exist on the board.

Its current use is for the continued development of the server and game it has always served: TMW Classic.

User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

Re: I want to help contribute.

Post by o11c »

Where you put the actual file is unimportant, as long as you supply the appropriate path to 'git am'; afterwards you will be working on the version in your git tree.

Hint: use 'git status' a lot (possibly after every command, if you like checking your sanity), and 'git diff' and 'git diff --cached' quite a bit, too.
Former programmer for the TMWA server.
User avatar
Immune
Peon
Peon
Posts: 36
Joined: 16 Dec 2011, 04:09

Re: I want to help contribute.

Post by Immune »

I don't know how I can help. The file looks complicated and I don't understand it. Even with your notes. Do you have a tutorial on what some of the things in the file mean?
Image
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: 25 Aug 2005, 16:08
Location: Germany

Re: I want to help contribute.

Post by Crush »

The file o11c gave you is a "patch" file. That's a format to exchange changes at text files. Lines with "-" in front are removed lines, lines with "+" at the front are added lines. I also don't know how o11c gets the idea that a total newbie at scripting could not just understand that (because its pretty advanced scripting) but also make suggestions how to improve it (refactoring).


I think you should start with some easier practices so you get a feeling for scripting. Like creating a simple "Hello world" NPC. You could use eathena-data/npc/002-1_Sandstorm/nomads.txt as an example.
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
User avatar
Immune
Peon
Peon
Posts: 36
Joined: 16 Dec 2011, 04:09

Re: I want to help contribute.

Post by Immune »

Thank you crush. I think this is the file you were talking about. Do you mind explaining the code in parts and how they work?

Code: Select all

//

002-1.gat,15,67,0|script|Samuel|132,{
    mes "[Samuel the Nomad]";
    mes "\"This is really a nice place.\"";
    mes "Don't you think so?\"";
    close;
}

002-1.gat,18,68,0|script|Elijah|128,{
    mes "[Elijah the Nomad]";
    mes "\"If I only had a tent...\"";
    close;
}
Image
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: 25 Aug 2005, 16:08
Location: Germany

Re: I want to help contribute.

Post by Crush »

Immune wrote:Thank you crush. I think this is the file you were talking about. Do you mind explaining the code in parts and how they work?
The first line is about where and how to show the NPC.

002-1.gat: This NPC is on map "002-1"
15,67: The position of the NPC on the map. It stands 15 tiles away from the left map border and 67 tiles away from the upper map border.
,0: The direction the NPC is facing - irrelevant in most cases, because all our NPCs have no other sprites than forward-looking.
script: self-explaining
Samuel: Name displayed beneath the NPC on the map
132: Sprite of the NPC. See the files npcs.xml of the client data for information which ID is assigned to which graphic.

Then the script code itself begins

{ Here begins the script code which is executed when a player talks to the NPC.
mes "Text"; Show this text in the dialog box.
close; wait for the user to click "next" and then close the NPC box.
} Script code of NPC ends here.
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
User avatar
Immune
Peon
Peon
Posts: 36
Joined: 16 Dec 2011, 04:09

Re: I want to help contribute.

Post by Immune »

Ok This is what I came up with.

Code: Select all

//

002-1.gat,15,67,0|script|Samuel|132,{
    mes "[Samuel the Nomad]";
    mes "\"This is really a nice place.\"";
    mes "Don't you think so?\"";
    close;
}

002-1.gat,18,68,0|script|Elijah|128,{
    mes "[Elijah the Nomad]";
    mes "\"If I only had a tent...\"";
    close;
}

002-1.gat,17,63,0|script|Test|132,{
    mes "[Test]";
    mes "Hello world";
close;
}
http://imagebin.org/189338

Edit: I see that I can change the NPC image by chosing an ID from the discription in the npc.xml as you pointed out.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!--
    This file maps the NPC appearance IDs the server is sending to the spritesheet(s).

    Note that it is possible to give an NPC multiple sprites. In this case the
    sprites are drawn in order of declaration.

    IDs 100-199 should be used for unanimated NPCs (100 is added for 0.0 client compatibility)
-->
<npcs>
<npc id="48"><sprite variant="61">npcs/npc.xml</sprite></npc><!-- Storage Master -->
<npc id="49"><sprite variant="49">npcs/npc.xml</sprite></npc><!-- Storage Master (desert) -->

<npc id="100"><sprite variant="0">npcs/npc.xml</sprite></npc><!-- Desert Barber -->
<npc id="101"><sprite variant="1">npcs/npc.xml</sprite></npc><!-- Oriental trader -->
<npc id="102"><sprite variant="2">npcs/npc.xml</sprite></npc><!-- The Trainer -->
<npc id="103"><sprite variant="3">npcs/npc.xml</sprite></npc><!-- Guy in black cloak -->
<npc id="104"><sprite variant="4">npcs/npc.xml</sprite></npc><!-- Soldier with sword -->
<npc id="105"><sprite variant="5">npcs/npc.xml</sprite></npc><!-- Santa Clause -->
<npc id="106"><sprite variant="6">npcs/npc.xml</sprite></npc><!-- Girl with pink hair and blue top -->
<npc id="107"><sprite variant="7">npcs/npc.xml</sprite></npc><!-- Scholar guy with glasses -->
<npc id="108"><sprite variant="8">npcs/npc.xml</sprite></npc><!-- Woman with green hair and pink dress -->
<npc id="109"><sprite variant="9">npcs/npc.xml</sprite></npc><!-- Miner -->
<npc id="110"><sprite variant="10">npcs/npc.xml</sprite></npc><!-- Soldier with spear -->
<npc id="111"><sprite variant="11">npcs/npc.xml</sprite></npc><!-- Treasure chest -->
<npc id="112"><sprite variant="12">npcs/npc.xml</sprite></npc><!-- Barkeeper -->
<npc id="113"><sprite variant="13">npcs/npc.xml</sprite></npc><!-- Gnome with hat -->
<npc id="114"><sprite variant="14">npcs/npc.xml</sprite></npc><!-- Little blue-haired girl -->
<npc id="115"><sprite variant="15">npcs/npc.xml</sprite></npc><!-- Guy with red hair and green cloak -->
<npc id="116"><sprite variant="16">npcs/npc.xml</sprite></npc><!-- Old geezer -->
<npc id="117"><sprite variant="17">npcs/npc.xml</sprite></npc><!-- Boy with brown hair -->
<npc id="118"><sprite variant="18">npcs/npc.xml</sprite></npc><!-- Nurse without hat -->
<npc id="119"><sprite variant="19">npcs/npc.xml</sprite></npc><!-- Nurse with hat -->
<npc id="120"><sprite variant="20">npcs/npc.xml</sprite></npc><!-- Guy with brown hair in plain clothes -->
<npc id="121"><sprite variant="21">npcs/npc.xml</sprite></npc><!-- Soldier -->
<npc id="122"><sprite variant="22">npcs/npc.xml</sprite></npc><!-- Soldier with sword and shield -->
<npc id="123"><sprite variant="23">npcs/npc.xml</sprite></npc><!-- Soldier with sword, shield, and helmet -->
<npc id="124"><sprite variant="24">npcs/npc.xml</sprite></npc><!-- Guy with black hair in plain clothes -->
<npc id="125"><sprite variant="25">npcs/npc.xml</sprite></npc><!-- Guy with black clothes -->
<npc id="126"><sprite variant="26">npcs/npc.xml</sprite></npc><!-- Guy with black clothes and axe -->
<npc id="127"><sprite variant="27">npcs/npc.xml</sprite></npc><!-- empty (Invisible NPC) -->
<npc id="128"><sprite variant="28">npcs/npc.xml</sprite></npc><!-- Nomad, standing -->
<npc id="129"><sprite variant="29">npcs/npc.xml</sprite></npc><!-- Snowman -->
<npc id="130"><sprite variant="30">npcs/npc.xml</sprite></npc><!-- Paperboy (wtf? how does this one fit in a fantasy game?) -->
<npc id="131"><sprite variant="31">npcs/npc.xml</sprite></npc><!-- Nomad, sitting -->
<npc id="132"><sprite variant="32">npcs/npc.xml</sprite><particlefx>graphics/particles/nomadpipe.particle.xml</particlefx></npc><!-- Nomad, sitting with pipe -->
<npc id="133"><sprite variant="33">npcs/npc.xml</sprite></npc><!-- Captain Kirk -->
<npc id="134"><sprite variant="34">npcs/npc.xml</sprite></npc><!-- Mr. Spock -->
<npc id="135"><sprite variant="35">npcs/npc.xml</sprite></npc><!-- Guy with sword over shoulder -->
<npc id="136"><sprite>npcs/npc-creepysurgeon.xml</sprite></npc><!-- Creepy surgeon guy -->
<npc id="137"><sprite variant="37">npcs/npc.xml</sprite></npc><!-- Metrosexual guy with pink jacket on stool -->
<npc id="138"><sprite variant="38">npcs/npc.xml</sprite></npc><!-- Zombie pirate captain-->
<npc id="139"><sprite variant="39">npcs/npc.xml</sprite></npc><!-- Girl in playboy bunny costume -->
<npc id="140"><sprite variant="40">npcs/npc.xml</sprite></npc><!-- Woman with green dress and apron -->
<npc id="141"><sprite>npcs/npc-lumberjack.xml</sprite></npc><!-- Lumberjack -->
<npc id="142"><sprite variant="42">npcs/npc.xml</sprite></npc><!-- Farmer -->
<npc id="143"><sprite variant="43">npcs/npc.xml</sprite></npc><!-- Indian Chief-->
<npc id="144"><sprite variant="44">npcs/npc.xml</sprite><particlefx>graphics/particles/soulmenhir.particle.xml</particlefx></npc><!-- Boulder -->
<npc id="145"><sprite variant="45">npcs/npc.xml</sprite></npc><!-- Magic mouth -->
<npc id="146"><sprite variant="46">npcs/npc.xml</sprite></npc><!-- Mechanic -->
<npc id="147"><sprite variant="47">npcs/npc.xml</sprite></npc><!-- Mechanic with tool -->
<npc id="148"><sprite variant="48">npcs/npc.xml</sprite></npc><!-- Chef -->
<npc id="149"><sprite variant="49">npcs/npc.xml</sprite></npc><!-- Desert Banker -->
<npc id="150"><sprite variant="50">npcs/npc.xml</sprite></npc><!-- Investigator -->
<npc id="151"><sprite variant="51">npcs/npc.xml</sprite></npc><!-- Lora Tay -->
<npc id="152"><sprite variant="52">npcs/npc.xml</sprite></npc><!-- Desert Bard -->
<npc id="153"><sprite variant="53">npcs/npc.xml</sprite></npc><!-- Old Wizard -->
<npc id="154"><sprite variant="54">npcs/npc.xml</sprite></npc><!-- Old Woman -->
<npc id="155"><sprite variant="55">npcs/npc.xml</sprite></npc><!-- Construction Worker -->
<npc id="156"><sprite variant="56">npcs/npc.xml</sprite></npc><!-- Desert Barber/Desert Man -->
<npc id="157"><sprite variant="57">npcs/npc.xml</sprite></npc><!-- Trainer 2 -->
<npc id="158"><sprite variant="58">npcs/npc.xml</sprite></npc><!-- Young Male Wizard -->
<npc id="159"><sprite variant="59">npcs/npc.xml</sprite></npc><!-- Old man -->
<npc id="160"><sprite variant="60">npcs/npc.xml</sprite></npc><!-- Generic Man -->
<npc id="161"><sprite variant="61">npcs/npc.xml</sprite></npc><!-- Generic Banker -->
<npc id="162"><sprite variant="62">npcs/npc.xml</sprite></npc><!-- Generic Desert Man -->
<npc id="163"><sprite variant="63">npcs/npc.xml</sprite></npc><!-- Flower Girl -->
<npc id="164"><sprite variant="64">npcs/npc.xml</sprite></npc><!-- Wedding Officiator -->
<npc id="165"><sprite variant="65">npcs/npc.xml</sprite></npc><!-- Dimond/Magician -->
<npc id="166"><sprite variant="66">npcs/npc.xml</sprite><particlefx>graphics/particles/manaseed.particle.xml</particlefx></npc><!-- Mana Seed -->
<npc id="167"><sprite variant="67">npcs/npc.xml</sprite></npc><!-- Young Witch -->
<npc id="168"><sprite variant="68">npcs/npc.xml</sprite></npc><!-- Middle-Aged Wizard -->
<npc id="169"><sprite variant="69">npcs/npc.xml</sprite></npc><!-- Miner -->
<npc id="170"><sprite variant="70">npcs/npc.xml</sprite></npc><!-- Christmas Reinboo -->
<npc id="171"><sprite variant="71">npcs/npc.xml</sprite></npc><!-- Injured Mouboo -->
<npc id="172"><sprite variant="72">npcs/npc.xml</sprite></npc><!-- Katze -->
<npc id="173"><sprite variant="73">npcs/npc.xml</sprite></npc><!-- Easter Bunny -->
<npc id="174"><sprite variant="74">npcs/npc.xml</sprite></npc><!-- Aisha, Omar's daughter -->
<npc id="175"><sprite variant="75">npcs/npc.xml</sprite></npc><!-- Miriam the cat burglar -->
<npc id="176"><sprite variant="76">npcs/npc.xml</sprite></npc><!-- Lou Rette the gambler -->
<npc id="177"><sprite variant="77">npcs/npc.xml</sprite></npc><!-- Old Knight -->
<npc id="178"><sprite variant="78">npcs/npc.xml</sprite></npc><!-- Karoua, Exiled Indian Chief -->
<npc id="179"><sprite variant="79">npcs/npc.xml</sprite></npc><!-- Kesh, Karoua's wife -->
<npc id="180"><sprite>npcs/npc-savannahman.xml</sprite></npc><!-- Blue Savannah Man with idle animation -->
<npc id="181"><sprite variant="81">npcs/npc.xml</sprite></npc><!-- Green Savannah Man -->
<npc id="182"><sprite variant="82">npcs/npc.xml</sprite></npc><!-- Young archer -->
<npc id="183"><sprite variant="83">npcs/npc.xml</sprite></npc><!-- Skeleton man -->
<npc id="184"><sprite variant="84">npcs/npc.xml</sprite></npc><!-- Doctor (10) -->
<npc id="185"><sprite variant="44">npcs/npc.xml</sprite><particlefx>graphics/particles/evilobelisk.particle.xml</particlefx></npc><!-- Evil Obelisk -->
<npc id="186"><sprite variant="85">npcs/npc.xml</sprite></npc><!-- warning sign for pvp  -->
<npc id="187"><sprite variant="86">npcs/npc.xml</sprite></npc><!-- warning sign for pvp  -->
<npc id="188"><sprite variant="87">npcs/npc.xml</sprite></npc><!-- Broken Skeleton (Hallowe'en 2010)-->
<npc id="189"><sprite variant="88">npcs/npc.xml</sprite></npc><!-- Gambler -->
<npc id="190"><sprite variant="89">npcs/npc.xml</sprite></npc><!-- Milka -->
<npc id="191"><sprite variant="90">npcs/npc.xml</sprite></npc><!-- Braktar the Packrat -->
<npc id="192"><sprite variant="91">npcs/npc.xml</sprite></npc><!-- ?-->
<npc id="193"><sprite variant="92">npcs/npc.xml</sprite></npc><!-- Gambler -->
<npc id="194"><sprite variant="93">npcs/npc.xml</sprite></npc><!-- ?-->
<npc id="195"><sprite variant="94">npcs/npc.xml</sprite></npc><!-- Angela outside -->
<npc id="196"><sprite variant="95">npcs/npc.xml</sprite></npc><!-- Angela inside -->
<npc id="197"><sprite variant="96">npcs/npc.xml</sprite></npc><!-- Cindy inside -->
<npc id="198"><sprite>npcs/npc-cindycage.xml</sprite></npc><!-- Cindy in cage -->

<npc id="200">
   <sprite>npcs/npc-test.xml</sprite>
   <particlefx>graphics/particles/circle.particle.xml</particlefx>
</npc>
<npc id="201">
   <!-- This entry demonstrates that an NPC can be constructed from multiple preexisting
   spritesets. While using the default player sprite and normal player equipment can save
   time it is usually better to create a new NPC as one graphic from scratch. -->
   <sprite>player_female_base.xml</sprite>
   <sprite>equipment/feet/boots-female.xml|#4f2d29,c89078</sprite>
   <sprite>equipment/legs/chaps-female.xml</sprite>
   <sprite>equipment/chest/shorttanktop-female.xml</sprite>
   <sprite>hairstyles/hairstyle11.xml|#bb2222,ffee33</sprite>
</npc>
<npc id="202">
   <!-- An NPC made only from a particle effect. -->
   <particlefx>graphics/particles/hellblaze.particle.xml</particlefx>
</npc>
<npc id="203"><sprite>npcs/npc-woodenpump.xml</sprite></npc><!-- Woodenpump with drippy water -->
<npc id="204"><sprite variant="27">npcs/npc.xml</sprite><particlefx>graphics/particles/golbenez.particle.xml</particlefx></npc>
<!-- The entries 205-215 borrow concepts from npc id 201, which should not be regularly done. -->
<npc id="205">
   <sprite>player_female_base.xml</sprite>
   <sprite>hairstyles/hairstyle01.xml|#347235,52D017</sprite>
   <sprite>equipment/head/goggles.xml</sprite>
   <sprite>equipment/legs/skirt.xml|#d3b79e,ffffff</sprite>
   <sprite>equipment/chest/tanktop-female.xml|#d3b79e,ffffff</sprite>
   <sprite>equipment/feet/boots-female.xml|#9e7654,ffffff</sprite>
</npc>
<npc id="206">
   <sprite>player_female_base.xml</sprite>
   <sprite>hairstyles/hairstyle10.xml|#7F462C,F9966B</sprite>
   <sprite>equipment/chest/cotton-female.xml|#B93B8F,C38EC7,F9B7FF</sprite>
   <sprite>equipment/legs/skirt.xml|#AF7817,E8A317</sprite>
   <sprite>equipment/feet/boots-female.xml|#4f2d29,c89078</sprite>
</npc>
<npc id="207">
   <sprite>player_female_base.xml</sprite>
   <sprite>hairstyles/hairstyle11.xml|#C8B560,FFE87C</sprite>
   <sprite>equipment/chest/robe-female.xml|#7F5217,AF7817,E9AB17,FBB917</sprite>
   <sprite>equipment/feet/boots-female.xml|#4f2d29,c89078</sprite>
</npc>
<npc id="208">
   <sprite>player_female_base.xml</sprite>
   <sprite>hairstyles/hairstyle09.xml|#3B9C9C,AFDCEC</sprite>
   <sprite>equipment/head/wizard-hat.xml|#4f0a76,8010c0,d699f7</sprite>
   <sprite>equipment/chest/robe-female.xml|#4f0a76,8010c0,d699f7</sprite>
   <sprite>equipment/feet/boots-female.xml|#4f2d29,c89078</sprite>
   <sprite>weapon-staff.xml</sprite>
</npc>
<npc id="209">
   <sprite>player_female_base.xml</sprite>
   <sprite>hairstyles/hairstyle12.xml|#573a26,ffffff</sprite>
   <sprite>equipment/chest/cotton-female.xml|#573a26,9e7654,d3b79e,ffffff</sprite>
   <sprite>equipment/legs/miniskirt-female.xml|#251e06,443c21,71653b,a0945e</sprite>
   <sprite>equipment/feet/boots-female.xml|#4f2d29,c89078</sprite>
</npc>
<npc id="210">
   <sprite>player_female_base.xml</sprite>
   <sprite>hairstyles/hairstyle04.xml|#810541,F535AA</sprite>
   <sprite>equipment/legs/chaps-female.xml</sprite>
   <sprite>equipment/chest/tanktop-female.xml|#846211,dab333,fffb93,ffffff</sprite>
   <sprite>equipment/feet/boots-female.xml|#4f2d29,c89078</sprite>
</npc>
<npc id="211">
   <sprite>player_male_base.xml</sprite>
   <sprite>hairstyles/hairstyle07.xml|#bb2222,ffee33</sprite>
   <sprite>equipment/legs/shorts-male.xml|#255367,266c84,68b0c5,ffffff</sprite>
   <sprite>equipment/chest/tanktop-male.xml|#a4b2b2,ffffff</sprite>
   <sprite>equipment/feet/boots-male.xml|#623a34,f0c2b4</sprite>
</npc>
<npc id="212">
   <sprite>player_male_base.xml</sprite>
   <sprite>hairstyles/hairstyle08.xml|#EE9A4D,ffee33</sprite>
   <sprite>equipment/head/captain-hat.xml</sprite>
   <sprite>equipment/legs/shorts-male.xml|#a4b2b2,ffffff</sprite>
   <sprite>equipment/chest/vnecksweater-male.xml|#a4b2b2,ffffff</sprite>
   <sprite>equipment/feet/boots-male.xml|#623a34,f0c2b4</sprite>
</npc>
<npc id="213">
   <sprite>player_male_base.xml</sprite>
   <sprite>hairstyles/hairstyle02.xml|#254117,ffee33</sprite>
   <sprite>equipment/head/sailor-hat.xml</sprite>
   <sprite>equipment/legs/shorts-male.xml|#a4b2b2,ffffff</sprite>
   <sprite>equipment/chest/tanktop-male.xml|#a4b2b2,ffffff</sprite>
   <sprite>equipment/feet/boots-male.xml|#623a34,f0c2b4</sprite>
</npc>
<npc id="214">
   <sprite>player_male_base.xml</sprite>
   <sprite>hairstyles/hairstyle18.xml|#817339,FFE87C</sprite>
   <sprite>equipment/head/silkheadband.xml</sprite>
   <sprite>equipment/legs/shorts-male.xml|#111111,222222,333333,444444,555555,aaaaaa</sprite>
   <sprite>equipment/chest/tanktop-male.xml|#16486e,498ec5,e4f2fc</sprite>
   <sprite>equipment/feet/boots-male.xml|#623a34,f0c2b4</sprite>
</npc>
<npc id="215">
   <sprite>player_male_base.xml</sprite>
   <sprite>hairstyles/hairstyle02.xml|#F88017,FBB117</sprite>
   <sprite>equipment/legs/chaps-male.xml</sprite>
   <sprite>equipment/chest/cotton-male.xml|#222255,6666ff</sprite>
   <sprite>equipment/head/bowler-hat-brown.xml|#16486e,498ec5,e4f2fc</sprite>
   <sprite>equipment/feet/boots-male.xml|#623a34,f0c2b4</sprite>
</npc>
<!-- ***216-250 reserved for huge npcs*** -->
<npc id="216"><sprite variant="0">npcs/hugenpcs.xml</sprite></npc><!-- Barbarian with mouboohat-->
<npc id="217"><sprite variant="1">npcs/hugenpcs.xml</sprite></npc><!-- Barbarian with helmet and huge axe-->
<npc id="218"><sprite variant="2">npcs/hugenpcs.xml</sprite></npc><!-- Barbarian with spear-->
<!-- ***251-299 reserved for pose/outfit NPCs using sprite layering and image dyeing techniques. Because all 7 image channels are active, #ffffff (pure white) is a placeholder color for image dyeing channels not used in the outfit.  The order of image channels is: White, Yellow, Green, Cyan, Blue, Magenta and Red.*** -->
<npc id="251">
   <sprite variant="0">npcs/outfits.xml|#ffffff;#feffab;#25383c;#00ff00;#ff0000;#ffff00;#736f6e</sprite>
</npc> <!-- Christmas Saboteur -->
<npc id="252">
   <sprite variant="6">npcs/poses.xml</sprite>
   <sprite variant="1">npcs/outfits.xml|#636342;#ebec9a;#ffffff;#ffffff;#4b8342;#ffffff;#ea983f</sprite>
</npc> <!-- Female therminor with orange hat, green outfit -->
<npc id="253">
   <sprite variant="6">npcs/poses.xml</sprite>
   <sprite variant="2">npcs/outfits.xml|#636342;#ebec9a;#949400;#ffffff;#4b8342;#ffffff;#ea983f</sprite>
</npc> <!-- Male therminor with orange hat, green outfit. Bald and beardless. -->
<npc id="254">
   <sprite variant="6">npcs/poses.xml</sprite>
   <sprite variant="3">npcs/outfits.xml|#636342;#ebec9a;#949400;#ffffff;#4b8342;#ffffff;#ea983f</sprite>
</npc> <!-- Male therminor with orange hat, green outfit. Balding and long beard.-->
<npc id="255">
   <sprite variant="6">npcs/poses.xml</sprite>
   <sprite variant="1">npcs/outfits.xml|#636342;#ebec9a;#ffffff;#ffffff;#4b8342;#ffffff;#ea983f</sprite>
</npc> <!-- Male therminor with orange hat, green outfit. Long hair, short beard. -->
<npc id="300"><sprite variant="0">npcs/npc2.xml</sprite></npc><!-- Chef Skeleton -->
<npc id="301"><sprite variant="1">npcs/npc2.xml</sprite></npc><!-- Barmaid -->
<npc id="302"><sprite variant="2">npcs/npc2.xml</sprite></npc><!-- Shopkeeper -->
<npc id="303"><sprite variant="3">npcs/npc2.xml</sprite></npc><!-- Drunk Lover -->
<npc id="304"><sprite variant="4">npcs/npc2.xml</sprite></npc><!-- Magic Undead Shop -->
<npc id="305"><sprite variant="5">npcs/npc2.xml</sprite></npc><!-- Werewolf -->
<npc id="306"><sprite variant="6">npcs/npc2.xml</sprite></npc><!-- Chef's helper -->
<npc id="307"><sprite variant="7">npcs/npc2.xml</sprite></npc><!-- Horned mage -->
<npc id="308"><sprite variant="8">npcs/npc2.xml</sprite></npc><!-- Drunker -->
<npc id="309"><sprite variant="9">npcs/npc2.xml</sprite></npc><!-- Chief Barman -->
<npc id="310"><sprite variant="10">npcs/npc2.xml</sprite></npc><!-- Barman -->
<npc id="311"><sprite variant="11">npcs/npc2.xml</sprite></npc><!-- SwordGuy -->
<npc id="312"><sprite>npcs/npc-beerguyghost.xml</sprite></npc><!-- Ghost from a dead drunker -->
<npc id="313"><sprite>npcs/npc-chronos.xml</sprite></npc><!-- A rich Undead -->
<npc id="314"><sprite>npcs/npc-cryingchild.xml</sprite></npc><!-- Crying Child -->
<npc id="315"><sprite>npcs/npc-ghostinnkeeper.xml</sprite></npc><!-- Innkeeper's Ghost -->
<npc id="316"><sprite>npcs/npc-guard.xml</sprite></npc><!-- Evil Guard -->
<npc id="317"><sprite>npcs/npc-headhang.xml</sprite></npc><!-- A headhang lover -->
<npc id="318"><sprite>npcs/npc-headless.xml</sprite></npc><!-- A headless lover -->
<npc id="319"><sprite>npcs/npc-lightman.xml</sprite></npc><!-- Lightman -->
<npc id="320"><sprite>npcs/npc-receptionist.xml</sprite></npc><!-- A bloody Receptionist -->
<npc id="321"><sprite>npcs/npc-undeadbanker.xml</sprite></npc><!-- Undead banker -->
<npc id="322"><sprite>npcs/npc-gate-closed.xml</sprite></npc><!-- Closed version of the crypt entrance gate -->
<npc id="323"><sprite>npcs/npc-gate-open.xml</sprite></npc><!-- Open version of the crypt entrance gate -->
<npc id="324"><particlefx>graphics/particles/pentagram-redlinedraw.particle.xml</particlefx></npc>
<npc id="325"><particlefx>graphics/particles/pentagram-blacklinedraw.particle.xml</particlefx></npc>
<npc id="326"><sprite>npcs/npc-dyer.xml</sprite></npc><!-- Dyer -->
<npc id="327"><sprite>npcs/evil-obelisk.xml</sprite></npc><!-- Evil Obelisk -->
<npc id="328"><sprite variant="0">npcs/christmas_npcs.xml</sprite></npc><!-- Elf -->
<npc id="329"><sprite variant="1">npcs/christmas_npcs.xml</sprite></npc><!-- Cloaked Elf -->
<npc id="330"><sprite variant="2">npcs/christmas_npcs.xml</sprite></npc><!-- Nutcracker -->
<!-- ID 331 Open -->
<npc id="332"><sprite variant="4">npcs/christmas_npcs.xml</sprite></npc><!-- Bodyguard Elf1 -->
<npc id="333"><sprite variant="5">npcs/christmas_npcs.xml</sprite></npc><!-- Bodyguard Elf2 -->
<npc id="334"><sprite variant="6">npcs/christmas_npcs.xml</sprite></npc><!-- Bodyguard Elf3 -->
<npc id="335"><sprite variant="7">npcs/christmas_npcs.xml</sprite></npc><!-- Bodyguard Elf4 -->
<npc id="336">
   <sprite variant="0">npcs/outfits.xml|#ffffff;#feffab;#25383c;#00ff00;#ff0000;#ffff00;#736f6e</sprite>
</npc> <!-- Christmas Saboteur placeholder.  Should be in the poses/outfits range. Done to prevent breaking Christmas Event.-->
<npc id="337"><sprite variant="0">npcs/thermin_npcs.xml</sprite></npc><!-- Fortune Teller -->
<npc id="338"><sprite variant="1">npcs/thermin_npcs.xml</sprite></npc><!-- Steam Punk -->
<npc id="339"><sprite>npcs/furnace.xml</sprite></npc><!-- Furnace -->
<npc id="340"><sprite variant="36">npcs/npc.xml</sprite></npc><!-- Female Miner -->
<npc id="341"><sprite variant="41">npcs/npc.xml</sprite></npc><!-- Furnace NPC without furniture -->
<npc id="342"><sprite variant="97">npcs/npc.xml</sprite></npc><!-- Fortune Teller without furniture -->
<npc id="343"><sprite>npcs/shapeshifter.xml</sprite></npc><!-- Shapeshifter -->
<!-- Put new unique sprites above here.  For huge npcs, see range 216-250. For poses/outfits npcs, see 251-299 -->
<!-- note: don't go above 999, because the 1000's are reserved for mob id -->
</npcs>
The one below was used in my hello world test.
"<npc id="132"><sprite variant="32">npcs/npc.xml</sprite><particlefx>graphics/particles/nomadpipe.particle.xml</particlefx></npc><!-- Nomad, sitting with pipe -->"

So "mes" prints everything I put in quotation in the text window? What is this "\"?
Image
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: 25 Aug 2005, 16:08
Location: Germany

Re: I want to help contribute.

Post by Crush »

I see you are getting a hang of it. I would recommend you to look at some other scripts now and try to understand how they work. When you encounter something you don't understand, feel free to ask.
Immune wrote:So "mes" prints everything I put in quotation in the text window? What is this "\"?
That's an escaped quotation mark. Normally, the quotation mark shows the script parser the end of a string literal. So when you want an actual quotation mark inside the text, you have a problem:

Code: Select all

mes "And then he said "hi" to me" // <- doesn't work
The script parser will think that the text to output is "And then he said ". Then it finds the hi token outside of the quotation marks, has no idea what it is supposed to mean, and throws an error.

For that reason you can put a slash in front of a quotation mark. This tells the script parser "This isn't the sign that the text is over, I want you to actually write that quotation mark".

Code: Select all

mes "And then he said \"hi\" to me"
will output:
And then he said "hi" to me
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: 25 Aug 2005, 16:08
Location: Germany

Re: I want to help contribute.

Post by Crush »

OT:

Sigh, what did they do to my beautiful npcs.xml?

I used to add a comment to each declaration describing what the character looks like. Not its function, not a name, not where it is placed. A description of how it looks.

And now, a few years later, it's full of uncommented entries or entries which just have a name of an NPC instead of a description. How are people supposed to reuse sprites for different purposes? When I need the sprite of an old indian woman for an event, I look for the sprite ID of "old indian woman", and not for "Kesh, Karoua's wife".
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
User avatar
Immune
Peon
Peon
Posts: 36
Joined: 16 Dec 2011, 04:09

Re: I want to help contribute.

Post by Immune »

Perhaps sombody could create a simple "snatch and grab" quest as an example and break it down for me?

Lets say an NPC named Joe would like a beer. Would you like to fetch the beer for Joe? yes/no. You bring the Beer to Joe. You get 300 exp, a small healing potion and 50gp for your trouble.

How would I write this?
Image
User avatar
Jenalya
TMW Adviser
TMW Adviser
Posts: 717
Joined: 22 Sep 2010, 19:28

Re: I want to help contribute.

Post by Jenalya »

Immune wrote:Perhaps sombody could create a simple "snatch and grab" quest as an example and break it down for me?

Lets say an NPC named Joe would like a beer. Would you like to fetch the beer for Joe? yes/no. You bring the Beer to Joe. You get 300 exp, a small healing potion and 50gp for your trouble.

How would I write this?
There already exist some simple "snatch and grab" quests, the first thing that came to my mind was the quest where Doug in 010-2 asks you for some snake cave lamps. Beside of some randomness for the answers it's pretty similar to what you've asked for. Maybe you could have a look at Doug's script yourself and then try to create the beer-quest you suggested.
Also it might be helpful for you to look at the scripting reference in the wiki where you can find explanations about the scripting commands.
We're currently focusing to create more complex quests and to avoid this style of quest, but for training purposes this is a very good example.
User avatar
Immune
Peon
Peon
Posts: 36
Joined: 16 Dec 2011, 04:09

Re: I want to help contribute.

Post by Immune »

To me that is not a simple script. I understand you don't want simple quests? I am trying to learn and your example is confusing.

Code: Select all

010-2.gat,68,87,0|script|Doug|113,{
    if(CaveSnakeLamp == 1) goto L_State2;
    if(CaveSnakeLamp == 2) goto L_Done;
    set @TEMP, rand(4);
    if(@TEMP == 0) goto L_0;
    if(@TEMP == 1) goto L_1;
    if(@TEMP == 2) goto L_2;
    if(@TEMP == 3) goto L_3;

L_0:

Code: Select all

goto L_Question;

L_1:

Code: Select all

 goto L_Question;

L_2:

Code: Select all

 goto L_Question;

L_3:

Code: Select all

goto L_Question;

L_Question:

Code: Select all

  menu
        "Yes", L_Sure,
        "No", -;

Code: Select all

L_Sure:
    set CaveSnakeLamp, 1;
    set @TEMP, rand(4);
    if (@TEMP == 0)
        goto J_0;
    if (@TEMP == 1)
        goto J_1;
    if (@TEMP == 2)
        goto J_2;
    if (@TEMP == 3)
        goto J_3;

J_0:

Code: Select all

  goto L_Go;

J_1:

Code: Select all

  goto L_Go;

J_2:

Code: Select all

 goto L_Go;

J_3:

Code: Select all

 goto L_Go;

L_Go:

Code: Select all

L_State2:
    if(countitem("CaveSnakeLamp") >= 20)
        goto L_Have;

Code: Select all

L_Have:

Code: Select all

if(countitem("CaveSnakeLamp") < 20)
        goto L_State2;
    delitem "CaveSnakeLamp", 20;
    set Zeny, Zeny + 5000;
    getexp 5000, 0;
    set CaveSnakeLamp, 2;

Code: Select all

L_Done:
Edit: also

Code: Select all

next;
The wiki does not contain all the information I need to understand this.
Image
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: 25 Aug 2005, 16:08
Location: Germany

Re: I want to help contribute.

Post by Crush »

Can you please be a bit more specific what you don't understand?
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
User avatar
Immune
Peon
Peon
Posts: 36
Joined: 16 Dec 2011, 04:09

Re: I want to help contribute.

Post by Immune »

Immune wrote:Perhaps sombody could create a simple "snatch and grab" quest as an example and break it down for me?

Lets say an NPC named Joe would like a beer. Would you like to fetch the beer for Joe? yes/no. You bring the Beer to Joe. You get 300 exp, a small healing potion and 50gp for your trouble.

How would I write this?
I thought this was specific.
Image
User avatar
Immune
Peon
Peon
Posts: 36
Joined: 16 Dec 2011, 04:09

Re: I want to help contribute.

Post by Immune »

I think I understand. The part that I was not sure about was where Doug says random quotes and it uses variables.
Image
User avatar
Immune
Peon
Peon
Posts: 36
Joined: 16 Dec 2011, 04:09

Re: I want to help contribute.

Post by Immune »

Ok this is what I came up with. Mind the crappy notes please and correct them if you can.

Code: Select all

//

002-1.gat,15,67,0|script|Samuel|132,{
    mes "[Samuel the Nomad]";
    mes "\"This is really a nice place.\"";
    mes "Don't you think so?\"";
    close;
}

002-1.gat,18,68,0|script|Elijah|128,{
    mes "[Elijah the Nomad]";
    mes "\"If I only had a tent...\"";
    close;
}

002-1.gat,17,63,0|script|Test|132,{
//The line below tells the script to go to a different state?
    if(Beer == 1) goto L_State2;
    if(Beer == 2) goto L_Done;
//The line below tells the script to select one of three random
//states.
    set @TEMP, rand(3);
//We told the script to chose 3 random states starting from the
//number 0. So 0,2,3
    if(@TEMP == 0) goto L_0;
    if(@TEMP == 1) goto L_1;
    if(@TEMP == 2) goto L_2;

L_0:
    mes "[Test Beer script]";
    mes "I need a beer to quince my thirst";
// the line bellow tells the script to give the next button
    next;
// the line below tells the Script to go to this variable
    goto L_Question;

L_1:
    mes "[Test Beer script]";
    mes " Must have beer!";
    next;
    goto L_Question;

L_2:
    mes "[Test Beer script]";
    mes "Spare a drink or two kind sir?";
    next;
    goto L_Question;

L_Question:
    mes "[Test Beer script]";
    mes "Would you fetch me a beer or two kind sir?";
    next;
//The line below tells the text window to display options given.
    menu
//the line below are the options given
// the , tells the script to continue with options
        "yes", L_Sure,
        "No", -;
    close;

L_Sure:
    set Beer, 1;
    set @TEMP, rand(3);
    if (@TEMP == 0)
        goto J_0;
    if (@TEMP == 1)
        goto J_1;
    if (@TEMP == 2)
        goto J_2;
J_0:
    mes "[Test Beer script]";
    mes "Thank you!";
    next;
    goto L_Go;

J_1:
    mes "[Test Beer script]";
    mes "Now I won't die in this heat, Thanks!";
    next;
    goto L_go;

J_2:
    mes "[Test Beer script]";
    mes "I will give you a small reward for your troubles";
    next;
    goto L_Go;

L_Go:
    mes "[Test Beer script]";
    mes "Please go get me a couple Beer";
    close;

L_State2:
//The line below tells the script to read how many beer the
//player has? If he does go to L_Have:
    if(countitem("Beer") >= 2)
        goto L_Have;
    mes "[Test Beer script]"
    mes "Please go get me a couple Beer";
    close;

L_Have:
    mes "[Test Beer script]";
    mes "Thank you so much now I won't die in this heat!";
    next;
    if(countitem("Beer") < 2)
        goto L_State2;
//The line below deletes the item from players inventory
    delitem "Beer", 2;
//The line below gives the player 50gp
    set Zeny, Zeny + 50;
//The line below gives the player exp?
    getexp 300, 0;
//the line below ????
    set Beer, 2;

    mes "[Test Beer script]";
    mes "This is what I have for you";
    mes "";
    mes "[300 experience points]";
    mes "[50 gold]";
    close;

L_Done:
//mes allows you to print a message in the text window.
    mes "[Test]";
    mes "Hello world";
    mes "yay this was a test thanks for the Beer";
close;
}
Image
Post Reply