@ - This will run the passed in command. Eg: "@frog" would cause the
soul command frog to be used.
Anything else will be used as a message to be sent to everyone in the
room.
- Parameters:
str - the thing to execute
no_convert - whether or not convert_message() expansion will be done
later in expand_string().
- See also:
expand_string()
-
expand_string
varargs string expand_string(string in_str,
object on,
int no_convert)
This method is used to expand the message strings used in the
npc messages. It is used for chat strings and such things like
that. The strings it expands are of the form:
$lname$, $mname$, $aname$, ...
The first letter determines the type of object being referenced.
They are:
- m
- Me! The npc itself.
- l
- A living object, choose a random living object in the npcs
environment.
- p
- Chooses a random player in the environment of the NPC who is visible to
the NPC and not net-dead.
- a
- Chooses a random attacker from those attacking the npc.
- o
- Choose a random non-living object in the environment of the npc.
- i
- Choose a random object in the inventory of the npc.
After the first letter is a type of information being request.
- name
- The file name of the selected object.
- cname
- The capitalised name of the selected object.
- gender
- The gender string of the selected object (male, female, neuter).
- poss
- The possessive string of the selected object.
- obj
- The objective string of the selected object.
- pronoun
- The pronoun string of the selected object.
- gtitle
- The guild title of the selected object (only useful on livings).
- ashort
- The a_short() call.
- possshort
- The poss_short() call.
- theshort
- The the_short() call.
- oneshort
- The one_short() call.
- Parameters:
in_str - the input string
on - the object to use for the 'o' matching
- See also:
set_chat_string() and expand_mon_string()
-
get_next_route_direction_and_exit
string * get_next_route_direction_and_exit()
This method gets the next direction to go in the route which is
currently being followed. It will remove this direction off the
array.
- Returns:
the next direction to go down
- See also:
query_last_route_direction(), query_following_route() and do_route_move()
-
init_command
varargs void init_command(string str,
int tim)
This method allows you submit delayed commands to the npc
via a call_out.
- See also:
do_command(), queue_command() and delay_command()
-
init_equip
void init_equip()
This method makes the npc initialise all their equipment, like hold
it and stuff.
- See also:
do_command()
-
load_a_chat
void load_a_chat(int chance,
mixed * c_s)
This method loads up the set of chat strings to use while in combat.
- Parameters:
chance - the chance of the chat occuring
c_s - the chat string to use
- See also:
load_chat(), query_achat_chance() and query_achat_string()
-
load_chat
void load_chat(int chance,
mixed * c_s)
This method loads up the chat strings for the npc. This will be
an array containing pairs of elements, the first pair is the
weighting of the chat and the second is the chat to use.
All the weights in the array are added up and then a random
number is chosen in the weighting. Then that element is looked
up in the array. This way you can control a chat and make it
rare.
If the chat string is an array then this a story, the story will be
executed one after another and no other chats will be executed
in between. If the first parameter of the story array is a number it
will be used as a 1/1000 chance of the next story line being displayed.
Special strings can be used which will replace with
object names, see expand_mon_string() for further information.
The chat chance is a chance (in 1000) of the chat occuring. You
will need to play with this yourself to see which frequency of
chatting you wish for your npcs.
- Parameters:
chance - the chance in 1000 of a chat working every 2 seconds
c_s - the chat string to use
- See also:
expand_mon_string(), load_a_chat(), query_chat_chance() and query_chat_string()
- Example:
load_chat(60,
({
1, "'I am a chicken!",
// Make this one more likely to occur.
2, ":clucks like a chicken."
1, ":pecks at $lpossshort$ foot."
}));
load_chat(100,
({
1, "'I am a simple farmer."
1, ":waves $mposs$ pitchfork around."
// A story, they will always occur in this order
1, ({
500,
"'Once upon a time there was a rabbit.",
"'It was a nice rabbit and hung around in bars.",
"'It sung little songs about fruit.",
}),
}));
-
move_me_to
varargs void move_me_to(string dest,
int delay,
int use_path)
This method will move the npc to the specified destination. The
npc will walk from where they currently are to the destination using
the time delay specified between the movements.
If the location is reached then the function "stopped_route" will
be called on the npc. The first arguement to the function will
be 0 if the npc did not reach its destination and 1 if it did.
- Parameters:
dest - the destination to go to
delay - the time delay between each move
use_path - use the path and the exit in the response
- See also:
get_next_route_direction(), got_the_route(), query_last_route_direction(), query_following_route() and do_route_move()
- Example:
inherit "/obj/monster";
void go_home() {
move_me_to(HOME_LOCATION, 2);
} /* go_home() */
void stopped_route(int success) {
if (success) {
do_command("emote jumps for joy.");
} else {
do_command("emote looks sad and lost.");
}
} /* stopped_route() */
-
print_monster_chat
varargs void print_monster_chat(int chance)
-
print_monster_chat_int
void print_monster_chat_int(mixed * chats,
int chance,
int t)
-
print_monster_fighting_chat
varargs void print_monster_fighting_chat(int chance)
-
query_achat_chance
int query_achat_chance()
This method returns the current chat chance for attack messages on
the npc.
- Returns:
the current attack message chat chance
- See also:
set_achat_chance(), load_chat() and load_achat()
-
query_achat_string
string * query_achat_string()
This method queries the current chat string for attack messages on the
npc. See load_chat() for a longer description of how the
chat string is formatted.
- Returns:
the current attack message chat string
- See also:
load_chat(), load_achat() and set_chat_string()
-
query_aggressive
int query_aggressive()
This method returns the current aggressive level of the npc.
If the aggressive is set to 1, then the npc will attack all players
that enter its environment. If the aggressive is set to 2 then
the npc will attack everything (including other npcs).
See the function start_attack() for information about things you
can do to stop aggressive npcs attacking things.
- Returns:
the aggressive level of the npc
- See also:
set_aggressive() and start_attack()
-
query_always_return_to_default_position
int query_always_return_to_default_position()
This method returns the status of the flag that makes the npc return
to the default position if its position is changed. The flag
specified the length of time to wait before causing the
default position to be restored.
- Returns:
the time to wait before the position is restored
- See also:
/std/living/living->return_to_default_position() and set_always_return_to_default_position()
-
query_cannot_change_position
int query_cannot_change_position()
This method returns the current value of the unable to change
position flag.
- Returns:
the unable to change position flag
- See also:
/std/living/living->set_default_position()
-
query_cap_name
string query_cap_name()
This method returns the current capitalized name of the npc.
- Returns:
the current capitalized name
- See also:
set_cap_name()
-
query_chat_chance
int query_chat_chance()
This method returns the current chat chance for messages on
the npc
- Returns:
the current chat chance
- See also:
set_chat_chance() and load_chat()
-
query_chat_string
string * query_chat_string()
This method queries the current chat string for messages on the
npc. See load_chat() for a longer description of how the
chat string is formatted.
- Returns:
the current chat string
- See also:
load_chat() and query_chat_string()
-
query_chats_enabled
int query_chats_enabled()
are chats enabled
-
query_combat_actions
mixed * query_combat_actions()
This method returns the current array of combat actions on the
npc.
The array will have the format of:
({
action1_chance,
action1_name,
action1_action,
...
})
- Returns:
the combat action array
- See also:
add_combat_action(), remove_combat_actions() and /std/effects/fighting/combat.c
-
query_death_xp
nomask int query_death_xp()
This method returns the amount of death experiecne that would be
gained by killing the npc.
This function is nomask because its really really bad when NPCs unilaterally
modify their death xp.
- Returns:
the amount of death experience for the npc
-
query_do_move_action
mixed query_do_move_action()
Sets an action to do when moving around the place. This means
you can make the npc do things like sneak everywhere or hide
in rooms or whatever it wants to do on a move.
-
query_enter_commands
string * query_enter_commands()
This method returns the current array of enter commands.
- Returns:
the current array of enter commands
- See also:
reset_enter_commands() and add_enter_commands()
-
query_fight_type
int query_fight_type()
This method returns the flag which allows the npc to join into fights.
- Returns:
1 if the npc is to join fights, 0 if not
- See also:
set_join_fights() and query_join_fight_type()
-
query_fighting_chats_enabled
int query_fighting_chats_enabled()
are fighting chats enabled
-
query_follow_speed
int query_follow_speed()
This method queries the speed at which the npc will follow
after a player when they leave combat.
- Returns:
the current follow speed
- See also:
set_follow_speed()
-
query_following_route
mixed * query_following_route()
This method returns the current array of directions we are following
as a route.
- See also:
get_next_route_direction(), query_last_route_direction() and do_route_move()
-
query_guild
string query_guild()
This method returns the current guild of the npc.
- Returns:
this current guild of the npc
- See also:
query_race(), set_guild() and set_level()
-
query_guild_ob
mixed query_guild_ob()
This returns the guild object associated with the npc.
- Returns:
the guild object associated with the npc
- See also:
set_guild(), set_guild_ob() and set_level()
-
query_interact_with_room_objects
int query_interact_with_room_objects()
-
query_join_fights
string query_join_fights()
This method returns the message to use when joining into fights.
- Returns:
the message to print when joining a fight
- See also:
set_join_fights() and set_join_fight_type()
-
query_last_route_direction
int query_last_route_direction()
This method tells us if the npc is currently following a route.
- Returns:
1 if there are route directions to follow still
- See also:
get_next_route_direction(), query_following_route() and do_route_move()
-
query_level
varargs int query_level( int)
This method returns the current guild level of the npc. This is
a pass through call to a function on the guild object associated
with this npc.
- Returns:
the current guild level of the object
- See also:
set_guild()
-
query_move_after
mixed query_move_after()
This method returns the current move after values.
It returns an array of the form:
({
after,
rand,
})
- Returns:
the move after values
- See also:
set_move_after()
-
query_move_zones
string * query_move_zones()
This method returns the current list of move zones on the npc
- Returns:
the current list of move zones
- See also:
add_move_zone(), remove_move_zones() and set_move_after()
-
query_ok_turn_off_heart_beat
int query_ok_turn_off_heart_beat()
This method returns 1 if it is ok to turn of the npc's heart beat.
THis can be overridden for times when the heart beat needs to be
kept on for some reason.
- Returns:
1 if the heart beat should go off, 0 if it should stay on
-
query_queued_commands
int query_queued_commands()
You can use this function to see if there are any commands queued
for this NPC.
- See also:
init_equip(), init_command(), delay_command(), do_command() and queue_command()
-
query_race
string query_race()
This method returns the current race of the npc.
- Returns:
the current race of the object
- See also:
set_race(), query_guild() and set_level()
-
query_race_ob
mixed query_race_ob()
This returns the race object associated with the npc.
- Returns:
the race object associated with the npc
- See also:
set_race(), set_race_ob() and set_level()
-
query_route_position
int query_route_position()
This is the position on the route the npc is currently at.
- Returns:
the current route position
-
query_spell_actions
mapping query_spell_actions()
This method returns the list of spell actions present on the
npc.
- Returns:
the list of spell actions
-
query_throw_out
mixed * query_throw_out()
This method returns the current throw out array.
The array consists of
({
hps,
chance,
their_mess,
everyone_mess
})
The parameters are the same as used in the set_throw_out
function.
- Returns:
the throw out array
- See also:
set_throw_out()
-
queue_command
varargs int queue_command(string words,
int interval)
This method allows you to control the npc and get it to do
actions where they are queued as for players. If there are no
commands pending the command is executed immediately. This function
is 100% compatible with delay_command() and init_command().
- Parameters:
words - the action to perform
interval - to wait before processing another command.
If omitted defaults to 2 seconds as per players
- See also:
delay_command(), query_queued_commands(), init_command() and do_command()
- Example:
ob = clone_object(NICE_HAIRY_APE);
ob->queue_command("'I am a hairy ape!");
ob->queue_command("emote apes around the room.",5);
ob->queue_command("get banana",10);
ob->delay_command("emote get apple.",3);
Right away it says "I am a hairy ape",
2 seconds later it apes around the room,
5 seconds after that it gets a banana
and 13 seconds (10+3) after that it gets an apple.
-
rand_num
int rand_num(int no,
int type)
This method generates a random number. It used to setup the random
stats.
- Parameters:
no - the number of times to roll the dice
type - the size of the dice
- Returns:
the randomly generate number
- See also:
set_random_stats()
-
remove_achat_string
void remove_achat_string(mixed chat)
This method attempts to remove the given chat string from the
current list of attack message chat strings. The chat message is checked
to see if it exists in the array, the weighting of the
string is ignored.
- Parameters:
chat - the chat string to remove
- See also:
add_achat_string(), load_chat() and load_achat()
-
remove_chat_string
void remove_chat_string(mixed chat)
This method attempts to remove the given chat string from the
current list of chat strings. The chat message is checked
to see if it exists in the array, the weighting of the
string is ignored.
- Parameters:
chat - the chat string to remove
- See also:
add_chat_string() and load_chat()
-
remove_combat_action
int remove_combat_action(string name)
This method will remove the combat action with the specified name.
- Returns:
1 if it is found and removed, 0 if not
- See also:
add_combat_action(), query_combat_actions() and /std/effects/fighting/combat.c
-
remove_event_enter_action
void remove_event_enter_action(int id)
-
remove_event_exit_action
void remove_event_exit_action(int id)
-
remove_move_zone
void remove_move_zone(mixed zone)
This method removes a move zone from the npc.
- Parameters:
zone - the zone to remove
- See also:
add_move_zone(), query_move_zones() and set_move_after()
-
remove_spell_action
int remove_spell_action(string name)
This method removes the specified spell action.
- Parameters:
name - the name of the spell to remove
- Returns:
1 if successful, 0 if not
-
reset_chats_enabled
void reset_chats_enabled()
disable chats
-
reset_enter_commands
void reset_enter_commands()
This method resets the array of enter commands back to nothing.
- See also:
add_enter_commands() and add_enter_commands()
-
reset_fighting_chats_enabled
void reset_fighting_chats_enabled()
disable fighting chats
-
reset_move_after
void reset_move_after()
This method resets move after to 0, i.e. that they will not move.
-
run_away
varargs int run_away(object room)
This method is used to make the npc run away. This will be
called by the combat code for wimpy when the npc is bellow the
number of points used to trigger the wimpy action.
- Parameters:
room - The room to run away from. If not 0 and not environment(this_object()) the npc will not run away.
- Returns:
1 if successfuly ran away
-
set_achat_chance
void set_achat_chance(int i)
This method sets the current chat chance for attack messages on the
npc.
- Parameters:
i - the attack message chat chance
- See also:
load_chat(), load_achat() and query_achat_chance()
-
set_achat_string
void set_achat_string(string * chat)
This method sets the current chat string for attack messages on the
npc. See load_chat() for a longer description of how the
chat string is formatted.
- Parameters:
chat - the new chat attack message strings.
- See also:
load_chat(), load_achat() and query_achat_string()
-
set_aggressive
void set_aggressive(int a)
This method sets the current aggressive level of the npc.
If the aggressive is set to 1, then the npc will attack all players
that enter its environment. If the aggressive is set to 2 then
the npc will attack everything (including other npcs).
See the function start_attack() for information about things you
can do to stop aggressive npcs attacking things.
- Parameters:
a - the new aggressive level
- See also:
query_aggressive(), start_attack(), set_join_fights() and set_throw_out()
-
set_always_return_to_default_position
void set_always_return_to_default_position(int tim)
This method sets the status of the flag that makes the npc return
to the default position if its position is changed. The flag
specified the length of time to wait before causing the
default position to be restored.
- Parameters:
tim - the time to wait before the position is restored
- See also:
/std/living/living->return_to_default_position() and query_always_return_to_default_position()
-
set_cannot_change_position
void set_cannot_change_position(int flag)
This method sets the value of the unable to change position flag.
This flag will be checked by the soul, and by anything else which
deliberatly changes someones position.
- Parameters:
flag - the unable to change position flag
- See also:
/std/living/living->set_default_position()
-
set_cap_name
void set_cap_name(string s)
This method set the current capitalized name of the npc.
- Parameters:
s - the capitalized name of the npc
- See also:
query_cap_name()
-
set_chat_chance
void set_chat_chance(int i)
This method sets the current chat chance for messages on the
npc.
- Parameters:
i - the chat chance
- See also:
load_chat() and query_chat_chance()
-
set_chat_string
void set_chat_string(string * chat)
This method sets the current chat string for messages on the
npc. See load_chat() for a longer description of how the
chat string is formatted.
- Parameters:
chat - the new chat strings.
- See also:
load_chat() and query_chat_string()
-
set_chats_enabled
void set_chats_enabled()
enable chats
-
set_do_move_action
void set_do_move_action(mixed data)
Sets an action to do when moving around the place. This means
you can make the npc do things like sneak everywhere or hide
in rooms or whatever it wants to do on a move.
-
set_fighting_chats_enabled
void set_fighting_chats_enabled()
enable fighting chats
-
set_follow_speed
void set_follow_speed(int f)
This method sets the speed at which the npc will follow
after a player when they leave combat.
- Returns:
the current follow speed
- See also:
set_follow_speed()
-
set_guild
int set_guild(string str)
This method is deprecated. Use basic_setup() instead.
This method sets the current guild of the npc to the
passed in value. The guild should be one of
the guilds listed in the /std/race.c object.
This is used in conjuction with the
race when set_level is called to setup the default
attributes for the npc. This should only be
called *before* set_level() is called.
- Parameters:
str - the new guild for the npc
- See also:
query_race(), query_guild(), set_guild() and set_level()
- Example:
ob = clone_object("/obj/monster");
ob->set_guild("fighter");
inherit "/obj/monster";
void setup() {
...
set_race("fighter");
...
set_level(12);
} /* setup() */
-
set_guild_ob
void set_guild_ob(mixed g)
This method sets the guild object associated with the npc.
This will probably not do what you expect and cannot be used
in conjucton with set_level to set the guild. It is called
by /std/race.c when set_level() is called.
- Parameters:
g - the new guild object
- See also:
set_level(), set_guild() and /std/race.c
-
set_interact_with_room_objects
void set_interact_with_room_objects(int val)
-
set_join_fight_type
void set_join_fight_type(int i)
This method sets the flag which allows the npc to join into fights.
If this is set to a non-zero value then the npc will join into
fights in progress using the fight joining message.
- Parameters:
i - 1 if the npc is to join fights, 0 if not
- See also:
set_join_fights() and query_join_fight_type()
-
set_join_fights
void set_join_fights(string str)
This method sets the message to use when joining into fights.
- Parameters:
str - the message to print when joining a fight
- See also:
query_join_fights() and set_join_fight_type()
-
set_level
void set_level(int i)
This function is deprecated. Use basic_setup() instead.
This method sets the level of the npc. This should only be called
*after* the race and guild are set. If this is called before that
the results will be unexpected.
- Parameters:
i - the level to set the npc to
- See also:
set_race(), set_guild() and basic_setup()
-
set_move_after
void set_move_after(int after,
int rand)
This method sets the speed at which the npc will randomly
wander around. The npc will wander at the speed:
speed = after + random(rand)
This is called every time the npc sets up for its next move.
The move zones control
which areas the npcs will wander into, a move zone is set on the
room and the npcs will only enter rooms which have a matching
move zone. If there is no move zone, then the npc will enter
any room.
- Parameters:
after - the fixed amount of time
rand - the random amount of time
- See also:
remove_move_zone(), query_move_zones() and add_move_zone()
-
set_race
int set_race(string str)
This function is deprecated. Use basic_setup() instead.
This method sets the race of the npc. The race should be one of
the races listed in the /std/race.c object.
This is used in conjuction with the
guild when set_level is called to setup the default
attributes for the npc. This should only be
called *before* set_level() is called.
- Parameters:
str - the race to set
- Returns:
always returns 1
- See also:
query_race(), query_guild(), set_guild(), set_level() and basic_setup()
- Example:
ob = clone_object("/obj/monster");
ob->set_race("fish");
inherit "/obj/monster";
void setup() {
...
set_race("fish");
...
set_level(12);
} /* setup() */
-
set_race_ob
void set_race_ob(mixed r)
This method sets the race object associated with the npc.
This will probably not do what you expect and cannot be used
in conjucton with set_level to set the race. It is called
by /std/race.c when set_level() is called.
- Parameters:
r - the new race object
- See also:
set_level(), set_race() and /std/race.c
-
set_random_stats
void set_random_stats(int no,
int type)
This method sets the stats for the npc to some exciting random
values.
- Parameters:
no - the number of times to roll the dice
type - the size of the dice
- See also:
rand_num()
-
set_throw_out
void set_throw_out(int hps,
int chance,
string their_mess,
string everyone_mess)
This method is used to determine when to throw people out of a
room. This is what detritus uses to throw people out of the
mended drum when it gets a bit rowdy.
The hps is the level of hps at which the npc will start throwing
people out with the chance of it occuring (chance is a percentage).
People will be thrown into a random room, if the property
"no throw out"
is specified on the room then they
will not be thrown into that room.
- Parameters:
hps - the number of hps at which to start throwing people out
chance - the percentage chance of being thrown out
their_mess - the message to show them
everyone_mess - the message to show everyone else
- See also:
set_aggressive(), query_throw_out(), set_join_fights() and expand_string()
-
set_virtual_move
void set_virtual_move(int number)
This method sets the current virual move ability of the npc.
NB: This is obsolete
- Parameters:
number - 1 for virtual moving, 0 for not
- See also:
query_virtual_move()
-
setup_nationality
void setup_nationality(string nationality,
string region)
This method sets up a nationality and sets up a region in the
nationality for the npc.
- Parameters:
nationality - the nationality to set
region - the region in the nationality
-
start_attack
void start_attack(object who)
This method check to see if the npc should start attacking someone
when they enter the npcs environment. It is called from inside
init(). It will only attack if the agressive is set and the
person is visible to be attacked. The property
"no attack"
can be set on the npc (or player) to
stop them being attacked.
- Parameters:
who - the person to potentially start attacking
- See also:
set_aggressive()
-
update_position_in_route
int update_position_in_route()
Try and find the specified room somerwhere in the route, see if maybe
we skipped on further than we thought.
- Returns:
1 if we found the currenr room, 0 if not.