Thread: Game Mechanics: Gypse Camp - NK
View Single Post
  #5  
Old 04-22-2010, 11:40 PM
mixxit mixxit is offline
Sarnak


Join Date: Mar 2010
Posts: 407
Default

Code:
# NorthKarana
# Player.Pl file
# i) Checks player co-ordinates and allows casting of Bind
# Version 1.2
#

sub EVENT_CAST {
    # only do this check on BindAffinity (35)
    if ($spell_id == 35)
    {
        # Locate the NPC        
        my $bindman = $entity_list->GetMobByNpcTypeID(999242);
        # Who are we targeting?
        my $target = $client->GetTarget();
        
        # Lets get the groups of the target and the caster
        my $targroup = $entity_list->GetGroupByMob($target);
        
        # Ensure the target is within an acceptable distance from the bindman NPC
        my $distance = $target->CalculateDistance($bindman->GetX(),$bindman->GetY(),$bindman->GetZ());
        
        if ($distance <= 100)
        {
            # Are we casting this on ourselves?
            if ($client->GetID() == $target->GetID())
            {
                # Provide an additional message to confirm binding has infact worked
                $client->Message(15, "However, due to the current location you feel your soul bind to the area.");
                # Player is now bound
                $client->SetBindPoint($zoneid,$target->GetX(),$target->GetY(),$target->GetZ());
                
                #Or is this someone else?
            } else {
                # We need to check if we are in the group 
                if($targroup->IsGroupMember($client))
                {
                    # they should know what is going on
                    $client->Message(15, "However, due to the current location you feel the target soul bound to the area.");
                    $target->Message(15, "Due to the current location, you have bound to this area.");
                    # lets bind them
                    $target->CastToClient()->SetBindPoint($zoneid,$target->GetX(),$target->GetY(),$target->GetZ());
                } # default message is fine if not 
            
            }
        } else {
            # default message is fine            
        }
        $targroup = undef;
        $bindman = undef;
        $target = undef;
        $distance = undef;
    }
    
    
}
Last edited by mixxit; 04-23-2010 at 01:04 AM..