UORPG.net Free UO Shard
http://forum.uorpg.net/

Orion - Cast on friend - Heal/GHeal
http://forum.uorpg.net/viewtopic.php?f=28&t=18025
Page 1 of 1

Author:  Occlo [ 19 Feb 2018, 11:27 ]
Post subject:  Orion - Cast on friend - Heal/GHeal

Приветствую.

Иногда бегаю паладином.
Добавил в хоткеях Cast on friend - Heal/GHeal;
Добавил друзей в закладке Friends;
При попытке кастовать на друга пишет - "Выберите таргет".

Как мне лучше хилить друзей, чем просто тыкать по статус барам? Или как быстро выбрать дружественный таргет?
Возможно у кого-то есть скрипт на Орион для кросс-хила, который есть на форуме для UOSteam?

Author:  Occlo [ 19 Feb 2018, 12:15 ]
Post subject:  Re: Orion - Cast on friend - Heal/GHeal

Думаю людям пригодится. Нашел на форуме Орион autoload.
На сервере еще не проверял, но думаю будет работать, или с маленькими доработками. Проверю сегодня вечером.

Функции:
CastFriend('spellname') - кастует во френда со списка указанный спелл, радиус 18 тайлов;
SwitchFriend() - функция переключения между друзьями со списка.
В скрипте присутствуют и иные функции которые я не описал.
Источник

Code:
//cast spell with a given name on player u have attacked
function CastAttackedEnemy(spellName)
{
   Orion.Cast(spellName, 'lastattack');
}

//cast spell with a given name on yourself
function CastSelf(spellName)
{
   Orion.Cast(spellName, 'self');
}

function CastNearestInjuredFriend(spellName)
{
   var friendSerialString = Orion.FindFriend('injured|live', '18');
   if(!friendSerialString.length)
   {
      Orion.Print( '-1', 'Found no friends nearby');
      return;
   }
   Orion.Cast(spellName, serial);
}

//cast spell with a given name on your chosenFriend which is a saved Serial in Lists -> Objects
//or make a new one
function CastFriend(spellName)
{
   var chosenFriend = Orion.FindObject('chosenFriend');
   if(chosenFriend == null || chosenFriend == 0)
   {
      Orion.Print( '-1', 'No chosen friend found');
      Orion.Print( '-1', 'Target a mobile to mark him as your chosen friend.');
      Orion.AddObject('chosenFriend');
      while(Orion.HaveTarget())
      {
         Orion.Wait('50');
      }
      chosenFriend = Orion.FindObject('chosenFriend');   
      //Orion.AddFriendList(chosenFriend.Serial()); need to implement
   }
   Orion.Print( '-1', 'try cast friend ' + chosenFriend.Name());
   Orion.Cast(spellName, chosenFriend.Serial());
   
}

//cast spell with a given name on target
function CastTargetedEnemy(spellName)
{
   Orion.Cast(spellName, 'lasttarget');
}

//helper function for AttacktNextHuman() and TargetNextHuman()
function FindNearestHumanEnemy()
{   
   Orion.Ignore('self');
   var friends = Orion.GetFriendList();
   for(var i = 0; i < friends.length; i++)
   {
      Orion.Ignore(friends[i]);
   }
   
   var humans = Orion.FindType('0x0190|0x0191', '-1', ground, 'near|mobile', '18');   
   if ( !humans.length )
   {
      Orion.Print( '-1', 'no humans found, resetting ignore list');
      Orion.IgnoreReset();
      return '';
   }
   return humans[0];
}

//This function will swap between players in range of 18 and attack them.
function AttacktNextHuman()
{
   var serial = FindNearestHumanEnemy();
   if(!serial.length) return;
   CharPrintDelayed(serial, '30', 'ATTACKING');
   Orion.ClientLastAttack(serial);
   Orion.Attack(serial);
   Orion.Ignore(serial);       

}

//This function will swap between players in range of 18 and target them.
function TargetNextHuman()
{
   var serial = FindNearestHumanEnemy();
   if(!serial.length) return;
   CharPrintDelayed(serial, '30', 'TARGET');
   Orion.ClientLastTarget(serial);
   Orion.TargetObject(serial);
   Orion.Ignore(serial);       
}

//This function will swap between your nearby friends from your friend list
function SwitchFriend()
{
   var friend = Orion.FindFriend('next', '18');
   if(!friend.length)
   {
      Orion.Print('-1', 'There are no friends nearby');
      return;
   }   
   Orion.AddObject('chosenFriend', friend);
}

function FindSerialRecursive(friendsAmount, friends, i)
{
   if(friendsAmount - 1 != i)
   {   
      friend =  Orion.FindObject(friends[i + 1]);
      if(friend == null)
         return FindSerialRecursive(friendsAmount, friends, i + 1 );
      else
         return friend;
   }
   else
   {
      //loop over friends again and take the first one which is neaby
      for(var c = 0; i < friendsAmount; c++)
      {
         friend = Orion.FindObject(friends[c]);
         if(friend != null)
            return friend;
      }
            
   }
}

function CharPrintDelayed(serial, color, text)
{
   var oldUse = Orion.OptionScaleSpeech();
   var oldDelay = Orion.OptionScaleSpeechDelay();
 
   Orion.OptionScaleSpeech(true);
   Orion.OptionScaleSpeechDelay(50);
 
   Orion.CharPrint(serial, color, text);
   Orion.Wait(50);
 
   Orion.OptionScaleSpeech(oldUse);
   Orion.OptionScaleSpeechDelay(oldDelay);
}

Author:  Slacker [ 19 Feb 2018, 21:50 ]
Post subject:  Re: Orion - Cast on friend - Heal/GHeal

Code:
function ResNearestDeadFriend()
{
    var friend = Orion.FindFriend('dead', 18);
    if(friend.length)
        Orion.Cast('Resurrection', friend);
    else
        Orion.Print('-1', 'Found no injured friends neaby to resurrect');   
}
function HealNearestInjuredFriend()
{
    var friend = Orion.FindFriend('injured', 18);
    if(friend.length)
        Orion.Cast('Greater Heal', friend);
    else
        Orion.Print('-1', 'Found no injured friends neaby to heal');   
}

Author:  Occlo [ 20 Feb 2018, 20:39 ]
Post subject:  Re: Orion - Cast on friend - Heal/GHeal

Slacker wrote:
Code:
function ResNearestDeadFriend()
{
    var friend = Orion.FindFriend('dead', 18);
    if(friend.length)
        Orion.Cast('Resurrection', friend);
    else
        Orion.Print('-1', 'Found no injured friends neaby to resurrect');   
}
function HealNearestInjuredFriend()
{
    var friend = Orion.FindFriend('injured', 18);
    if(friend.length)
        Orion.Cast('Greater Heal', friend);
    else
        Orion.Print('-1', 'Found no injured friends neaby to heal');   
}

Спасибо!

Page 1 of 1 All times are UTC + 2 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/