RU/Slothbot: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:


{{translate|ru}}
{{translate|ru}}
Особенности


Командная игра: Бот способен отличать врага от союзника.
This is a resource designed to allow scripts or gamemodes to insert a ped into the game that roughly simulates combat with a real player. gamemodes can implement the bots as opponents to actual players or as teammates.  
Навигация по карте: Если бот будет заспаунен на карте без специальных путей, он сможет двигаться самостоятельно и искать врагов, но не так ловко.
Агрессивность: Эти боты атакуют игроков и ботов состоящих в других командах.
Кооператив: При обнаружении союзника, боты могут автоматически объединяться в команду с ним.
Подвижность и ловкость: Если на пути бота появятся препятствия он попытается обойти их или перепрыгнуть.


Типы игры ботов:
=Features=
"hunting" - ("Охота") бот следует по указанному пути и выискивает врага.
'''Teamplay:'''
"waiting" - ("Выжидание") бот стоит на месте пока в поле его зрения не появится враг.
The bot is capable of identifying friend from foe
"guarding" - ("Охрана") бот не двигается с места и атакует врага если тот находится в поле его зрения.
"following" - ("Следование") бот следует за союзником (игроком/ботом) и атакует врагов в поле зрения.
"chasing" - ("Преследование") бот преследует врага и атакует его.
Игровой режим/Объединение скрипта: Этот сценарий имеет несколько функций и событий что позволит другим ресурсам видеть и контролировать то, что боты делают, и даже взять под контроль их поведение.
EDF путь для создания карты: Интегрированный в карту редактор,на карте разработчики могут легко разместить пути для ботов для их следования через всю карту. Это значительно расширило возможности ботов для имитации истинной игры.


События Сервера
'''Map Navigation:'''
When the bot is placed in a map that has suitable pathways marked out (see below on how to do that) the bot will navigate the map, seeking out enemies. Without pathways, a bot can still think for itself, but wont move around as profficiently.


onBotFindEnemyЭто условие вызывается когда бот находит врага. Оно может быть отменено, чтобы бот никого не атаковал.element enemy
'''Aggressiveness:'''
enemy: Игрок или бот являющийся врагом.
Bots will attack any ped, player or bot thats not on it's team.


onBotWastedЭто условие вызывается когда бот умирает.element attacker, float weapon, float bodypart
'''Cooperation:'''
attacker: Игрок/Бот/Элемент убивший sloth-бота.
Bots can automatically team up with teammates (either player or bot) by meeting up with them and sticking together
weapon: Орудие убийства.
bodypart: Часть тела в которую sloth-бот был убит.


onBotSpawnedЭто условие вызывается когда бот возрождается.
'''Advanced movement:'''
If theres obstacles blocking a bot's path, the bot will attempt to get around or over it instead of just walking into a wall for eternity


onBotFollowЭто условие вызывается когда бот следует за союзником.element leader
'''Multiple modes of playing:'''
leader:: Союзник за которым следует sloth-бот.
*"hunting" - travel pathways untill finding an enemy or teammate
*"waiting" - stand still untill an enemy of teammate comes into view
*"guarding" - the bot will attack any enemy that comes within sight, but not move from its spawn position
*"following" - the bot will follow a player or bot while attacking enemies
*"chasing" - the bot will attack an anemy bot or player


Функции Сервера
'''Gamemode/Script integration:'''
This script provides several functions and events to allow other resources to see and control what the bot's are doing, and even take control of certain behaviour.


Примечание: Все эти функции должны быть использованы посредством вызова функции(call), иначе они не будут работать.
'''EDF for map path creation:'''
Integrated into the map editor, map designers can easily place paths for bots to follow along in their maps. this greatly increased the bots ability to simulate true playing.


spawnBotЭта функция создает бота в игре.element spawnBot ( float x, float y, float z, int rotation = 0, [ int skinID = 0, int interior = 0, int dimension = 0, team theTeam = nil, int weapon = 0, string theMode = "hunting", element theModesubject = nil ] )
=Server Events=
Обязательные аргументы:
x: Координата спавна бота по X
y: Координата спавна бота по Y
z: Координата спавна бота по Z
rotation: "Поворот" спавна бота


