PDA

View Full Version : Instancing Woes


Township EQ
12-07-2013, 10:29 PM
Hey guys.

I'm trying to make an NPC teleport you to a guild instanced South Qeynos (Version 1). I seem to be having an issue where when you click yes to the popup it teleports you to Qeynos, but when you're done zoning you're right back where you started and you have no instances under #instance list.

I've never done anything like this, so if anyone could tell me where I'm going wrong that would be appreciated!


sub EVENT_SAY {
if($text =~/hail/i) {
if($ulevel < 50) {
quest::say("Are you lost? I wouldn’t recommend going to the South part of town.");
}
elsif($ulevel => 50) {
quest::say("You have grown quite popular around here for your adventures, $name. Perhaps now you'd like to hear a story?");
}
}
if($text =~/story/i) {
if($ulevel => 50) {
quest::say("I spoke of the Revolution before.. Perhaps I should tell you everything.. Up until a short time ago Qeynos was ruled by King Midon. At first the people adored him and all of his decisions were for the good of the city. As he grew older something changed within him. All the power and riches he collected started to become an obsession. He started to rule the people through fear and violence. He imposed a tax that was impossible for much of the townsfolk to pay.. when you didn't pay his militia would beat you in the streets like a dog.");
quest::emote("pauses for a short moment.");
quest::settimer("pausetext",5);
}
}
if(($text =~/flashback/i) && ($ulevel >= 50)) {
quest::stoptimer("pausetext");
quest::popup("Flashback", "$Logo
<c \"#00FFFF\"> The old worker is going through a flashback of the Rebellion.. Would you like to join him? </c>", 50, 1);
}
#########################################
###From this point down is for <50 text##
#########################################
if($text =~/South/i) {
if($ulevel < 50) {
quest::emote("groans.");
quest::say("How do you not know? Can’t you smell it in the air? It’s been months since the Revolution, but it’ll take the rest of the year to clean all the blood off the streets. ");
}
}
if($text =~/Revolution/i) {
if($ulevel < 50) {
quest::say("You’re not the brightest torch out there, are ya kid... I’ll try and simplify this for you. The [Township] was a colony populated by only those with the skilled hands or muscle to build it. We citizens were forgiven of all wrong doings we committed, or were convicted, when we signed on to take the voyage here. It shouldn’t have come as a surprise to the old world that someday we’d claim this land as our own, and forcibly take our independence. ");
}
}
if($text =~/Township/i) {
if($ulevel < 50) {
quest::say("That’s the name we kept to call ourselves. Although we’re composed of artisans and laborers here, we have recently seen some Township citizens become adventurers. This would never have been possible without our skilled craftsman creating charms that allowed humble citizens to better focus on this foreign way of life…Now you’ve wasted enough of my time; I have to get back to work, so just take this last piece of advice.");
}
}
if($text =~/Advice/i) {
if($ulevel < 50) {
quest::say("We learned the hard way that things have trouble staying dead in this world. If it wasn’t for the sewers we had built, we’d still be over-run with the bodies of those that fell in the Revolution. You might find some useful equipment for your adventures down there, although I’d avoid it until you get your bearings here, or make a few friends.");
}
}
}

sub EVENT_SPAWN {
quest::set_proximity($x - 15,$x + 10,$y - 10,$y + 10,$z - 10,$z + 10);
}

sub EVENT_ENTER {
if($ulevel < 50) {
$client->Message(0,"An Old Worker says 'Are you lost? I wouldn’t recommend going to the South part of town.'");
}
elsif($ulevel => 50) {
$client->Message(0,"An Old Worker says 'You have earned my respect, $name. I've heard stories of your travels from the townsfolk. Please... come and speak with me.'");
}
}

sub EVENT_TIMER {
if($timer == "pausetext") {
quest::emote("appears to be having a [flashback]");
quest::stoptimer("pausetext");
}
}

sub EVENT_POPUPRESPONSE {
if($uguild_id > 0) {
if(($popupid == 50) && (defined($qglobals{"GuildInstance_$uguild_id"}))) {
my $QGlobalValue = $qglobals{"GuildInstance_$uguild_id"};
quest::AssignToInstance($qglobals{"GuildInstance_$uguild_id"});
quest::MovePCInstance(1, $QGlobalValue, 0, 0, 0);
}
else {
my $instanceID = quest::CreateInstance("qeynos", 1, -1);
quest::AssignToInstance($instanceID);
quest::setglobal("GuildInstance_$uguild_id",$instanceID,7,"M60");
quest::MovePCInstance(1, $instanceID, 0, 0, 0);
}
}
}

Akkadius
12-07-2013, 10:36 PM
This should help:

http://www.eqemulator.org/forums/showthread.php?t=32609

Township EQ
12-07-2013, 10:43 PM
Thanks for that Akka.. I've been googling "eqemu instancing" and that didn't come up. I guess I should've used the actual forum search.

Township EQ
12-07-2013, 10:59 PM
This is what I have now and it seems to actually teleport me, but then once again I spawn right back on top of the NPC with no instance attached.


sub EVENT_POPUPRESPONSE {
if($uguild_id > 0) {
if(($popupid == 50) && (defined($qglobals{"$uguild_id$space$instguild$space$zonesn"}))) {
my $guildinstanceglobal = "$uguild_id$space$instguild$space$zonesn";
my $instid = $qglobals->{$guildinstanceglobal};
quest::AssignToInstance($instid);
quest::MovePCInstance(qeynos, $instid, 0, 0, 0);
}
else {
plugin::SendToInstance("guild", "qeynos", 1, 0, 0, 0, "guild", 604800);
}
}
}

Akkadius
12-07-2013, 11:02 PM
Make sure you have qglobals enabled on the NPC.

Also you shouldn't need to use all of that other code. The plugin handles the instance tracking, if the instance doesn't exists it creates it. If there is already an instance based on the criterion it should direct you back to the appropriate one.

Township EQ
12-07-2013, 11:14 PM
The NPC I'm applying this code to is in qeynos2 NOT qeynos. Would that be why this isn't working?

I created an NPC right next to him with the below and he works perfectly.


sub EVENT_SAY {
if($text =~/hail/i) {
plugin::SendToInstance("guild", "$zonesn", 0, 0, 0, 0, guild, 259200);
}
}

Akkadius
12-07-2013, 11:26 PM
Did you read the thread I posted? The 2nd argument is the destination zone short name.

sub EVENT_SAY{
if($text=~/test/i){
plugin::SendToInstance("guild", "qeynos", 1, 0, 0, 0, "QeynosGuildInst", 604800);
}
}

Township EQ
12-08-2013, 01:09 AM
Yes, I did read your post.. It confused me because when I did it with $zonesn it worked for some reason, and when I was trying to make it go to qeynos from qeynos2 it wasn't. It seems that changing the identifier from "guild" to "QeynosGuildInst" is what's fixed it. Sorry if I annoyed you or anything.

Akkadius
12-24-2013, 05:11 AM
Yes, I did read your post.. It confused me because when I did it with $zonesn it worked for some reason, and when I was trying to make it go to qeynos from qeynos2 it wasn't. It seems that changing the identifier from "guild" to "QeynosGuildInst" is what's fixed it. Sorry if I annoyed you or anything.

No you're fine.