WoW Nice +Rep
WoW Nice +Rep
TUTORIAL: Adding Additions to The Book of the Wise
-------------------------------------------------------------------------------------------------
Hello, and Welcome to this Tutorial. We will be Learning how to expand current features of the by me released: 'Book of the Wise'. It is more than highly recommended to review the features of the Book, before reading further in the tutorial.
---| #1: ADDING TELEPORTLOCATIONS |-------------------------------------------------------------------------------------------------------------------------------
[STEP 1] Be sure that 'CUSTOM_TELEPORTLOCATIONS_ENABLED' is set to 'true' at the top of the script.
[STEP 2] Look in the script (below, around line 362) for the Custom Teleport Location Gossipmenu.
[STEP 3] We now have to add a menu link. The menu link looks like this:
Icon: This is the displayicon in front of the menutext. You can choose between the following (known) icons:Code:Item:GossipMenuAdditem(Icon, Linkname, UNIQUE_SCRIPTID, 0)
Linkname: The name of the menu, MUST be between " " tags!Code:0 - Chat 1 - Vendor 2 - Flight 3 - Trainer 4 - Gear(Equipment) 5 - Gear(Equipment) 6 - Bank 7 - Chat with Point 8 - Tabard 9 - Swords 10 - Gold Dot
UNIQUE_SCRIPTID: This must be a unique ID that links to the actual scripts that teleports the player.
EXAMPLE:
Add the menu link with the UniqueID to the Custom Menu.Code:Item:GossipMenuAddItem(2, "Teleport to the Mall", 40, 0)
You will notice a '-- ADD YOUR CUSTOM TELEPORTLOCATIONS BELOW THIS LINE --' insert it below that.
[STEP 4] Now it's time for the actual teleporting script. We have the link now, but no locations yet.
Use the following template and fill in the spots tagged with @ @ (Remove the @'s!) I also made them red for better notice.
UNIQUE_SCRIPTID: Has to be the same as you filled in at Step 3!Code:if (intid == @UNIQUE_SCRIPTID@) then local icount = Player:GetItemCount(17031) if icount == 0 and (COST_REAGENT_TELEPORTING == true) then Player:SendAreaTriggerMessage("Missing Reagent: Rune of Teleportation") else if (COST_REAGENT_TELEPORTING == true) then Player:RemoveItem(17031,1) end Player:SendBroadcastMessage("The Book of the Wise has successfully teleported you to @YOUR LOCATION@"..TELEPORT_RCOST_ENTERMESSAGE..".") Player:Teleport(@MAPID@, @X@, @Y@, @Z@) end Player:GossipComplete() end
YOUR LOCATION: Fill in the name of the destination, same as Step 3.
To retrieve MAPID, X, Y and Z, go to the location (in-game!) and type .GPS, it will print your MAPID and XYZ for you.
EXAMPLE:
Insert the code anywhere in the script, as long as it is not in any other script. It is recommended to place it under all the other teleport locations which are already in.Code:if (intid == 40) then local icount = Player:GetItemCount(17031) if icount == 0 and (COST_REAGENT_TELEPORTING == true) then Player:SendAreaTriggerMessage("Missing Reagent: Rune of Teleportation") else if (COST_REAGENT_TELEPORTING == true) then Player:RemoveItem(17031,1) end Player:SendBroadcastMessage("The Book of the Wise has successfully teleported you to the Mall"..TELEPORT_RCOST_ENTERMESSAGE..".") Player:Teleport(571, 5760.481934, 587.499817, 649.567932) end Player:GossipComplete() end
[STEP 5] That's it!---
---| #2: ADDING SUMMONABLE NPC'S |------------------------------------------------------------------------------------------------------------------------------
I will add some more tutorials tomorrow, but I have some things to do right now[STEP 1] We are going to assume you have not yet added any additional Summonable NPC's and that the Main Menu of the summoning looks like this:
You will notice only two Summon options. The Distributor of the Books, and a Reagent vendor. In this tutorial we are going to add an ammunition vendor to the Summoning Menu!Code:if (intid == 2) then if (Player:IsInCombat() == true) and (BOOK_USABLE_IN_COMBAT == false) then Player:SendAreaTriggerMessage(""..ERROR_IN_COMBAT_MESSAGE.."") else Item:GossipCreateMenu(800, Player, 0) Item:GossipMenuAddItem(2, "Summon: Distributor of Magical Books", 122002, 0) Item:GossipMenuAddItem(2, "Summon: Reagent Vendor", 122003, 0) Item:GossipMenuAddItem(0, "<Return to the Index>", 600, 0) Item:GossipSendMenu(Player) end end
[STEP 2] First add another line to the piece of code you see above. Add it below this line:
We will want it to look like this, so the new line we are going to add looks like this:Code:Item:GossipMenuAddItem(2, "Summon: Reagent Vendor", 122003, 0)
NPC NAME/FUNCTION: We will take Ammunition VendorCode:Item:GossipMenuAddItem(2, "Summon: NPC NAME/FUNCTION", UNIQUE-ID, 0)
UNIQUE-ID: This is used just like an 'URL' for webpages. It will link to the part of code that actually spawns the NPC to you. For example I can use '234255664' if I would like, as long as it is not in use by any other GossipMenu.
Assuming we use the above information, the output of the new MenuLink looks like this:
Our final output of the Menu should look like this:Code:Item:GossipMenuAddItem(2, "Summon: Ammunition Vendor", 234255664, 0)
[STEP 3] Now we have come to the more fun part: The script that summons the NPC to your location, and here we will define the ID of the NPC that's being summoned. For this part we will need the UNIQUE-ID you have chosen in Step 2. Locate the following piece of code in your script:Code:if (intid == 2) then if (Player:IsInCombat() == true) and (BOOK_USABLE_IN_COMBAT == false) then Player:SendAreaTriggerMessage(""..ERROR_IN_COMBAT_MESSAGE.."") else Item:GossipCreateMenu(800, Player, 0) Item:GossipMenuAddItem(2, "Summon: Distributor of Magical Books", 122002, 0) Item:GossipMenuAddItem(2, "Summon: Reagent Vendor", 122003, 0) Item:GossipMenuAddItem(2, "Summon: Ammunition Vendor", 234255664, 0) Item:GossipMenuAddItem(0, "<Return to the Index>", 600, 0) Item:GossipSendMenu(Player) end end
Below the above code we are going to add our own teleporting script. It will look like this:Code:if (intid == 122003) then -- Summon: Reagent Vendor local icount = Player:GetItemCount(4787) if icount == 0 and (COST_REAGENT_NPCSUMMON == true) then Player:SendAreaTriggerMessage("Missing Reagent: Imbued Soul Shard") else Player:RemoveItem(4787,1) local x =Player:GetX () local y =Player:GetY () local z =Player:GetZ () local o =Player:GetO () Player:SpawnCreature (28809, x+3, y, z, o, 35, 25000) end Player:GossipComplete() end
What we need to replace is the UNIQUE-ID and the NPC EntryID. The UNIQUE-ID must be the same as the ID you have chosen in Step 2.Code:if (intid == UNIQUE-ID) then local icount = Player:GetItemCount(4787) if icount == 0 and (COST_REAGENT_NPCSUMMON == true) then Player:SendAreaTriggerMessage("Missing Reagent: Imbued Soul Shard") else Player:RemoveItem(4787,1) local x =Player:GetX () local y =Player:GetY () local z =Player:GetZ () local o =Player:GetO () Player:SpawnCreature (NPCID, x+3, y, z, o, 35, 25000) end Player:GossipComplete() end
Still assuming we want to summon an Ammunition Vendor, I should make it look like this (I took NPC 28800 for the AmmoVendor):
Just insert it where I said to (below script) and you'll be ready to goCode:if (intid == 234255664) local icount = Player:GetItemCount(4787) if icount == 0 and (COST_REAGENT_NPCSUMMON == true) then Player:SendAreaTriggerMessage("Missing Reagent: Imbued Soul Shard") else Player:RemoveItem(4787,1) local x =Player:GetX () local y =Player:GetY () local z =Player:GetZ () local o =Player:GetO () Player:SpawnCreature (28800, x+3, y, z, o, 35, 25000) end Player:GossipComplete() end.
.
Claiver
Last edited by Claiver; 03-21-2009 at 07:48 AM.
<reserved>
Im getting an Error...
Scripts/book of the wise.lua:101: attemt to compare nil with number.
And nothing happens when i click on the book :/
Any Help would be appriciated (:
Yes there is a blue Glow, but im not sure where line 101 is xD but ill try to find it :b
i'd use this in my server if i knew how. but for now its all a blur...
The concept is AMAZING!
Very easy. Execute the .SQL on the Book of the Wise mainpost.
Then place this .LUA file in the ArceEmu/Scripts folder.
xx.Claiver
I'm new at this but on line 9 could the blank '' be the problem? Said that in the error message, but I don't know -.- did anyone else have a problem with the script?
I havent had a chance to try the book of the wise yet but i'm gonna give it a shot +Rep soon as my timer is gone =/
great guide!!