Необязательные аргументы:
==onBotFindEnemy==
skinID: ID скина бота
This triggers when a bot locates an enemy, This event can be cancelled to prevent the bot from chasing players
interior: Интерьер в котором бот "заспавнится"
dimension: Размер, величина
theTeam: Команда в которую бот "войдет"
weapon: Оружие которое бот будет "носить"
theMode: Действие которое бот будет выполнять, когда "заспавнился"
theModeSubject: Если режим "погоня" или "следование за.." этим аргументом необходимо сказать, что бот преследует противника(в 1ом случае "погоня") или товарища по команде(во 2ом случае "следование за.."


setBotHuntЗаставляет бота следовать по "путям" пока не найдет противника или товарища по команде.bool setBotHunt ( element theBot )
<big>'''Parameters'''</big>
theBot: Бот будет "охотиться".
<syntaxhighlight lang="lua">
element enemy
</syntaxhighlight>
*'''enemy''': The Player or Ped the bot has spotted
<big>'''Source'''</big>


setBotWaitЗаставляет бота стоять на месте, пока враг товарища по команде не попадает в поле зрения.bool setBotWait ( element theBot )
The [[event system#Event source|source]] of this event is the Bot that has found an enemy
theBot: Бот будет ждать.


setBotChaseЗаставляет бота атаковать вражеского бота или игрока.bool setBotChase ( element theBot, element theTarget )
==onBotWasted==
theBot: Заставляет бота начать преследование врага.
This triggers when a bot is killed.
theTarget: Бот или игрок начинает преследование.setBotFollowЗаставляет бота следовать за дружеским игроком или ботом.bool setBotFollow( element theBot, element theTarget )
theBot: Бот.
theTarget: Бот или игрок за которым нужно следовать.


setBotGuardЗаставляет бота перейти к конкретным координатам и оставаться там во время нападения любых врагов.bool setBotGuard( element theBot, float x, float y, float z, [ bool priority = false ] )
<big>'''Parameters'''</big>
theBot: Бот
<syntaxhighlight lang="lua">
x: Координаты по оси X где бот будет охранять
element attacker, float weapon, float bodypart
y: Координаты по оси Y где бот будет охранять
</syntaxhighlight>
z: Координаты по оси Z где бот будет охранять
*'''attacker''': The Element that killed the bot
priority: Бот будет атаковать врагов оружием
*'''weapon''': The weapon id used to kill the bot
*'''bodypart''': The bodypart id that was hit to kill the bot
<big>'''Source'''</big>


getBotTeamПолучает команду бота.string getBotTeam ( element theBot)
The [[event system#Event source|source]] of this event is the Bot that died
theBot: Бот


setBotTeamЗадает команду бота.bool setBotTeam ( element theBot, team theTeam )
==onBotSpawned==
theBot: Бот
This triggers when a bot is spawned.
theTeam: Команда к которой должен присоединится бот


getBotAttackEnabledВозвращает true если бот начал атаковать, иначе false.bool getBotAttackEnabled( element theBot)
<big>'''Source'''</big>
theBot: Бот
The [[event system#Event source|source]] of this event is the Bot that spawned


setBotAttackEnabledВключить или отключить атаку бота.bool setBotAttackEnabled( element theBot, bool enabled)
==onBotFollow==
theBot: Бот
This triggers when a bot starts following a teammate
enabled: false - Отключить. true - Включить.


getBotModeПолучает тип бота ("chasing", "waiting", "guarding", "hunting", "following").string getBotMode( element theBot)
<big>'''Parameters'''</big>
Типы игры ботов:
<syntaxhighlight lang="lua">
"hunting" - ("Охота") бот следует по указанному пути и выискивает врага.
element leader
"waiting" - ("Выжидание") бот стоит на месте пока в поле его зрения не появится враг.
</syntaxhighlight>
"guarding" - ("Охрана") бот не двигается с места и атакует врага если тот находится в поле его зрения.
*'''leader''': The Player or Ped the bot has started following
"following" - ("Следование") бот следует за союзником (игроком/ботом) и атакует врагов в поле зрения.
<big>'''Source'''</big>
"chasing" - ("Преследование") бот преследует врага и атакует его.
theBot: Бот


isPedBotВозвращает true если пед является ботом, иначе false.bool ispedbot( element thePed)
The [[event system#Event source|source]] of this event is the Bot that starts following a teammate
thePed: Бот которого нужно "проверить".


setBotWeaponДает оружие боту.bool setBotWeapon( element theBot, float weapon)
=Server Functions=
theBot: Бот
All of these funtions will have to be used through the [[call]] function, otherwise they won't work
[[Category:RU/Resource]]
 
==spawnBot==
This function spawns a bot ingame, will return the bot element, or false if there was a problem.
 
<big>'''Syntax'''</big>
<syntaxhighlight lang="lua">
element spawnBot ( float x, float y, float z, int rotation = 0, [ int skinID = 0, int interior = 0, int dimension = 0, team theTeam = nil, int weapon = 0, string theMode = "hunting", element theModesubject = nil ] )
</syntaxhighlight>
 
<big>'''Required Arguments'''</big>
*'''x:''' The x co-ordinate to spawn the bot at
*'''y:''' The y co-ordinate to spawn the bot at
*'''z:''' The z co-ordinate to spawn the bot at
*'''rotation:''' Rotation of the bot on spawn
 
<big>'''Optional Arguments'''</big>
*'''skinID:''' Bots skin on spawn
*'''interior:''' Interior the bot will spawn into
*'''dimension:''' The ID of the [[dimension]] that the bot should be in
*'''theTeam:''' The team the bot will join
*'''weapon:''' The weapon the ped will carry
*'''theMode:''' The action the bot will be performing when spawned (see "modes of playing" above)
*'''theModeSubject:''' If theMode is "chasing" or "following" this arg is needed to tell the bot what opponent to chase or teammate to follow
 
==setBotHunt==
makes the bot travel pathways untill finding an enemy or teammate
 
<big>'''Syntax'''</big>
<syntaxhighlight lang="lua">
bool setBotHunt ( element theBot )
</syntaxhighlight>
 
<big>'''Required Arguments'''</big>
*'''theBot:''' The bot you want to hunt
 
==setBotWait==
makes the bot stand still untill an enemy of teammate comes into view
 
<big>'''Syntax'''</big>
<syntaxhighlight lang="lua">
bool setBotWait ( element theBot )
</syntaxhighlight>
 
<big>'''Required Arguments'''</big>
*'''theBot:''' The bot you want to wait
 
==setBotChase==
makes the bot attack an anemy bot or player
 
<big>'''Syntax'''</big>
<syntaxhighlight lang="lua">
bool setBotChase ( element theBot, element theTarget )
</syntaxhighlight>
 
<big>'''Required Arguments'''</big>
*'''theBot:''' The bot that you want to do the chasing
*'''theTarget:''' The bot or player you want to be chased
 
==setBotFollow==
makes the bot follow a teammate bot or player
 
<big>'''Syntax'''</big>
<syntaxhighlight lang="lua">
bool setBotFollow( element theBot, element theTarget )
</syntaxhighlight>
 
<big>'''Required Arguments'''</big>
*'''theBot:''' The bot that you want to do the following
*'''theTarget:''' The bot or player you want to be followed
 
==setBotGuard==
makes the bot move to the specific coords and stay there while attacking any enemies
 
<big>'''Syntax'''</big>
<syntaxhighlight lang="lua">
bool setBotGuard( element theBot, float x, float y, float z, [ bool priority = false ] )
</syntaxhighlight>
 
<big>'''Required Arguments'''</big>
*'''theBot:''' The bot you want to do the guarding
*'''x:''' The X coords you want the bot to guard
*'''y:''' The Y coords you want the bot to guard
*'''z:''' The Z coords you want the bot to guard
 
<big>'''Optional Arguments'''</big>
*'''priority:''' Set to true only if you want the bot to only shoot once it has reached the location to guard
 
==getBotTeam==
returns the Team the bot is on, false if no team
 
<big>'''Syntax'''</big>
<syntaxhighlight lang="lua">
string getBotTeam ( element theBot)
</syntaxhighlight>
 
<big>'''Required Arguments'''</big>
*'''theBot:''' The bot you want to check the team of
 
==setBotTeam==
changes the bot's team and loyalties
 
<big>'''Syntax'''</big>
<syntaxhighlight lang="lua">
bool setBotTeam ( element theBot, team theTeam )
</syntaxhighlight>
 
<big>'''Required Arguments'''</big>
*'''theBot:''' The bot you want to change the team of
*'''theTeam:''' The team the bot should join
 
==getBotAttackEnabled==
returns true if the bot is allowed to attack, false otherwise
 
<big>'''Syntax'''</big>
<syntaxhighlight lang="lua">
bool getBotAttackEnabled( element theBot)
</syntaxhighlight>
 
<big>'''Required Arguments'''</big>
*'''theBot:''' The bot you want to check if it can atack
 
==setBotAttackEnabled==
allow or disallow the bot to attack (press fire)
 
<big>'''Syntax'''</big>
<syntaxhighlight lang="lua">
bool setBotAttackEnabled( element theBot, bool enabled)
</syntaxhighlight>
 
<big>'''Required Arguments'''</big>
*'''theBot:''' The bot you want to set if it can atack
*'''enabled:''' set to false to remove the bots ability to attack, true to allow it
 
==getBotMode==
returns the mode the bot is in ("chasing", "waiting", "guarding", "hunting", "following") or if the bot is chasing or following, it will return the mode and the target
 
<big>'''Syntax'''</big>
<syntaxhighlight lang="lua">
string getBotMode( element theBot)
</syntaxhighlight>
 
<big>'''Required Arguments'''</big>
*'''theBot:''' The bot you want to check the status of
 
==isPedBot==
returns true if the ped is a bot, false otherwise
 
<big>'''Syntax'''</big>
<syntaxhighlight lang="lua">
bool isPedbot( element thePed)
</syntaxhighlight>
 
<big>'''Required Arguments'''</big>
*'''thePed:''' The ped you want to check if its a bot
 
==setBotWeapon==
sets the bot's weapon id (ammo is always infinite)
 
<big>'''Syntax'''</big>
<syntaxhighlight lang="lua">
bool setBotWeapon( element theBot, float weapon)
</syntaxhighlight>
 
<big>'''Required Arguments'''</big>
*'''theBot:''' The bot you want to set the weapon of
*'''weapon:''' the weapon id you want to give the bot
 
=Credits=
*'''Slothman:''' Bot creator, main scripter
*'''Gamesnert:''' EDF creator, scripting, testing
*'''Dragon:''' Gamemode creator, testing, scripting help
*'''EvGeniz:''' early testing, mapping
'''Thanks to Everyone else who made suggestions, tested the script, helped when i was stuck, etc'''
[[Category:Resource]]


[[en:Slothman/Slothbot]]
[[en:Slothman/Slothbot]]

Revision as of 21:45, 4 May 2015

Warning.png

Статью необходимо перевести на русский язык. Если страница не будет переведена в разумные сроки, она будет удалена.


This is a resource designed to allow scripts or gamemodes to insert a ped into the game that roughly simulates combat with a real player. gamemodes can implement the bots as opponents to actual players or as teammates.

Features

Teamplay: The bot is capable of identifying friend from foe

Map Navigation: When the bot is placed in a map that has suitable pathways marked out (see below on how to do that) the bot will navigate the map, seeking out enemies. Without pathways, a bot can still think for itself, but wont move around as profficiently.

Aggressiveness: Bots will attack any ped, player or bot thats not on it's team.

Cooperation: Bots can automatically team up with teammates (either player or bot) by meeting up with them and sticking together

Advanced movement: If theres obstacles blocking a bot's path, the bot will attempt to get around or over it instead of just walking into a wall for eternity

Multiple modes of playing:

  • "hunting" - travel pathways untill finding an enemy or teammate
  • "waiting" - stand still untill an enemy of teammate comes into view
  • "guarding" - the bot will attack any enemy that comes within sight, but not move from its spawn position
  • "following" - the bot will follow a player or bot while attacking enemies
  • "chasing" - the bot will attack an anemy bot or player

Gamemode/Script integration: This script provides several functions and events to allow other resources to see and control what the bot's are doing, and even take control of certain behaviour.

EDF for map path creation: Integrated into the map editor, map designers can easily place paths for bots to follow along in their maps. this greatly increased the bots ability to simulate true playing.

Server Events

onBotFindEnemy

This triggers when a bot locates an enemy, This event can be cancelled to prevent the bot from chasing players

Parameters

element enemy
  • enemy: The Player or Ped the bot has spotted

Source

The source of this event is the Bot that has found an enemy

onBotWasted

This triggers when a bot is killed.

Parameters

element attacker, float weapon, float bodypart
  • attacker: The Element that killed the bot
  • weapon: The weapon id used to kill the bot
  • bodypart: The bodypart id that was hit to kill the bot

Source

The source of this event is the Bot that died

onBotSpawned

This triggers when a bot is spawned.

Source The source of this event is the Bot that spawned

onBotFollow

This triggers when a bot starts following a teammate

Parameters

element leader
  • leader: The Player or Ped the bot has started following

Source

The source of this event is the Bot that starts following a teammate

Server Functions

All of these funtions will have to be used through the call function, otherwise they won't work

spawnBot

This function spawns a bot ingame, will return the bot element, or false if there was a problem.

Syntax

element spawnBot ( float x, float y, float z, int rotation = 0, [ int skinID = 0, int interior = 0, int dimension = 0, team theTeam = nil, int weapon = 0, string theMode = "hunting", element theModesubject = nil ] )

Required Arguments

  • x: The x co-ordinate to spawn the bot at
  • y: The y co-ordinate to spawn the bot at
  • z: The z co-ordinate to spawn the bot at
  • rotation: Rotation of the bot on spawn

Optional Arguments

  • skinID: Bots skin on spawn
  • interior: Interior the bot will spawn into
  • dimension: The ID of the dimension that the bot should be in
  • theTeam: The team the bot will join
  • weapon: The weapon the ped will carry
  • theMode: The action the bot will be performing when spawned (see "modes of playing" above)
  • theModeSubject: If theMode is "chasing" or "following" this arg is needed to tell the bot what opponent to chase or teammate to follow

setBotHunt

makes the bot travel pathways untill finding an enemy or teammate

Syntax

bool setBotHunt ( element theBot )

Required Arguments

  • theBot: The bot you want to hunt

setBotWait

makes the bot stand still untill an enemy of teammate comes into view

Syntax

bool setBotWait ( element theBot )

Required Arguments

  • theBot: The bot you want to wait

setBotChase

makes the bot attack an anemy bot or player

Syntax

bool setBotChase ( element theBot, element theTarget )

Required Arguments

  • theBot: The bot that you want to do the chasing
  • theTarget: The bot or player you want to be chased

setBotFollow

makes the bot follow a teammate bot or player

Syntax

bool setBotFollow( element theBot, element theTarget )

Required Arguments

  • theBot: The bot that you want to do the following
  • theTarget: The bot or player you want to be followed

setBotGuard

makes the bot move to the specific coords and stay there while attacking any enemies

Syntax

bool setBotGuard( element theBot, float x, float y, float z, [ bool priority = false ] )

Required Arguments

  • theBot: The bot you want to do the guarding
  • x: The X coords you want the bot to guard
  • y: The Y coords you want the bot to guard
  • z: The Z coords you want the bot to guard

Optional Arguments

  • priority: Set to true only if you want the bot to only shoot once it has reached the location to guard

getBotTeam

returns the Team the bot is on, false if no team

Syntax

string getBotTeam ( element theBot)

Required Arguments

  • theBot: The bot you want to check the team of

setBotTeam

changes the bot's team and loyalties

Syntax

bool setBotTeam ( element theBot, team theTeam )

Required Arguments

  • theBot: The bot you want to change the team of
  • theTeam: The team the bot should join

getBotAttackEnabled

returns true if the bot is allowed to attack, false otherwise

Syntax

bool getBotAttackEnabled( element theBot)

Required Arguments

  • theBot: The bot you want to check if it can atack

setBotAttackEnabled

allow or disallow the bot to attack (press fire)

Syntax

bool setBotAttackEnabled( element theBot, bool enabled)

Required Arguments

  • theBot: The bot you want to set if it can atack
  • enabled: set to false to remove the bots ability to attack, true to allow it

getBotMode

returns the mode the bot is in ("chasing", "waiting", "guarding", "hunting", "following") or if the bot is chasing or following, it will return the mode and the target

Syntax

string getBotMode( element theBot)

Required Arguments

  • theBot: The bot you want to check the status of

isPedBot

returns true if the ped is a bot, false otherwise

Syntax

bool isPedbot( element thePed)

Required Arguments

  • thePed: The ped you want to check if its a bot

setBotWeapon

sets the bot's weapon id (ammo is always infinite)

Syntax

bool setBotWeapon( element theBot, float weapon)

Required Arguments

  • theBot: The bot you want to set the weapon of
  • weapon: the weapon id you want to give the bot

Credits

  • Slothman: Bot creator, main scripter
  • Gamesnert: EDF creator, scripting, testing
  • Dragon: Gamemode creator, testing, scripting help
  • EvGeniz: early testing, mapping

Thanks to Everyone else who made suggestions, tested the script, helped when i was stuck, etc