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.
|
All times are GMT -4. The time now is 10:13 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.