Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Custom

Quests::Custom Custom Quests here

Reply
 
Thread Tools Display Modes
  #1  
Old 06-20-2010, 02:17 PM
Zordana
Sarnak
 
Join Date: Jan 2010
Posts: 38
Default Object Builder

Secrets has made a very very nice perl implementation!
http://www.eqemulator.org/forums/sho...d.php?p=188939


I created an Object Builder NPC - many thanks to Secrets for this great perlport!
Create an NPC with that perl code and Hail him!

Info:
When setting the model, you can skip the _ACTORDEF, it will be automatically added

Code:
sub EVENT_SAY {
	
	if (!$client->GetGM()) {
		$client->Message(15, "You have no access to object creation!");
		return;
	}
	
	if ($text =~ /Hail/) {
		$client->Message(15, "Object Creation Commandlist");
		$client->Message(15, "=============");
		$client->Message(15, "object dbdel [object_id]");
		$client->Message(15, "object dbsave [object_id]");
		$client->Message(15, "object create fromitem [itemid]");
		$client->Message(15, "object create frommodel [model]");
		$client->Message(15, "object list");
		$client->Message(15, "object set [object_id] location [x] [y] [z]");
		$client->Message(15, "object set [object_id] model [model]");
		$client->Message(15, "object set [object_id] type [0-255]");
		$client->Message(15, "object view [object_id]");
		$client->Message(15, "=============");
		$client->Message(15, "End of list");
		return;
	}
	
	@arguments = split(' ',$text);
	if ($arguments[0] ne "object") {
		return;
	}

	
	if ($arguments[1] eq "list") {
		my @objectList = $entity_list->GetObjectList();
		$client->Message(15, "Object list: ");
		$client->Message(15, "=============");
		foreach my $object (@objectList) {
			$client->Message(15, GetObjectInfo($object));
		}
		$client->Message(15, "=============");
		$client->Message(15, "End of list");
	}
	
	if ($arguments[1] eq "view") {
		$obj = $entity_list->GetObjectByID($arguments[2]);
		if (!$obj) {
			$client->Message(15, "Object with ID ".$arguments[2]." does not exist!");
		}
		else {
			$client->Message(15, GetObjectInfo($obj));
		}
	}
	
	if ($arguments[1] eq "create") {
		if ($arguments[2] eq "frommodel") {
			$model = BuildObjectModel($arguments[3]);
			$entityId = quest::creategroundobjectfrommodel($model, $x, $y, $z, $h);
			$client->Message(15, "Object created.");
			$obj = $entity_list->GetObjectByID($entityId);
			$client->Message(15, GetObjectInfo($obj));
		}
		if ($arguments[2] eq "fromitem") {
			$itemid = $arguments[3];
			$entityId = quest::creategroundobject($itemid, $x, $y, $z, $h);
			$client->Message(15, "Object created.");
			$obj = $entity_list->GetObjectByID($entityId);
			$client->Message(15, GetObjectInfo($obj));
		}
	}
	
	if ($arguments[1] eq "set") {
		$entityId = $arguments[2];
		$obj = $entity_list->GetObjectByID($arguments[2]);
		if (!$obj) {
			$client->Message(15, "Object with ID ".$arguments[2]." does not exist!");
		}
		else {
			my $updated = false;
			if ($arguments[3] eq "location") {
				if ($arguments[6] eq "") {
					$client->Message(15, "Usage: set [ObjectID] location x y z");
				}
				else {
					$obj->SetX($arguments[4]);
					$obj->SetY($arguments[5]);
					$obj->SetZ($arguments[6]);
					$updated = true;
				}
			}
			if ($arguments[3] == "model") {
				if ($arguments[4] eq "") {
					$client->Message(15, "Usage: set [ObjectID] model modelname");
				}
				else {
					$obj->SetModelName(BuildObjectModel($arguments[4]));
					$updated = true;
				}
			}
			if ($arguments[3] == "type") {
				if ($arguments[4] eq "") {
					$client->Message(15, "Usage: set [ObjectID] type [0-255]");
				}
				else {
					$obj->SetType($arguments[4]);
					$updated = true;
				}
			}
			
			
			if ($updated) {
				$client->Message(15, "Object Updated.");
				$client->Message(15, GetObjectInfo($obj));
			}
		}
	}
	
	if ($arguments[1] eq "dbsave") {
		$entityId = $arguments[2];
		$obj = $entity_list->GetObjectByID($entityId);
		if (!$obj) {
			$client->Message(15, "Object with ID ".$entityId." does not exist!");
		}
		else {
			$newid = $obj->VarSave();
			$client->Message(15, "Object saved to database: ID $newid");
			$client->Message(15, GetObjectInfo($obj));
		}
	}	
	if ($arguments[1] eq "dbdel") {
		$entityId = $arguments[2];
		$obj = $entity_list->GetObjectByID($arguments[2]);
		if (!$obj) {
			$client->Message(15, "Object with ID ".$arguments[2]." does not exist!");
		}
		else {
			$newid = $obj->Delete();
			$client->Message(15, "Object deleted from database");
			$client->Message(15, GetObjectInfo($obj));
		}
	}		
}


