Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 10-16-2002, 12:33 AM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default 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. :)
Reply With Quote
  #2  
Old 10-16-2002, 03:11 AM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

Uploaded a small fix, NPC's were calling faction checks on attacks/deaths.
Reply With Quote
  #3  
Old 10-16-2002, 03:13 AM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

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.
Reply With Quote
  #4  
Old 10-17-2002, 05:08 AM
Wynsom
Sarnak
 
Join Date: Oct 2002
Posts: 36
Default

Good stuff! I'll be implementing this on the Tigurius server soon as a get a free chunck of time.
Reply With Quote
  #5  
Old 10-17-2002, 08:23 AM
DeletedUser
Fire Beetle
 
Join Date: Sep 2002
Posts: 0
Default

FYI Wes and Solar are revamping the quest code, been planned for a while :P
Reply With Quote
  #6  
Old 10-18-2002, 05:56 AM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

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
}
Reply With Quote
  #7  
Old 01-26-2003, 12:16 AM
cybert
Fire Beetle
 
Join Date: Jan 2003
Posts: 6
Default

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=-
Reply With Quote
  #8  
Old 01-26-2003, 04:14 AM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

You need to put the faction hit under TRIGGER_FLAGS 50 4, which will automatically reset it to 0.
Reply With Quote
  #9  
Old 01-26-2003, 04:33 AM
Drawde
Dragon
 
Join Date: Jan 2002
Posts: 521
Default

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.
Reply With Quote
  #10  
Old 01-26-2003, 12:11 PM
cybert
Fire Beetle
 
Join Date: Jan 2003
Posts: 6
Default

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=-
Reply With Quote
  #11  
Old 01-26-2003, 08:09 PM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

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 {
Reply With Quote
  #12  
Old 01-27-2003, 09:33 AM
Edgar1898
Senior Member
Former EQEmu Developer
Current EQ2Emu Lead Developer
 
Join Date: Dec 2002
Posts: 1,065
Default

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.
__________________
Lethal Encounter
Reply With Quote
  #13  
Old 01-27-2003, 02:10 PM
Edgar1898
Senior Member
Former EQEmu Developer
Current EQ2Emu Lead Developer
 
Join Date: Dec 2002
Posts: 1,065
Default

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...
__________________
Lethal Encounter
Reply With Quote
  #14  
Old 01-27-2003, 04:33 PM
cybert
Fire Beetle
 
Join Date: Jan 2003
Posts: 6
Default

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=-
Reply With Quote
  #15  
Old 01-30-2003, 01:45 AM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 07:05 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3