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 06-11-2003, 06:47 PM
used_pawn
Sarnak
 
Join Date: Apr 2003
Posts: 53
Default Added code for locked doors, picking locks etc...

I dont know how to submit for CVS, so ill put it here (hope thats ok)
changes are to CVS code current as of june 11, 10pm CST

(/zone/doors.h) new code at line 33

//used_pawn
int16 GetKeyItem() {return keyitem;}
int16 GetLockpick() {return lockpick;}
//

(/zone/client_process.cpp) new code at line 4904

//used_pawn: Locked doors! Rogue friendly too =)
//TODO: add check for other lockpick items
if((currentdoor->GetKeyItem()==0) || (currentdoor->GetKeyItem()==this->GetItemAt(0)))
{
if(!currentdoor->IsDoorOpen())
{
currentdoor->HandleClick(this);
md->action = 0x02;
}
else
{
currentdoor->HandleClick(this);
md->action = 0x03;
}
}
else
{
if((this->GetItemAt(0)==13010)&&(this->GetSkill(35)>0))
{
if(rand()%100<2)this->SetSkill(35,this->GetSkill(35)+1);
if(rand()%currentdoor->GetLockpick()<=this->GetSkill(35))
{
if(!currentdoor->IsDoorOpen())
{
currentdoor->HandleClick(this);
md->action = 0x02;
}
else
{
currentdoor->HandleClick(this);
md->action = 0x03;
}
Message(4,"You picked the lock!");
}
else
{
Message(4,"Your skill is not high enough for this door.");
}
}
else
{
Message(4,"It's locked and you don't have the key!");
}
}
//end used_pawn

(/zone/client_process.cpp) old code to be replaced at line 4904

if(!currentdoor->IsDoorOpen())
{
currentdoor->HandleClick(this);
md->action = 0x02;
}
else
{
currentdoor->HandleClick(this);
md->action = 0x03;
}

