View Single Post
  #3  
Old 05-12-2010, 01:59 AM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default

Quote:
Originally Posted by KLS View Post
Code:
    $grp = $client->GetGroup();
    $grp_id = 0;
    if($grp)
    {
        $grp_id = $grp->GetID();
    }
Please explain how this is worse before it can be considered for submission.
I've tried many variations, and it works great if you are checking for a group inside of a zone, but you can't store the Group_id that is actually in the database with it. I've gotten every other time of instance working just fine other than raid ID storing.

Let's say I grab an isntance with a person using the same format, if I zone and they are the only one in the zone, doing a group check fails before I can even grab ID.

With the code below I can store the group ID in a qglobal with the above .diff and recall that same Group_ID at any given zone, npc etc if I wanted to assign them consistently to the same instance. With the other method I will get a fail if no one else is in the zone, it can't reach a Group_ID. Nor does it output the ID.

Code:
sub EVENT_SAY
{
if($text=~/enter/i){
		my $GID = quest::getgroupidbychar($charid);
		if ($GID > 0)
		{
            if (defined($qglobals{"HalasWere_$GID"}))
            {
                my $QGlobalValue = $qglobals{"HalasWere_$GID"};
                quest::AssignToInstance($qglobals{"HalasWere_$GID"});
                quest::MovePCInstance(29, $QGlobalValue, 0, 0, 0);
            }
            else
            {
                my $instanceID = quest::CreateInstance("halas", 1, 7201);
                quest::AssignToInstance($instanceID); 
                quest::setglobal("HalasWere_$GID",$instanceID,7,"H2");
                quest::MovePCInstance(29, $instanceID, 0, 0, 0);
            }
        }
		else
		{
			quest::popup("Requirements","You need to have a group to enter this instance",0,0);
		}
}
}
If I use the below code, I do not get a variable back from the group call that you had originally suggested I tried, which worked, just not completely.

You can store the group ID in the global value this way. And if we had a raid ID call you could do it the same way here. Got instances working with group very flexibly here.

And once again, thank you for your great work with instances.

Code:
if($text=~/grouptest/i)
{

    $grp = $client->GetGroup();
	my $GID = quest::getgroupidbychar($charid);
    $grp_id = 0;
    if($grp)
    {
        $grp_id = $grp->GetID();
		quest::say("$grp_id");
		quest::say("$GID");
		}
    }
Reply With Quote