Nice quest npcs?
Has anybody discovered a way to make questgivers more like live. As in if you hand in an item that is not in any way a quest item, it says no thanks i dont need that and hands it back to you?
Because i've noticed that you have to hand in ALL items for a quest at once, else the questgivers just keep your stuff. So it would be very cool to somehow stop them from eating items. |
try
Code:
sub EVENT_ITEM{ |
expanded for convenience sake, enjoy:
Code:
sub EVENT_ITEM{ |
In all my quests i add similar code like that to a seperate sub, that way if the mob is involved in quests, you can use the effect several times without having to retype it.
e.g Code:
sub EVENT_ITEM |
Hmm, charges set to 0 still summons an item? Or did you just put 0 there as an example?
|
sub EVENT_ITEM
{ if($item1==30){ quest::say("thanks"); } else if($item1==23){ quest::say("thanks"); } else if($item1==55){ quest::say("thanks"); } else { quest::say("sorry i dont need this"); quest::summonitem($itemid); } } for example :wink: |
hmmm interesting.
here's the problem though. I want the npc to A) return item to player if they only hand in a single item from a multi-item turn in. B) return any non-quest related item handed to him here's what i have going so far, lemme know if i screwed anything up. I was thinking if there was some way to make a temporary variable. i could set a variable to true or 1 or whatever if any of the successful item turn in's are used. (item1 2 and 3 for quest are turned in, so set variable to true.) then below all the checks, do a if variable != true say "i dont need this, blah blah" and return all items in all 4 slots to the player. Code:
sub EVENT_ITEM { Code:
sub EVENT_ITEM { |
ya, i think i'm stupid.
i shortened it i think. ) Any glaring problems with this? Code:
sub EVENT_ITEM { |
Welp. i found a biggy wrong with it. Seems cofruben's little example wasnt proper perl syntax. i changed it and it started working )
Code:
sub EVENT_ITEM { |
elseif isn't part of perl, its elsif, you will get complie errors if you use elseif.
|
oops sorry didnt read close enough.
yep typo on last part for me. code has it right though elsif |
Code:
if($item1 > 0){quest::summonitem("$item1");} |
well it seems to work fine.... i use ""'s on all of my summonitems and they put the item on your cursor.
isn't that how summonitem is supposed to work? I tested all the quests and they all use quotes. |
Quote:
|
aye. i use quest::summonitem("00000");
it puts the item on my cursor as well. So i guess animepimp is wrong about this syntax being wrong. =) |
I know that "0000" will wokr perfectly fine, but "$item4" will not. Because if 1234 is stored in $item4 then putting ($item4) will be treated as (1234) but putting ("$item4") will search for "$item4" in the DB. It doesn't parse variables inside of quotes, anythigng in quotes is just copyed over.
|
That part isn't wrong. Test it. I have, and it works fine.
|
works fine for me too.
perl parses the $item1 into the proper number before it's processed. |
Anime are you confusing single quotes with double quotes? Single quotes work the way you explained in most languges...there is no variable expansion and the string is treated as a literal.
:?: |
You goof AP, how do you think that Mobs return the class, or names of PCs?
quest::say("Hello $name, i see you are an $class, and a $race no less! thats a shame."); For an iksar wizard would return Hello Ikky, i see you are a Wizard, and an Iksar no less! thats a shame. |
Guess I'm jsut getting my languages confused, sorry. I know 5 different programming languages and sometimes it all gets smeared together.
|
I found this is a good script to put in the default.pl for the entire server. I am just wondering if there is a way to keep them from accepting items and storeing them. Even though you get the item back with this code, if you do a npcstats on them you will see they are holding it. I know this is a huge loop hole for cheaters to transfer no drop items to other players.
|
ah crap you're right i didn't think of that...
hmm |
I guess we need a quest method that can manipulate the items the NPC is carrying. This would be useful for clearing their inventory in this case and also adding new loot if a certain quest is fufilled. Perhaps the code can be changed so it never adds stuff they are handed to their inventory? Should be pretty simple, jsut remove the right lines. ANd then a quest function can be written to add stuff to their inventory. Thats probably the best solution.
|
Hmm...perhaps some code that deletes the item from the npc's loot table is in order. I'll take a look and see what I can come up with, thanks for bringing that up!
|
Maybe just get the code to hand back any item that isn't used by a quest by default and add a function to put an item into a mob's inventory via the quest system if it really is required?
|
But how would the code know that the item is not used by the quest? It just passes stuff to the quest and never knows if the variables get used or not.
|
Well the problem with that is that it's the trade code that allows pets to use weapons, so I'll write up a temp fix for you guys to use while mulling over the options of how to fix it without borking that completely.
|
Quote:
|
Ok it looks like I'll need to dig a little deeper than expected. It appears the item doesn't go into the loot table of the NPC until after the trade...so the RemoveItem() function won't work in this case...at least not without some additional coding other than just adding another perl function.
Will post more when I get closer to a solution. |
I've come up with a "fix" for the problem of quest items sticking with an npc - it's a temp fix for now until I have more time to take a look at options to the "npc's can equip items" code. Basically what I did was add a new field to the npc_types index in the database called "questflag". I then added a function to check it and put it within the Client::FinishTrade function. It checks the questflag field in npc_types, and if 0 is returned, it allows the npc to have the item added to its loot table. If 1 is returned, the item is ignored(for loot table purposes - the npc still accepts the item through all tests I've done).
In client.cpp, replace Client::FinishTrade() with: Code:
void Client::FinishTrade(NPC* with){ Code:
int8 GetQuestNPCFlag(int32 npcid){ For the database portion, simply type the following: Code:
ALTER TABLE `npc_types` ADD `questflag` TINYINT(4) DEFAULT "0" NOT NULL AFTER `AC` |
Anyone tried this yet? Curious if it's working ok.
|
All times are GMT -4. The time now is 05:19 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.