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-25-2003, 09:20 AM
used_pawn
Sarnak
 
Join Date: Apr 2003
Posts: 53
Default code for opening MANY doors/gates with one click

Here is some code that I use for multiple doors opening with one click (ie large gates made of many in a row is one usage)

the idea is to point each door to the next door, and the last door back to the first in the 'triggerdoor' column of doors db (this way all the doors can open all the doors, other combos are possible) then you put in each door's triggertype column the total number of doors in the chain (this prevents an endless loop on this example)

works great on my server.
I apollogize now, as my line numbers in the code dont match up anymore with CVS. I included a lot of surrounding code and commented out what section I replaced.

../zone/client_process.cpp : line 5001 or thereabouts

Code:
						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);
									//md->action = 0x02;
								}
								else
								{
								    triggerdoor->HandleClick(this);
									//md->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;
							}
						}
						*/
//used_pawn
						bool doorchain=false;
						int8 chaincount=0;
						int8 loopcount=1;
						Doors* triggerdoor;

						if(currentdoor->GetTriggerDoorID() != 0)
						{
							doorchain=true;
							chaincount=currentdoor->GetTriggerType();
						}

						while(doorchain && (loopcount<=chaincount))
						{
							triggerdoor = entity_list.FindDoor(currentdoor->GetTriggerDoorID());
							if(triggerdoor)
							{
								if(!triggerdoor->IsDoorOpen())
								    triggerdoor->HandleClick(this);
								else
								    triggerdoor->HandleClick(this);
								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;
							}
							loopcount++;
							currentdoor=triggerdoor;
							doorchain=false;
							if(currentdoor->GetTriggerDoorID() != 0) 
								doorchain=true;
						}
//used_pawn
						break;
					}
					case OP_CreateObject: {
Here is an example of a long gate in qeynos pvp area. Watch your id values, yours may vary (mine I replaced some 'invisible plugs' (type 54) in qeynos)

Code:
INSERT INTO doors VALUES (821,57,'qeynos','PORT1414',105.1,-428.4,0.001,0,66,0,0,0,58,3,'0',0,0,0,0);
INSERT INTO doors VALUES (822,58,'qeynos','PORT1414',105.1,-440.9,0.001,0,66,0,0,0,59,3,'0',0,0,0,0);
INSERT INTO doors VALUES (823,59,'qeynos','PORT1414',105.1,-453.4,0.001,0,66,0,0,0,57,3,'0',0,0,0,0);
I used the 'triggertype' column on a whim because I couldnt figure out where it was used at all in the code (cept for the value 255).
I dunno if anyone thinks this is necessary to the project, but I didnt remember all long gates being separate pieces.

Enjoy!
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:47 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