Slothman/Slothbot: Difference between revisions

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




==EVENTS==
==SERVER EVENTS==


===onBotFindEnemy===
===onBotFindEnemy===
Line 52: Line 52:




===onBotFollow===
This triggers when a bot starts following a teammate
====Parameters====
<syntaxhighlight lang="lua">
element leader
</syntaxhighlight>
*'''leader''': The Player or Ped the bot has started following
====Source====
The [[event system#Event source|source]] of this event is the Bot that starts following a teammate




==SERVER FUNCTIONS==




Line 63: Line 73:




onBotSpawned
source = the bot that spawned
onBotFollow
paremeters: (leader) - the player or bot that the bot is following
source - the bot
==FUNCTIONS==


spawnBot(posX, posY, posZ, rotation, skin, interior, dimension, team, weapon, mode, modesubject)
spawnBot(posX, posY, posZ, rotation, skin, interior, dimension, team, weapon, mode, modesubject)

Revision as of 03:41, 4 April 2010

Slothbot

This is a resource designed to allow scripts or gamemodes to insert a ped into the game that roughly simulates combat with a player.

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.

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

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.


SERVER EVENTS

onBotFindEnemy

This triggers when a bot locates an enemy, This event can be cancelled.

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

spawnBot(posX, posY, posZ, rotation, skin, interior, dimension, team, weapon, mode, modesubject) everything is somewhat self explanitory except for: mode - what mode thebot will spawn in the options are:

"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 (requires modesubject) "chasing" - the bot will attack an anemy bot or player (requires modesubject)

modesubject - when mode is "following" or "chasing" the modesubject will be the player or bot that the source bot sill be following/chasing

setBotHunt (theped)- makes the bot travel pathways untill finding an enemy or teammate

setBotWait (theped)- makes the bot stand still untill an enemy of teammate comes into view

setBotChase(theped, target)- makes the bot attack an anemy bot or player (target)

setBotFollow(theped, leader)- makes the bot follow a teammate bot or player (leader

setBotGuard(theped, x, y, z)- makes the bot move to the xyz coords and stay there while attacking any enemies

setBotTeam (theped, team) - sets the bot's team (handy if you want to change their loyalties after spawning)

getBotAttackEnabled(theped) - returns true if the bot is allowed to shoot, false otherwise.

setBotAttackEnabled(theped, bool) - controls if a bot is allowed to shoot or should hold its fire

getBotMode(theped) - returns the mode the bot is in (chasing, waiting, guarding, hunting, following) if the bot is chasing or following, it will return the mode and the modesubject

ispedbot(theped) - returns true if the ped is a bot, false otherwise.