Page 1 of 3
Creating a custom augment NPC
Posted: Tue Jun 30, 2015 1:38 am
by Aale
Been trying to reverse engineer a custom augment NPC using the add-on scenario box in Lower Jeuno but I have no real coding knowledge. What I need help with if anyone can, is how to get my NPC to recognize the item I trade to it. If I trade an onion sword, is there a way for me to have the npc recognize that item, and add augments from a predetermined selection of variables?
Ex: Whatever gear item traded + 10 Beastman Seals which I'll have set up for say HP+30 would spit out
player:addItem(xxxxx,1,1,29);
where xxxxxx would = whatever item ID the gear I traded initially was.
Any help would be great! Sorry if this is hard to follow, it's almost 2 am and my brain is fried lol.
Re: Creating a custom augment NPC
Posted: Wed Jul 01, 2015 1:12 am
by Aale
Edit - page cleanup.
Re: Creating a custom augment NPC
Posted: Thu Jul 02, 2015 12:59 am
by Aale
Ok, so I can up with a more elegant solution. At least a highly customizable solution anyway. This way you can tie an item of your choice to an augment of your choice with any combination you like.
Code: Select all
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
local count = trade:getItemCount();
local prize = trade:getItem(0);
local a1 = 0;
local a2 = 0;
local a3 = 0;
local a4 = 0;
local v1 = 0;
local v2 = 0;
local v3 = 0;
local v4 = 0;
if trade:getItem(1) == 1535 then
a1 = 512
v1 = 4
elseif trade:getItem(2) == 1535 then
a2 = 512
v2 = 4
elseif trade:getItem(3) == 1535 then
a3 = 512
v3 = 4
elseif trade:getItem(4) == 1535 then
a4 = 512
v4 = 4
end
if trade:getItem(1) == 1536 then
a1 = 513
v1 = 4
elseif trade:getItem(2) == 1536 then
a2 = 513
v2 = 4
elseif trade:getItem(3) == 1536 then
a3 = 513
v3 = 4
elseif trade:getItem(4) == 1536 then
a4 = 513
v4 = 4
end
if trade:getItem(1) == 1537 then
a1 = 514
v1 = 4
elseif trade:getItem(2) == 1537 then
a2 = 514
v2 = 4
elseif trade:getItem(3) == 1537 then
a3 = 514
v3 = 4
elseif trade:getItem(4) == 1537 then
a4 = 514
v4 = 4
end
if trade:getItem(1) == 1538 then
a1 = 515
v1 = 4
elseif trade:getItem(2) == 1538 then
a2 = 515
v2 = 4
elseif trade:getItem(3) == 1538 then
a3 = 515
v3 = 4
elseif trade:getItem(4) == 1538 then
a4 = 515
v4 = 4
end
if trade:getItem(1) == 1539 then
a1 = 516
v1 = 4
elseif trade:getItem(2) == 1539 then
a2 = 516
v2 = 4
elseif trade:getItem(3) == 1539 then
a3 = 516
v3 = 4
elseif trade:getItem(4) == 1539 then
a4 = 516
v4 = 4
end
if trade:getItem(1) == 1540 then
a1 = 517
v1 = 4
elseif trade:getItem(2) == 1540 then
a2 = 517
v2 = 4
elseif trade:getItem(3) == 1540 then
a3 = 517
v3 = 4
elseif trade:getItem(4) == 1540 then
a4 = 517
v4 = 4
end
if trade:getItem(1) == 1541 then
a1 = 518
v1 = 4
elseif trade:getItem(2) == 1541 then
a2 = 518
v2 = 4
elseif trade:getItem(3) == 1541 then
a3 = 518
v3 = 4
elseif trade:getItem(4) == 1541 then
a4 = 518
v4 = 4
end
if(player:getFreeSlotsCount() >= 1) then
player:tradeComplete();
player:addItem(prize,1,a1,v1,a2,v2,a3,v3,a4,v4);
player:messageSpecial(ITEM_OBTAINED,prize);
else
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,prize);
end
end;
It is important to note a few things though, the item you wish to augment MUST be in slot 0, and the items you use to apply augments must be in slots 1, 2, 3, and 4. (Any combination of these will work, but slots 5, 6, and 7 will return nothing. See shitty picture below.)
You can add as many augment options as like like to this by copy/pasting in a new segment like the one below and edit item ID / augment ID to your liking.
Code: Select all
if trade:getItem(1) == 1541 then
a1 = 518
v1 = 4
elseif trade:getItem(2) == 1541 then
a2 = 518
v2 = 4
elseif trade:getItem(3) == 1541 then
a3 = 518
v3 = 4
elseif trade:getItem(4) == 1541 then
a4 = 518
v4 = 4
end
Trading an item by itself will wipe all augments from it just in case you want to sell back to AH or whatever. Augments will apply to any gear afaik, rare, rare/ex or otherwise. Hope this helps people out, I know I've been trying to figure it out forever.
Re: Creating a custom augment NPC
Posted: Thu Oct 22, 2015 5:25 pm
by kennxonline
OMG thank you so much for making this, just what I wanted on my server!
Questions,
How do I get it to take x30 beastmen seals for a augment? Currently only can get 1.
how do I made the NPC talk and talk about augments to players? If you could help me thanks!
you made my day <3
Re: Creating a custom augment NPC
Posted: Thu Oct 22, 2015 6:59 pm
by shadowuz
add a ontrigger func. for msg:
Code: Select all
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:PrintToPlayer("insert your text");
end
for the taking 30 bs's i think u'll just need to do/add a1= itemid,amount but i'm not sure as i'm still learning also
Re: Creating a custom augment NPC
Posted: Fri Oct 23, 2015 12:37 am
by kennxonline
yay it work thank you so much !!
Re: Creating a custom augment NPC
Posted: Fri Oct 23, 2015 3:19 pm
by kennxonline
if you want you can check out my server Moogles.
--server chaosds.ddns.net
Re: Creating a custom augment NPC
Posted: Mon Nov 16, 2015 2:13 pm
by kennxonline
Do you know how I would go by making a quest that checks a players level and/or key item requirement to active the quest. Also how do I make quest hand out augmented items. Ive tried and failed at this and would make a awesome input to my server please help. I am the only one working on my server I don't know much about scripting yet.
Code: Select all
-----------------------------------
-- Area: Norg
-- NPC: Andrause
-- Augment NPC
-----------------------------------
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player, itemId, quantity, aug0, aug0val, aug1, aug1val, aug2, aug2val, aug3, aug3val, trialId)
-- Load needed text ids for players current zone..
local TextIDs = "scripts/zones/" .. player:getZoneName() .. "/TextIDs";
package.loaded[TextIDs] = nil;
require(TextIDs);
-- Ensure item id was given..
if (itemId == nil or tonumber(itemId) == nil or tonumber(itemId) == 0) then
player:PrintToPlayer( "You must enter a valid item id." );
return;
end
-- Ensure the player has room to obtain the item...
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial( ITEM_CANNOT_BE_OBTAINED, itemId );
return;
end
-- Give the player the item...
player:addItem( 12643, 1, 147, 1,);
player:messageSpecial( ITEM_OBTAINED, 12643 );
end
I feel like im close but still so far away
(
Re: Creating a custom augment NPC
Posted: Wed Nov 18, 2015 5:36 pm
by TeoTwawki
kennxonline, what you are passing that NPC is incorrect and can't work. Command scripts and NPC scripts don't work the same. Learn your way around the language first, try coding new things second, or everyone that tries to help you will wind up doing all the work while trying not to hurt feelings.
Edit: grammar fail.
Re: Creating a custom augment NPC
Posted: Thu Nov 19, 2015 10:56 pm
by kennxonline
thanks for all the help.