Думаю людям пригодится. Нашел на форуме Орион 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);
}