How could i make it so new characters automatically get all key items and maps?
Can i possibly make it so once i trade the adventure coupon to the npc it'll give all the maps and key items?
Question?
-
- Developer
- Posts: 539
- Joined: Sun Jul 22, 2012 12:17 am
Re: Question?
Hope you don't mind a little light programming. I swear, it's pretty easy.
You may want to consider whether or not to do all key items, since it could cause strange behavior from certain quests (i.e. unflagable, get stuck, etc.) If you're okay with that, then by all means.
This is the script I use for Jack of Spades in Windurst Woods, which is an Adventurer's Coupon NPC. You'd have to copy-paste the relevant code into whichever NPCs you wanted to behave this way. As an aside, I got the code from someone else either in this forum, or the old forum. All this one does is add maps, but it shouldn't be too hard to puzzle out how to make it all key items, all spells, etc.
It also happens pretty much instantaneously, so no worries about the server lagging when people use it. At least, the maps go okay.
The relevant code is the player:addKeyItem() bits.
You may want to consider whether or not to do all key items, since it could cause strange behavior from certain quests (i.e. unflagable, get stuck, etc.) If you're okay with that, then by all means.
This is the script I use for Jack of Spades in Windurst Woods, which is an Adventurer's Coupon NPC. You'd have to copy-paste the relevant code into whichever NPCs you wanted to behave this way. As an aside, I got the code from someone else either in this forum, or the old forum. All this one does is add maps, but it shouldn't be too hard to puzzle out how to make it all key items, all spells, etc.
It also happens pretty much instantaneously, so no worries about the server lagging when people use it. At least, the maps go okay.
The relevant code is the player:addKeyItem() bits.
Code: Select all
-----------------------------------
-- Area: Windurst Woods
-- NPC: Jack of Spades
-- Adventurer's Assistant
-- Working 100%
-------------------------------------
require("scripts/globals/settings");
package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil;
require("scripts/zones/Windurst_Woods/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
count = trade:getItemCount();
AdventurerCoupon = trade:hasItemQty(536,1);
if (AdventurerCoupon == true and count == 1) then
player:startEvent(0x271a,GIL_RATE*50);
-- ADD ALL MAPS
-- MAIN NATIONS SANDY BASTOK WINDURST JEUNO
player:addKeyItem(385);
player:addKeyItem(386);
player:addKeyItem(387);
player:addKeyItem(388);
-- ITEMS 389 to 447
z = 389;
while z <= 447 do
player:addKeyItem(z);
z = z + 1;
end
-- KEY ITEMS 1856 to 1893
z = 1856;
while z <= 1893 do
player:addKeyItem(z);
z = z + 1;
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x2719,0,4);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x271a) then
player:tradeComplete();
player:addGil(GIL_RATE*50);
end
end;
Test Server: Hanekawa | Fantasy World: Naito
An occasionally updated list of what works
Bugs reports go here. | Project chat here.
Things I've found, but don't plan to work on.
An occasionally updated list of what works
Bugs reports go here. | Project chat here.
Things I've found, but don't plan to work on.