sorry, my tabs didnt copy/paste =(
it works very well,has chance of success if skill to low on pick locks, has messages (close as i remember to eqlive) and skill increases for pick locks (chance for increase is 1% per attempt, may need adjusted)
not sure if i need to check if client is a rogue/bard (it ignores picking locks if skill = 0 )
i dont know if i need to check for maxskill on pick locks or not (i assumed the setskill() handles this, please let me know if i assumed wrong)
Also, i dont remember what all items can be used for picking locks so only the basic lockpicks are valid

EDIT: edited to reflect errors i had made in the post
Reply With Quote
  #2  
Old 06-11-2003, 06:55 PM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

Post diffs if you can..

line33 in zone.h is around the zonepoint struct, im assuming you want these functions to be in the public section of the zone class...

And in client process, i cant tell if you replaced exisitng funcitons, or completely new..

Please post the changed .cpp files, or diffs, or EXACT instructions. I'll merge in what I see in COMMENTS.


Also, whats

int16 GetKeyItem() {return keyitem;}
int16 GetLockpick() {return lockpick;}

You dont define keyitem or lockpick anywhere, so until those are defined, those are unknown variables....
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
Reply With Quote
  #3  
Old 06-11-2003, 07:14 PM
Zern
Sarnak
 
Join Date: Nov 2002
Posts: 35
Default

Quote:
Originally Posted by Trumpcard
Post diffs if you can..

line33 in zone.h is around the zonepoint struct, im assuming you want these functions to be in the public section of the zone class...

And in client process, i cant tell if you replaced exisitng funcitons, or completely new..

Please post the changed .cpp files, or diffs, or EXACT instructions. I'll merge in what I see in COMMENTS.


Also, whats

int16 GetKeyItem() {return keyitem;}
int16 GetLockpick() {return lockpick;}

You dont define keyitem or lockpick anywhere, so until those are defined, those are unknown variables....

...keyitem and lockpick are variables in the doors header file.

(I think he ment doors.h instead of zone.h --- but maybe I am wrong)


*********************************************
EDIT
*********************************************

Please note give all credit to used_pawn for the initial code - I'm just bored right now and thought I'd add some to the code provided.



The following code takes his code where it checks for if the client is holding the key for the door/object on the cursor and checks if the skill of the client is greater than zero ... also the end of his code (your sniplet used_pawn ) opens the door anyways ... which should be enclosed inside a pair of {}'s where it checks for a successful lock pick or if the client actually has the key ... but here is the code ...


else if( this->GetClass() == 8 || this->GetClass() == 9 ) //: Check if the class is a bard or a rogue
{

int16 Cursor_Item = this->GetItemAt(0);
int16 Gloves_Item = this->GetItemAt(12); // Glove/hand slot
bool Has_LockPicks = false;
float Skill_Mod = 0.0f;
float Final_PickSkill = 0.0f;


if(Cursor_Item == 13010) // Normal Lockpicks - no skill mod
Has_LockPicks = true;
else if(Cursor_Item == 16865 ) // Mechanical(spelt Mechanized in the db) lockpicks ...3% skill mod
{

Skill_Mod = 0.03f;
Has_LockPicks = true;

}

if( Gloves_Item == 19702 ) // Gloves of the brood - 3% skill mod
Skill_Mod = 0.03f;



if( Has_LockPicks == true )
{

Final_PickSkill = Skill_Mod * (GetSkill(35));
if( Final_PickSkill > currentdoor->LockPick() )
{

this->Message(4, "You have successfully picked the pick!");


if(!currentdoor->IsDoorOpen())
{

currentdoor->HandleClick(this);
md->action = 0x02;

}
else
{

currentdoor->HandleClick(this);
md->action = 0x03;

}


int8 action = md->action;
entity_list.QueueClients(this,outapp,false);
delete outapp;


if(currentdoor->GetTriggerDoorID() != 0)
{

Doors* triggerdoor = entity_list.FindDoor(currentdoor->GetTriggerDoorID());

if(triggerdoor)
{

if(!triggerdoor->IsDoorOpen())
{

triggerdoor->HandleClick(this);
action = 0x02;

}
else
{

triggerdoor->HandleClick(this);
action = 0x03;

}


outapp = new APPLAYER(OP_MoveDoor, sizeof(MoveDoor_Struct));
MoveDoor_Struct* md=(MoveDoor_Struct*)outapp->pBuffer;
md->doorid = triggerdoor->GetDoorID();
md->action = action;
entity_list.QueueClients(this,outapp,false);
delete outapp;

}
}
}


// Chance to increase the skill if it is not maxxed
if( this->GetSkill(35) < this->MaxSkill(35) )
{

sint16 Chance = 1; // 1% chance to increase the skill (not sure if this is right..)

if (rand()%100 == Chance)
SetSkill(skillid,GetSkill(35)+1);


}
}
}
Reply With Quote
  #4  
Old 06-12-2003, 12:08 AM
used_pawn
Sarnak
 
Join Date: Apr 2003
Posts: 53
Default

hehe, ah what things i do when im up too late at night...

yes, i meant doors.h, dont know what my eyes were doin
also, the section new code is to replace the section old code in client_process (not merge in ahead of it as it is in the CVS)

sorry i really have no idea how to do a diff file.

good stuff zern...i didnt handle everything, seems you caught the rest, far as i can tell

all in all, I just wanted locked doors, hehe
adding fixes and zerns suggestions to code, will submit in a bit

thanks for all feedback!
Reply With Quote
  #5  
Old 06-12-2003, 01:01 AM
kathgar
Discordant
 
Join Date: May 2002
Posts: 434
Default

Well just use the CODE tags, file, line number, 1-3 lines before your changes and 1-3 after for ever change and we can easily go through and find what you mean.
__________________
++[>++++++<-]>[<++++++>-]<.>++++[>+++++<-]>[<
+++++>-]<+.+++++++..+++.>>+++++[<++++++>-]<+
+.<<+++++++++++++++.>.+++.------.--------.>+.
Reply With Quote
  #6  
Old 06-12-2003, 01:35 AM
used_pawn
Sarnak
 
Join Date: Apr 2003
Posts: 53
Default

OK.. got my groove on now..here is the 'final' version
complete with lockpick items suggested by zern and their skill mods
again, sorry about my original post, guess i shouldn't do that when im up past my bed time, hehe

(/zone/doors.h) new code at line 33
//used_pawn
int16 GetKeyItem() {return keyitem;}
int16 GetLockpick() {return lockpick;}
//

(/zone/client_process.cpp) line 4904

REPLACE this section:
if(!currentdoor->IsDoorOpen())
{
currentdoor->HandleClick(this);
md->action = 0x02;
}
else
{
currentdoor->HandleClick(this);
md->action = 0x03;
}

with this:
//used_pawn: Locked doors! Rogue friendly too =)
if((currentdoor->GetKeyItem()==0) || (currentdoor->GetKeyItem()==this->GetItemAt(0)))
{
//door not locked, or door is locked & client is using key
if(!currentdoor->IsDoorOpen())
{
currentdoor->HandleClick(this);
md->action = 0x02;
}
else
{
currentdoor->HandleClick(this);
md->action = 0x03;
}
}
else
{
//door is locked, client is NOT using key
if(this->GetSkill(35)>0) //no need to check for class, only bard/rogue will (should) have picklocks skill > 0, allows GM's to picklocks also
{
bool has_lockpicks=false;
float modskill=0.0f;

if(this->GetItemAt(0)==13010) //lockpicks
{
modskill=this->GetSkill(35); //no skill mod
has_lockpicks=true;
}
if ((this->GetItemAt(0)==16865)||(this->GetItemAt(12)==19702)) //mechanized lockpicks and gloves of the brood
{
modskill=0.3f*this->GetSkill(35)+this->GetSkill(35); //3% skill mod
has_lockpicks=true;
}
if(has_lockpicks)
{
if(rand()%100<2)this->SetSkill(35,this->GetSkill(35)+1); //1% chance skill increase
if((float)(rand()%currentdoor->GetLockpick())<=modskill)
{
if(!currentdoor->IsDoorOpen())
{
currentdoor->HandleClick(this);
md->action = 0x02;
}
else
{
currentdoor->HandleClick(this);
md->action = 0x03;
}
Message(4,"You picked the lock!");
}
else
{
Message(4,"Your skill is not high enough for this door.");
}
}
else
{
Message(4,"It's locked and you don't have the key!");
}
}
}
//end used_pawn
Reply With Quote
  #7  
Old 06-12-2003, 01:39 AM
used_pawn
Sarnak
 
Join Date: Apr 2003
Posts: 53
Default

EDIT: double posted, oops, deleting
Reply With Quote
  #8  
Old 06-12-2003, 03:41 AM
Zern
Sarnak
 
Join Date: Nov 2002
Posts: 35
Default

Quote:
Originally Posted by used_pawn
hehe, ah what things i do when im up too late at night...

Don't worry, we all do it :P - see I even forgot to take the skill of the PickLock_Mod, multiply it by the PickLock_SKill then add that result the original skill value to get the final value.

lol oh well. Good job again.


-David
Reply With Quote
  #9  
Old 06-12-2003, 05:28 AM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

Looks good, I'll try to get this in for you guys tonight. Good work !
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
Reply With Quote
  #10  
Old 06-12-2003, 03:03 PM
used_pawn
Sarnak
 
Join Date: Apr 2003
Posts: 53
Default

Ahh...never done

After some research on the web, talking to a couple EQlive'ers and some thought, I have some updates coming.

a few items im working on:
1. no skill checks/messages while door is opening/closing =)
2. locked door triggers (ie. the paineel rock trigger for the elevator)
3. chances of opening/skill point increase closer to EQlive (i guess there is always a chance of failure)
4. researching if there was a trivial message for doors