sub GetObjectInfo {
	my $object = $_[0];
	my $seperator = " || ";
	return "Object: ".
	"id: ".$object->GetID()
	.$seperator.
	 ($object->GetDBID() == 0 ? "not in db" : "dbid: ".$object->GetDBID())
	.$seperator.
	"type: ".$object->GetType()
	.$seperator.
	"model: ".$object->GetModelName()
	.$seperator.
	"location x,y,z, heading: ".int($object->GetX()).', '.int($object->GetY()).', '.int($object->GetZ()).", ".int($object->GetHeading())
	.$seperator.
	"icon: ".$object->GetIcon()
	.$seperator.
	"groundspawn: ".($object->IsGroundSpawn() ? "yes" : "no")
	;
}
sub BuildObjectModel {
	my $model = $_[0];
	if (substr($model,length($model)-9,9) ne "_ACTORDEF") {
		$model = $model . "_ACTORDEF";
	}
	return $model;
}
Reply With Quote
  #2  
Old 09-11-2010, 07:09 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,071
Default

Quote:
Originally Posted by Zordana View Post
Secrets has made a very very nice perl implementation!
http://www.eqemulator.org/forums/sho...d.php?p=188939


I created an Object Builder NPC - many thanks to Secrets for this great perlport!
Create an NPC with that perl code and Hail him!

Info:
When setting the model, you can skip the _ACTORDEF, it will be automatically added

