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 |
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.... |
Quote:
...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); } } } |
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! |
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.
|
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 |
EDIT: double posted, oops, deleting
|
Quote:
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 |
Looks good, I'll try to get this in for you guys tonight. Good work !
|
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! |
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 |
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 |
Ok, merged the last set into CVS. Check it out and certify please.
|
Quote:
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. |
That was from my original attempt to add it when you listed the wrong header. Its been removed in the dev-cvs.
|
All times are GMT -4. The time now is 01:59 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.