hopefully I will be done with these soon!
Reply With Quote
  #11  
Old 06-14-2003, 09:52 AM
IARivinwise
Fire Beetle
 
Join Date: May 2003
Posts: 3
Default

Stupid question, but if you code the items based on values from the database. If those items were changed because they aren't using the default database, doesn't that brake the code?

Let me rephrase that, I see that it doesn't break it. But if they aren't where they should be how do we get them back if the item database is changed? New database flag? /hides
Reply With Quote
  #12  
Old 06-14-2003, 11:06 AM
Lurker_005
Demi-God
 
Join Date: Jan 2002
Location: Tourist town USA
Posts: 1,671
Default

Instead of checking for item numbers, the item type should include a value for lockpicks. For skill mods I know that information is in there too. That way it is based on the actual item stats like it should.

I think:
skill
skillModId
skillModPercent

Are the item properties you want
__________________
Please read the forum rules and look at reacent messages before posting.
Reply With Quote
  #13  
Old 06-14-2003, 02:34 PM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

Ok, merged the last set into CVS. Check it out and certify please.
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
Reply With Quote
  #14  
Old 06-14-2003, 05:37 PM
used_pawn
Sarnak
 
Join Date: Apr 2003
Posts: 53
Default

Quote:
Originally Posted by Trumpcard
Ok, merged the last set into CVS. Check it out and certify please.
only problem i found is no code is added to zone.h, its doors.h

Ok, as for item skill, skillmod etc. instead of using item number, I must say you guys are correct, and I am working on that very thing in my update.
Reply With Quote
  #15  
Old 06-14-2003, 06:10 PM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

That was from my original attempt to add it when you listed the wrong header. Its been removed in the dev-cvs.
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
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 05:38 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