EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   Modified WesQuests.cpp for multi item turnins and more (https://www.eqemulator.org/forums/showthread.php?t=3453)

Wiz 10-16-2002 12:33 AM

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 t_npc trigger must be added to existing references to CheckQuests as well, such as dying, talking, etc.

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);
This must be added to mob.h:

Code:

        int8    flag[60];
And this to Mob::Mob in mob.cpp:

Code:

        for (int m = 0; m < 60; m++)
        {
                flag[m]=0;
        }

This version sports the following triggers and effects:

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 {
CHANCE 5
SPAWN_NPC 366
}
END_FILE

5% chance of spawning NPC 366 on death of the mob.

Code:

TRIGGER_TEXT:Hail:{
SAY:Rrr, ya want a fight? Huh? Hah! Don't look so scared, just joking with ya. //Simple hail message
}
TRIGGER_TEXT:What sparring gloves:{
FACTION_CHECK 5 //Checks that faction is at least indifferent
SAY:Hmf! Can't get any proper sparring gloves for hand combat nowadays. The stuff we get breaks after a week! The tailor, Vayla, used to make us real stuff, but she said she ran out of materials. If you can get me four pairs of sparring gloves, and give them to my novices, I'd be grateful.
}
//Below are the old broken sparring gloves you get back when you give new ones to the novices.
TRIGGER_ITEM:3011:{
FACTION_CHECK 5
NPC_FLAG 1 1 //Sets flag 1 to 1
}
TRIGGER_ITEM:3012:{
FACTION_CHECK 5
NPC_FLAG 2 1 //Sets flag 2 to 1
}
TRIGGER_ITEM:3013:{
FACTION_CHECK 5
NPC_FLAG 3 1 //Sets flag 3 to 1
}
TRIGGER_ITEM:3014:{
FACTION_CHECK 5
NPC_FLAG 4 1 //Sets flag 4 to 1
}
TRIGGER_ATTACK {
SAY:YAR! AXE TO THE HEAD! //Attack message
}
TRIGGER_DEATH {
SAY:*cough* Good fight... good fi... argh.
}
TRIGGER_FLAGS 1 2 3 4 { //Always put trigger_flags last in the file. This will run when all 4 items are given in.
CHANGEFACTION 28 20
EXP 100
SAY:Thanks, sonny. Now I might be able to teach these bullheads something. Here, I think Wargus'll want this.
SPAWN_ITEM 3015
}
END_FILE //Put this at the end

WesQuests.cpp

Have fun. :)

Wiz 10-16-2002 03:11 AM

Uploaded a small fix, NPC's were calling faction checks on attacks/deaths.

Trumpcard 10-16-2002 03:13 AM

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.

Wynsom 10-17-2002 05:08 AM

Good stuff! I'll be implementing this on the Tigurius server soon as a get a free chunck of time.

DeletedUser 10-17-2002 08:23 AM

FYI Wes and Solar are revamping the quest code, been planned for a while :P

Wiz 10-18-2002 05:56 AM

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
}

cybert 01-26-2003 12:16 AM

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=-

Wiz 01-26-2003 04:14 AM

You need to put the faction hit under TRIGGER_FLAGS 50 4, which will automatically reset it to 0.

Drawde 01-26-2003 04:33 AM

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.

cybert 01-26-2003 12:11 PM

Quote:

Originally Posted by Wiz
You need to put the faction hit under TRIGGER_FLAGS 50 4, which will automatically reset it to 0.

OK I have edited the script again to give the faction and exp. This quest should now work exactly like EQ Live.

Here is my script as it is currently written.....

Code:

NPC_SCRIPT 37919{
TRIGGER_TEXT:Hail, Trooper Mozo:{
EMOTE:looks on you smugly. 'And what are you? Some sort of adventurer. Bah!! You will be shaken by the first undead you come across. Wetting your pants you shall be. Ha ha!! I doubt you could even [kill the decaying skeletons].'
}

TRIGGER_TEXT:kill the decaying skeletons:{
SAY:You kill skeletons?!! I think not!! They will bounce you with no trouble at all. Ten silver says you cannot collect four bone chips!! When Velious melts!! Hah!
}

TRIGGER_ITEM:13073:{
CUMULATIVE_FLAG
}
TRIGGER_ITEM:13073:{
CUMULATIVE_FLAG
}
TRIGGER_ITEM:13073:{
CUMULATIVE_FLAG
}
TRIGGER_ITEM:13073:{
CUMULATIVE_FLAG
}

TRIGGER_FLAGS 50 4{
EMOTE:gasps in astonishment.  Wha..?  This!!  But..  I..  Why you..  I oughta.. Alright!!  A bet is a bet.  Here you go.  A few silver pieces for your achievement.  What?!!  You thought I would give ten?  Fat chance!  Now get lost or I will haul you in for impersonating a froglok.
CHANGEFACTION 2058 10
CHANGEFACTION 2213 10
CHANGEFACTION 2363 10
CHANGEFACTION 2347 10
CHANGEFACTION 2080 10
GIVE_CASH 70
EXP 100
}
}

Problem is that I get no notification of the faction adjustment. And then every time I turn in just 1 bone chip, I get more exp and the cash. The flag is not resetting.

Is the faction message supposed to show up and how do I check what my actual faction values are?

-=CyberT=-

Wiz 01-26-2003 08:09 PM

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 {

Edgar1898 01-27-2003 09:33 AM

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.

Edgar1898 01-27-2003 02:10 PM

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) {
                                this->CastToClient()->SetFactionLevel2(this->CastToClient()->CharacterID(),atoi(sep.arg[1]), this->CastToClient()->GetClass(), this->CastToClient()->GetRace(), this->CastToClient()->GetDeity(), atoi(sep.arg[2]));
                                this->CastToClient()->Message(0,BuildFactionMessage(GetCharacterFactionLevel(atoi(sep.arg[1])),atoi(sep.arg[1]),atoi(sep.arg[2])));
                        ps = true;
                }

It works fine now...

cybert 01-27-2003 04:33 PM

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=-

Wiz 01-30-2003 01:45 AM

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.