Code:
sub EVENT_SAY {
	
	if (!$client->GetGM()) {
		$client->Message(15, "You have no access to object creation!");
		return;
	}
	
	if ($text =~ /Hail/) {
		$client->Message(15, "Object Creation Commandlist");
		$client->Message(15, "=============");
		$client->Message(15, "object dbdel [object_id]");
		$client->Message(15, "object dbsave [object_id]");
		$client->Message(15, "object create fromitem [itemid]");
		$client->Message(15, "object create frommodel [model]");
		$client->Message(15, "object list");
		$client->Message(15, "object set [object_id] location [x] [y] [z]");
		$client->Message(15, "object set [object_id] model [model]");
		$client->Message(15, "object set [object_id] type [0-255]");
		$client->Message(15, "object view [object_id]");
		$client->Message(15, "=============");
		$client->Message(15, "End of list");
		return;
	}
	
	@arguments = split(' ',$text);
	if ($arguments[0] ne "object") {
		return;
	}

	
	if ($arguments[1] eq "list") {
		my @objectList = $entity_list->GetObjectList();
		$client->Message(15, "Object list: ");
		$client->Message(15, "=============");
		foreach my $object (@objectList) {
			$client->Message(15, GetObjectInfo($object));
		}
		$client->Message(15, "=============");
		$client->Message(15, "End of list");
	}
	
	if ($arguments[1] eq "view") {
		$obj = $entity_list->GetObjectByID($arguments[2]);
		if (!$obj) {
			$client->Message(15, "Object with ID ".$arguments[2]." does not exist!");
		}
		else {
			$client->Message(15, GetObjectInfo($obj));
		}
	}
	
	if ($arguments[1] eq "create") {
		if ($arguments[2] eq "frommodel") {
			$model = BuildObjectModel($arguments[3]);
			$entityId = quest::creategroundobjectfrommodel($model, $x, $y, $z, $h);
			$client->Message(15, "Object created.");
			$obj = $entity_list->GetObjectByID($entityId);
			$client->Message(15, GetObjectInfo($obj));
		}
		if ($arguments[2] eq "fromitem") {
			$itemid = $arguments[3];
			$entityId = quest::creategroundobject($itemid, $x, $y, $z, $h);
			$client->Message(15, "Object created.");
			$obj = $entity_list->GetObjectByID($entityId);
			$client->Message(15, GetObjectInfo($obj));
		}
	}
	
	if ($arguments[1] eq "set") {
		$entityId = $arguments[2];
		$obj = $entity_list->GetObjectByID($arguments[2]);
		if (!$obj) {
			$client->Message(15, "Object with ID ".$arguments[2]." does not exist!");
		}
		else {
			my $updated = false;
			if ($arguments[3] eq "location") {
				if ($arguments[6] eq "") {
					$client->Message(15, "Usage: set [ObjectID] location x y z");
				}
				else {
					$obj->SetX($arguments[4]);
					$obj->SetY($arguments[5]);
					$obj->SetZ($arguments[6]);
					$updated = true;
				}
			}
			if ($arguments[3] == "model") {
				if ($arguments[4] eq "") {
					$client->Message(15, "Usage: set [ObjectID] model modelname");
				}
				else {
					$obj->SetModelName(BuildObjectModel($arguments[4]));
					$updated = true;
				}
			}
			if ($arguments[3] == "type") {
				if ($arguments[4] eq "") {
					$client->Message(15, "Usage: set [ObjectID] type [0-255]");
				}
				else {
					$obj->SetType($arguments[4]);
					$updated = true;
				}
			}
			
			
			if ($updated) {
				$client->Message(15, "Object Updated.");
				$client->Message(15, GetObjectInfo($obj));
			}
		}
	}
	
	if ($arguments[1] eq "dbsave") {
		$entityId = $arguments[2];
		$obj = $entity_list->GetObjectByID($entityId);
		if (!$obj) {
			$client->Message(15, "Object with ID ".$entityId." does not exist!");
		}
		else {
			$newid = $obj->VarSave();
			$client->Message(15, "Object saved to database: ID $newid");
			$client->Message(15, GetObjectInfo($obj));
		}
	}	
	if ($arguments[1] eq "dbdel") {
		$entityId = $arguments[2];
		$obj = $entity_list->GetObjectByID($arguments[2]);
		if (!$obj) {
			$client->Message(15, "Object with ID ".$arguments[2]." does not exist!");
		}
		else {
			$newid = $obj->Delete();
			$client->Message(15, "Object deleted from database");
			$client->Message(15, GetObjectInfo($obj));
		}
	}		
}


sub GetObjectInfo {
	my $object = $_[0];
	my $seperator = " || ";
	return "Object: ".
	"id: ".$object->GetID()
	.$seperator.
	 ($object->GetDBID() == 0 ? "not in db" : "dbid: ".$object->GetDBID())
	.$seperator.
	"type: ".$object->GetType()
	.$seperator.
	"model: ".$object->GetModelName()
	.$seperator.
	"location x,y,z, heading: ".int($object->GetX()).', '.int($object->GetY()).', '.int($object->GetZ()).", ".int($object->GetHeading())
	.$seperator.
	"icon: ".$object->GetIcon()
	.$seperator.
	"groundspawn: ".($object->IsGroundSpawn() ? "yes" : "no")
	;
}
sub BuildObjectModel {
	my $model = $_[0];
	if (substr($model,length($model)-9,9) ne "_ACTORDEF") {
		$model = $model . "_ACTORDEF";
	}
	return $model;
}
This works very slick bro, great job.
Reply With Quote
  #3  
