Modified WesQuests.cpp for multi item turnins and more
I've been working a little on WesQuests.cpp, and here's my custom version of it, for anyone who'd want.
First of all, you need to make some minor changes to other files. Client.h must be modified to replace the current checkquests line with: Code:
void CheckQuests(const char* zonename, const char* message, int32 npc_id, int32 item_id = 0, Mob* t_npc); The following line must be added to attack.cpp (NPC::Damage) where it does zone->AddAggroMob(), as well as anywhere else the mob gains aggro on something (NPCAi.cpp, for example) Code:
other->CastToClient()->CheckQuests(zone->GetShortName(),"%%attack%%",this->GetNPCTypeID(), 0, this); Code:
int8 flag[60]; Code:
for (int m = 0; m < 60; m++) TRIGGER_ATTACK - Makes the event take place when the mob gets into combat. TRIGGER_FLAGS X X X X - Makes the event take place when a certain amount of "flags" have been set onto the NPC. X's are represented by flag numbers. Any flags NOT used should be set to 0. So for example, if the event should be run when the npc has set the flags 1, 2 and 5, it should be: TRIGGER_FLAGS 1 2 5 0. A trigger_flags will automatically unset all flags it the check is passed. Effects: FACTION_CHECK 1-6 - This is put in a block to check against faction. If the faction check is failed, the npc gives a "Will not deal with you" message and aborts. Least required faction: 1: Ally 2: Kindly 3: Warmly 4: Amiably 5: Indifferent 6: Apprehensive An NPC will NEVER respond to hail, flags or item event if it's threatingly or scowls to the person. ADDCASH copper_amount - Adds copper_amount cash to the player. NPC_FLAG X Y - Sets NPC flag X to Y. Please note - Don't use flag 50. It's reserved. PLAYER_FLAG X Y - Sets PC flag X to Y. These are used for FLAG_CHECK. FLAG_CHECK X - Checks PC flag X. If it's not > 0, aborts. CHANCE X - Checks X against a d100. If the d100 beats X, aborts. Additionally, this WesQuests removes the need for NPC_SCRIPT 99 etc at the top of the .qst files, since it's completely unnecessary with individual npc files. One little bug I haven't been able to fix: You need to add END_FILE at the end of each .qst file with this, otherwise it creates a good bit of lag for a while. Working on that for the next version. Below follows some examples of what you can do with this: Code:
TRIGGER_DEATH { Code:
TRIGGER_TEXT:Hail:{ Have fun. :) |
Uploaded a small fix, NPC's were calling faction checks on attacks/deaths.
|
Very cool stuff... Wes and some others are rewriting the quest stuff if I remember correctly, hopefully all these new additions will be rolled in.
Having them not respond due to faction makes me want to work on getting 'sneak' in for rogues.. I use to love that aspect of playing one. |
Good stuff! I'll be implementing this on the Tigurius server soon as a get a free chunck of time.
|
FYI Wes and Solar are revamping the quest code, been planned for a while :P
|
Forgot to document one effect:
CUMULATIVE_FLAG - This adds one to flag 50. TRIGGER_FLAGS 50 amt - This will check 50 for a certain amount. This is for multis of the same item, say you want 3 bone chips to result in a reward. TRIGGER_ITEM:bonechip:{ CUMULATIVE_FLAG } TRIGGER_FLAGS 50 3{ Reward here } |
Just 1 question about the CUMULATIVE_FLAG
Well, maybe 2 questions. How do you reset the flag to 0 (zero) once the turn ins are complete? Are stackable items implemented in this? Does not seem to work for me. If i put a stack of 4, I get 1 increment on the flag. For example, bone chips for faction. if i turn in 4 stacks of 4 I should get 4 faction hits. I am only getting 1. Then each time i turn in a single bone chip i get another fation hit. Am i missing something? -=CyberT=- |
You need to put the faction hit under TRIGGER_FLAGS 50 4, which will automatically reset it to 0.
|
Looks very interesting - I'll have to see if I can incorporate some of these into my quest addon. Faction changes and (working) cash rewards in particular look useful.
Would it be possible to implement a single trigger command for multi-item turn-ins: E.g TRIGGER_MULTIITEM:13073:13073:13068:13068 which would be triggered when turning in 2 bone chips and 2 bat wings (think they are the right numbers). Because many quests require you to turn in several different items - e.g the Bard epic quest requires you to collect various parts for a lute. |
Quote:
Here is my script as it is currently written..... Code:
NPC_SCRIPT 37919{ Is the faction message supposed to show up and how do I check what my actual faction values are? -=CyberT=- |
CHANGEFACTION is broken, unfortunately. The flag not resetting thing is odd. A NPC_FLAG 50 0 would reset it, but it should do so automatically. Try changing to:
TRIGGER_FLAGS 50 4 { |
My change faction works fine, I think I made a small change to it. Ill check when I get home but I know for a fact it works for my scripts.
|
I know what I did. It was getting hung up on checking to see if the input was a number, so I just removed the check:
Code:
else if (strstr(command,"CHANGEFACTION") != NULL) { |
Awesome, I cant wait to get this recompiled and test it.
edit... Finally got it recompiled with changes and it is working great. Now, I was assuming that in order to be able to accept all 4 bone chips at once, I needed to have 4 trigger_item lines for same item. with cumulative_flag being incremented in all 4 lines it gives the "award" on every turn-in after the original 4. if i change the last trigger to not increment teh flag, it works properly but does not register the fourth item in the same turn in. so i have gone back to requiring 1 item at a time. works perfectly that way. Just a little slow. Well, at least the faction changes are working now. -=CyberT=- |
In order for it to increment 4 items at a time, you have to change the item trading in client_process to use TradeList[0-3] not just 0.
|
Quote:
Code:
CheckQuests(zone->GetShortName(), "%%item%%", tmp->CastToNPC()->GetNPCTypeID(), TradeList[0], tmp); Code:
CheckQuests(zone->GetShortName(), "%%item%%", tmp->CastToNPC()->GetNPCTypeID(), TradeList[0-3], tmp); |
Im amazed that even compiled...
I didnt think you could put an array range in.. You might want to try something more like this, but don't know 100% if it will work, im just guessing... CheckQuests(zone->GetShortName(), "%%item%%", tmp->CastToNPC()->GetNPCTypeID(), TradeList[0], tmp); CheckQuests(zone->GetShortName(), "%%item%%", tmp->CastToNPC()->GetNPCTypeID(), TradeList[1], tmp); CheckQuests(zone->GetShortName(), "%%item%%", tmp->CastToNPC()->GetNPCTypeID(), TradeList[2], tmp); CheckQuests(zone->GetShortName(), "%%item%%", tmp->CastToNPC()->GetNPCTypeID(), TradeList[3], tmp); |
Got it working for a 4 identical item turn in. 1 in each slot. Here is the code change...
Code:
for (int inum = 0; inum<4; inum++) { |
Quote:
|
Sounds very impressive! Looks like I'd better wait for the next EQEmu version before doing any more quest work.
|
My Little Extra for wesquest.cpp
after seeing the LEVEL_CHECK script command i got thinking and added CLASS_CHECK sort of the same, just checks class. its intened for single class only quests at the moment, i might update it abit. here is the code for it (to be added in wesquest.cpp)
else if (strstr(command,"CLASS_CHECK") != NULL) { int8 classpc = this->GetClass(); int8 classreq = atoi(sep.arg[1]); if(classpc != classreq) { entity_list.NPCMessage(other,true,200,0,"%s says, 'I will have nothing to do with such as you. Begone.'",other->GetName()); break; } ps = true; } so enjoy it, ill proberly next work on a RANDOM_TEM_SPAWN for nobo quests you sometimes get monye, noob items or random spells soon (when im not working) enjoy |
extra info i forgot about CLASS_CHECK
hehe forgot to explain how to use it
in ya quest file just add LEVEL_CHECK 12 (or class number) this will only allow wizards to do the quest. full list of classes are as followed (from ref sheet) 1 Warrior 2 Cleric 3 Paladin 4 Ranger 5 Shadow Knight 6 Druid 7 Monk 8 Bard 9 Rogue 10 Shaman 11 Necromancer 12 Wizard 13 Magician 14 Enchanter 15 Beastlord 16 Banker 17 GM Warrior 18 GM Cleric 19 GM Paladin 20 GM Ranger 21 GM ShadowKnight 22 GM Druid 23 GM Monk 24 GM Bard 25 GM Rogue 26 GM Shaman 27 GM Necromancer 28 GM Wizard 29 GM Magician 30 GM Enchanter 31 GM Beastlord 32 Shopkeeper so if you only wanted a banker to be able to do the quest you would add CLASS_CHECK 16 |
New Functions in wesquest.cpp
hey iv added 2 new functions to wesquest.cpp thry are
HAVE_ITEM (will check if you have a Item, on, in inventory or in the bank) and HAVE_ITEM_ON (will check if you have the item on your person ) examples: HAVE_ITEM_ON 26776 HAVE_ITEM 1000 hope ya enjoy them Code: else if (strstr(command,"HAVE_ITEM_ON") != NULL) // Have a item on them, in their inventory { int8 hio = 0; for (int inum=0; inum<80; inum++) { if (inum < 10 && this->pp.cursorbaginventory[inum] == atoi(sep.arg[1])) hio = 1; if (inum < 30 && this->pp.inventory[inum] == atoi(sep.arg[1]) ) inum = 1; if (inum < 80 && this->pp.containerinv[inum] == atoi(sep.arg[1]) ) hio = 1; } if(!hio) { entity_list.NPCMessage(other,true,200,0,"%s says, 'I will have nothing to do with such as you. Begone.'",other->GetName()); break; } ps = true; } else if (strstr(command,"HAVE_ITEM") != NULL) // Have a item on them, in their inventory or in the bank { int8 hiob = 0; for (int inumb=0; inumb<80; inumb++) { if (inumb < 80 && this->pp.bank_inv[inumb] == atoi(sep.arg[1]) ) if (inumb < 10 && this->pp.cursorbaginventory[inumb] == atoi(sep.arg[1])) hiob = 1; if (inumb < 30 && this->pp.inventory[inumb] == atoi(sep.arg[1]) ) hiob = 1; if (inumb < 80 && this->pp.containerinv[inumb] == atoi(sep.arg[1]) ) hiob = 1; } if(!hiob) { entity_list.NPCMessage(other,true,200,0,"%s says, 'I will have nothing to do with such as you. Begone.'",other->GetName()); break; } ps = true; } |
All times are GMT -4. The time now is 10:49 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.