Old 10-07-2011, 10:53 PM
Emmeric
Sarnak
 
Join Date: Aug 2011
Posts: 72
Default

I automatically get the "You have no access to object creation!" even though my account is set at 255.

Reply With Quote
  #4  
Old 10-08-2011, 02:37 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

#gm on first.
Reply With Quote
  #5  
Old 10-08-2011, 01:45 PM
Emmeric
Sarnak
 
Join Date: Aug 2011
Posts: 72
Default

Always something simple with me.

Thanks, the Hail works now.

Maybe now that I have that working, I could get a bit of pointer. I type in #object list and it says Usage:#object ListAll(radius)

So I typed in #object ListAll 30
#object ListAll 300
#object ListAll(30)
#object ListAll(300)

All near the small bank in PoK with no results. Keeps reprinting: Usage:#object ListAll(radius)

I figured I would pick up a crate or that wheelbarrow behind the building, but not getting any list. I am assuming that the radius will only return those items in range so I would have to find an item I want to place in another zone and then use that ID where I want to place?

So what about my usage isn't working?
Reply With Quote
  #6  
Old 10-08-2011, 06:00 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

If you're typing #object you're not using the NPC at all. Target the NPC and type 'object list'

As for the #object command, what the usage actually says is "Usage: #object List All|(radius)", which means you should type "#object list all", or "#object list 5000", depending on if you want to list all or just the ones within a certain distance from you.
Reply With Quote
  #7  
Old 10-08-2011, 09:15 PM
Emmeric
Sarnak
 
Join Date: Aug 2011
Posts: 72
Default

Okay, that makes sense once you said it. I did as you said and received responses about nearby objects.

I chose one and attempted to use object view, but it just reads out details. I don't actually see anything. Dunno if it's a crate, a torch, a wheelbarrow, a chair... who knows.

Not knowing what I chose, I did an object create which appeared to do nothing, then did an object set of item id 8 at my coordinates which returned yellow text indicating I created object 8 at my coordinates, but groundspawn NO. Didn't see anything.

Knowing all my previous questions and noobness, is this beyond me? I could just be satisfied with shit the way it is and stop wasting people's time... Gimme your opinion.
Reply With Quote
  #8  
Old 10-10-2011, 01:02 PM
revloc02c's Avatar
revloc02c
Hill Giant
 
Join Date: Aug 2010
Location: UT
Posts: 215
Default

Quote:
Originally Posted by Emmeric View Post
Knowing all my previous questions and noobness, is this beyond me? I could just be satisfied with shit the way it is and stop wasting people's time... Gimme your opinion.
Stick with it Emmeric, you can figure it out. When I first looked into EQEmu and asked about running my own server I had a hater tell me if I couldn't figure it out I shouldn't be doing it. Well I did figure it out and I've done a ton of other "figuring out" since then on EQEmu.

So back on topic: I haven't figured all this out yet, but I noticed it lists tradeskill objects. I did successfully use the NPC to create an augment pool. I was able to successfullly delete that pool but I had to zone before I saw the changes.

There is an object that I am trying to identify so I can delete it, but I haven't figured that out yet. It is a dagger in the guildlobby that was sticking into a message board. I found the message boards and deleted them, but now I have a dagger hanging in space. Kinda fun since it is just the right height when I run into it, it makes me duck.

(I'll post more when I figure stuff out, but don't hold you breath as I have limited EQEmu time and thus take a long time to work through things like this.)
Reply With Quote
  #9  
Old 10-10-2011, 05:55 PM
Emmeric
Sarnak
 
Join Date: Aug 2011
Posts: 72
Default

Quote:
Originally Posted by revloc02c View Post

So back on topic: I haven't figured all this out yet, but I noticed it lists tradeskill objects.
Ahhh... that's why it showed nothing from nearby. I was expecting graphical objects like crates, benches, torches, rugs, etc.

Nuts, and I was hoping to make my fledgling custom merchant area look all busy with supplies and tents.

I guess... I can just use the Bazaar.
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 10:44 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3