Home

[Package Index | Mudlib Index | Effect Index]

File /obj/longshot.c

Written by Gerbil This is the longshot line-of-sight ranging thingamy. You can use it to make throwing knives, bows, fireballs or whatever. However, if you want to make a dammaging weapon, the ammo should include base_projectile. p All standard messages are supported, with the inclusion of: p $gffg which will be substituted for the query_short of the item p $qtm which will be substituted for the query_target_message p

Inherits

This class inherits the following classes /std/secure/longshot.c

Includes

This class includes the following files /include/dirs.h

Method index

  • add_ammo(mixed)
    This function is used to add to the list of valid ammo
  • add_room(mixed, string, int)
    Function to add a room to the rooms array
  • calc_damage(object)
    This function calculates the dammage done.
  • cause_harm(object, object)
    This is the really cool function for doing damage
  • find_angle(int *, int *)
    This function finds the angle between the first two points of the two given points.
  • get_long()
    this function will tell the holder about the room they are looking at
  • handle_firing_messages(int, mixed *, object)
    Due to the size of an array of each message for each case to be displayed when firing occurs, it's easier just to mask this function with your own messages in place
  • pk_allowed()
    This function checks things like both people are PK, the target isn't sanc'ed, etc.
  • query_active_room()
    This finds the room currently being sighted into
  • query_ammo()
    This function returns the list of valid ammo types
  • query_angles()
    This function returns the four angles for sighting
  • query_attack_skill()
    This function returns the skill used for attacking
  • query_booleans()
    This function returns the boolean storage variable
  • query_capacity()
    This function returns tha ammount of ammo holdable by the item
  • query_cmdstring()
    This function returns an array of strings representing the commands used to operate the item
  • query_cocked()
    This function returns wether the item is cocked or not
  • query_defence_skill()
    This function returns the defence skill for the item
  • query_fire_delay()
    This function returns the delay between typing the command to fire the weapon, and it actually going off.
  • query_fire_string()
    This function pairs up the in and out doors for each room along the fire path
  • query_how_hard()
    This function is to see how hard it is to hit something at the present range.
  • query_in_door()
    Thius function determines what door the projectile will enter the target room from
  • query_origin()
    This function returns the recorded origin of the holder
  • query_out_door()
    This function determines the door the projectile will leave through
  • query_range()
    This function returns how far in feet the object can be sighted
  • query_reload_message()
    This function returns the reload messages
  • query_return_path()
    This function returns an array of strings.
  • query_right_ammo(object)
    This is to determine if a particular object is considered to be valid ammo
  • query_rooms()
    This function returns a pointer to the array of rooms stored for use.
  • query_sight_message()
    This function returns the sight messages
  • query_size_of_room(mixed)
    This finds the 3 dimensions of the given room
  • query_target_dests()
    This returns all the rooms linked to from the target room
  • query_target_exits()
    This function returns all exits from the current target room
  • query_target_mess()
    Special message function.
  • query_target_message()
    This function returns the target messages
  • query_targeted()
    This function returns the object currently being targeted by the item
  • query_valid_room(string)
    This decides if the sightee can see into the given room
  • range(mixed *)
    This function returns the range to the given room
  • rework_last_rooms()
    This function reworks the last few rooms.
  • rework_rooms_array()
    This function makes sure the rooms array is okay, and you are not shooting through 90 degree angles in open areas
  • set_ammo(mixed)
    This function sets the list of valid ammo types
  • set_attack_skill(string)
    This function is to set the skill that will be used to see if the firer hit or not.
  • set_capacity(int)
    This function sets the ammount of ammo that fits in the magazine
  • set_cocked(int)
    This function sets the cocked value of the item
  • set_defense_skill(string)
    This function is to set the skill that will be used to see if the target was hit or not.
  • set_fire_command(string, int)
    This is the command used to set the fire command and syntax.
  • set_fire_delay(int)
    This function sets the delay between typing the command to fire the weapon and it actually going off.
  • set_howhard(int, int)
    This function sets how hard it is to hit the target.
  • set_player(object)
    Sets the player associated with the object.
  • set_range(int)
    This sets the range of the item
  • set_range_mess(string *)
    This function sets the messages used when the item is ranged
  • set_reload_command(string)
    This is slightly misleading.
  • set_reload_mess(string *)
    This function sets the messages used when the item is reloaded.
  • set_sight_command(string)
    This is the function to set the command used to sight the item through the various rooms.
  • set_sight_mess(string *)
  • set_target_command(string)
  • set_target_mess(string *)
    This sets the targeting messages
  • set_targeted(object)
    This function sets who the item is currently targeted on
  • store_booleans(int)
    This function stores the boolean values you give it.
  • string_manip(string)
    This does the string manipulations not supported by standard messaging
  • target_died(object)
    This lets the holder know the target has died
  • target_moved(object, mixed)
    This function is called when the target moves.
  • track_target(object, mixed)
    This function handles tracking of the target as they move
  • valid_target()
    * This fuction decides if the tagret is a valid one.

Public Functions

These are functions that everyone can access.

.

    add_room
    varargs int add_room(mixed name,
                         string direct,
                         int cf)
    

    Function to add a room to the rooms array
    • Parameters:
      name - The string idenntifier for the room
      direct - The direction being sighted in to get to this room
        calc_damage
        int calc_damage(object bullet)
        

        This function calculates the dammage done.
        • Parameters:
          bullet - The projectile inflicting the dammage
            cause_harm
            void cause_harm(object target,
                            object bullet)
            

            This is the really cool function for doing damage
            • Parameters:
              target - The person getting hammered
              bullet - The thing hammering into them
                find_angle
                float find_angle(int * point,
                                 int * ori)
                

                This function finds the angle between the first two points of the two given points. Sounds weird when you say it like that, huh?
                • Parameters:
                  point - An array of 2+ integers. Only the first two will be used to determine the point in space
                  ori - An array of 2+ integers. Only the first two will beused to determine the point in space.
                    get_long
                    void get_long()
                    

                    this function will tell the holder about the room they are looking at
                      handle_firing_messages
                      void handle_firing_messages(int missed,
                                                  mixed * doors,
                                                  object bullet)
                      

                      Due to the size of an array of each message for each case to be displayed when firing occurs, it's easier just to mask this function with your own messages in place
                      • Parameters:
                        missed - 1 if missed, 0 if hit
                        doors - The doors the projectile will enter/exit
                        bullet - The projectile
                          pk_allowed
                          int pk_allowed()
                          

                          This function checks things like both people are PK, the target isn't sanc'ed, etc.
                            query_active_room
                            string query_active_room()
                            

                            This finds the room currently being sighted into
                              query_ammo
                              string * query_ammo()
                              

                              This function returns the list of valid ammo types
                              • See also:
                                set_ammo(), add_ammo(), query_right_ammo()
                                  query_angles
                                  float * query_angles()
                                  

                                  This function returns the four angles for sighting
                                    query_attack_skill
                                    string query_attack_skill()
                                    

                                    This function returns the skill used for attacking
                                    • See also:
                                      query_defence_skill(), set_attack_skill() and set_defence_skill()
                                        query_booleans
                                        int query_booleans()
                                        

                                        This function returns the boolean storage variable
                                          query_capacity
                                          int query_capacity()
                                          

                                          This function returns tha ammount of ammo holdable by the item
                                          • See also:
                                            set_capacity()
                                              query_cmdstring
                                              string * query_cmdstring()
                                              

                                              This function returns an array of strings representing the commands used to operate the item
                                                query_cocked
                                                int query_cocked()
                                                

                                                This function returns wether the item is cocked or not
                                                  query_defence_skill
                                                  string query_defence_skill()
                                                  

                                                  This function returns the defence skill for the item
                                                  • See also:
                                                    query_attack_skill(), set_attack_skill() and set_defence_skill()
                                                      query_fire_delay
                                                      int query_fire_delay()
                                                      

                                                      This function returns the delay between typing the command to fire the weapon, and it actually going off.
                                                        query_fire_string
                                                        string * query_fire_string()
                                                        

                                                        This function pairs up the in and out doors for each room along the fire path
                                                        • See also:
                                                          query_in_door(), query_out_door()
                                                            query_how_hard
                                                            int query_how_hard()
                                                            

                                                            This function is to see how hard it is to hit something at the present range.
                                                            • Returns:
                                                              An integer representing how hard it is to hit the target at the present range
                                                            • See also:
                                                              set_howhard()
                                                                query_in_door
                                                                string query_in_door()
                                                                

                                                                Thius function determines what door the projectile will enter the target room from
                                                                • See also:
                                                                  query_fire_string(), query_out_door()
                                                                    query_origin
                                                                    int * query_origin()
                                                                    

                                                                    This function returns the recorded origin of the holder
                                                                      query_out_door
                                                                      string query_out_door()
                                                                      

                                                                      This function determines the door the projectile will leave through
                                                                      • See also:
                                                                        query_in_door(), query_fire_string()
                                                                          query_range
                                                                          int query_range()
                                                                          

                                                                          This function returns how far in feet the object can be sighted
                                                                          • See also:
                                                                            set_range()
                                                                              query_reload_message
                                                                              string * query_reload_message()
                                                                              

                                                                              This function returns the reload messages
                                                                                query_return_path
                                                                                string * query_return_path()
                                                                                

                                                                                This function returns an array of strings. These strings are the exits to be taken to return to the firer
                                                                                  query_right_ammo
                                                                                  int query_right_ammo(object ob)
                                                                                  

                                                                                  This is to determine if a particular object is considered to be valid ammo
                                                                                  • Parameters:
                                                                                    ob - This is the object pointer to the object
                                                                                  • See also:
                                                                                    set_ammo(), add_ammo(), query_ammo()
                                                                                      query_rooms
                                                                                      mixed * query_rooms()
                                                                                      

                                                                                      This function returns a pointer to the array of rooms stored for use. Remember, if you query this variable, and then modify it, YOU ALSO MODIFY THE VALUES STORED IN THE ITEM. Also, this will point to a dynamic array, so be careful about storing it for later
                                                                                        query_sight_message
                                                                                        string * query_sight_message()
                                                                                        

                                                                                        This function returns the sight messages
                                                                                          query_size_of_room
                                                                                          int * query_size_of_room(mixed room)
                                                                                          

                                                                                          This finds the 3 dimensions of the given room
                                                                                          • Parameters:
                                                                                            room - A pointer to a room object
                                                                                              query_target_dests
                                                                                              string * query_target_dests()
                                                                                              

                                                                                              This returns all the rooms linked to from the target room
                                                                                              • See also:
                                                                                                query_target_exits()
                                                                                                  query_target_exits
                                                                                                  string * query_target_exits()
                                                                                                  

                                                                                                  This function returns all exits from the current target room
                                                                                                  • See also:
                                                                                                    query_target_dests .c
                                                                                                      query_target_mess
                                                                                                      string query_target_mess()
                                                                                                      

                                                                                                      Special message function. Returns "at " if the target is in the same room as the firer, or "to the " otherwise
                                                                                                        query_target_message
                                                                                                        string * query_target_message()
                                                                                                        

                                                                                                        This function returns the target messages
                                                                                                          query_targeted
                                                                                                          object query_targeted()
                                                                                                          

                                                                                                          This function returns the object currently being targeted by the item
                                                                                                            query_valid_room
                                                                                                            int query_valid_room(string name)
                                                                                                            

                                                                                                            This decides if the sightee can see into the given room
                                                                                                            • Parameters:
                                                                                                              name - A string representing the room
                                                                                                                range
                                                                                                                int range(mixed * target)
                                                                                                                

                                                                                                                This function returns the range to the given room
                                                                                                                • Parameters:
                                                                                                                  target - An entry to the rooms array to get the range to
                                                                                                                    rework_last_rooms
                                                                                                                    int rework_last_rooms()
                                                                                                                    

                                                                                                                    This function reworks the last few rooms. Meant as a slowrework rooms array, which is probably redundant now...
                                                                                                                      rework_rooms_array
                                                                                                                      int rework_rooms_array()
                                                                                                                      

                                                                                                                      This function makes sure the rooms array is okay, and you are not shooting through 90 degree angles in open areas
                                                                                                                        set_ammo
                                                                                                                        void set_ammo(mixed am)
                                                                                                                        

                                                                                                                        This function sets the list of valid ammo types
                                                                                                                        • Parameters:
                                                                                                                          am - An array of strings or a string, each being a filename of some peice of valid ammo
                                                                                                                        • See also:
                                                                                                                          query_right_ammo(), add_ammo(), query_ammo()
                                                                                                                            set_attack_skill
                                                                                                                            void set_attack_skill(string str)
                                                                                                                            

                                                                                                                            This function is to set the skill that will be used to see if the firer hit or not. It defaults to fighting.combat.range.fired.
                                                                                                                            • Parameters:
                                                                                                                              str - The new skill to use
                                                                                                                            • See also:
                                                                                                                              set_defence_skill(), query_attack_skill() and query_defence_skill()
                                                                                                                                set_capacity
                                                                                                                                void set_capacity(int numb)
                                                                                                                                

                                                                                                                                This function sets the ammount of ammo that fits in the magazine
                                                                                                                                • Parameters:
                                                                                                                                  numb - the number of items
                                                                                                                                • See also:
                                                                                                                                  query_capacity()
                                                                                                                                    set_cocked
                                                                                                                                    void set_cocked(int i)
                                                                                                                                    

                                                                                                                                    This function sets the cocked value of the item
                                                                                                                                      set_defense_skill
                                                                                                                                      void set_defense_skill(string str)
                                                                                                                                      

                                                                                                                                      This function is to set the skill that will be used to see if the target was hit or not. It defaults to fighting.combat.melee.dodge.fired.
                                                                                                                                      • Parameters:
                                                                                                                                        str - The new defence skill
                                                                                                                                      • See also:
                                                                                                                                        set_attack_skill(), query_attack_skill() and query_defence_skill()
                                                                                                                                          set_fire_command
                                                                                                                                          varargs void set_fire_command(string str,
                                                                                                                                                                        int i)
                                                                                                                                          

                                                                                                                                          This is the command used to set the fire command and syntax.
                                                                                                                                          • Parameters:
                                                                                                                                            str - The command to fire the item
                                                                                                                                            i - set to one if using things like bows which are not really loaded but still fire projectiles.
                                                                                                                                          • See also:
                                                                                                                                            set_sight_command(), set_range_command(), set_reload_command()
                                                                                                                                              set_fire_delay
                                                                                                                                              void set_fire_delay(int i)
                                                                                                                                              

                                                                                                                                              This function sets the delay between typing the command to fire the weapon and it actually going off. It defaults to 5 seconds.
                                                                                                                                              • Parameters:
                                                                                                                                                i - the delay in seconds
                                                                                                                                                  set_howhard
                                                                                                                                                  void set_howhard(int arg1,
                                                                                                                                                                   int arg2)
                                                                                                                                                  

                                                                                                                                                  This function sets how hard it is to hit the target.
                                                                                                                                                  • Parameters:
                                                                                                                                                    arg1 - How hard at range = 0 feet
                                                                                                                                                    arg2 - Extra dificaulty per 20 feet
                                                                                                                                                      set_player
                                                                                                                                                      void set_player(object thing)
                                                                                                                                                      

                                                                                                                                                      Sets the player associated with the object. This is used during the autoload sequence.
                                                                                                                                                      • Parameters:
                                                                                                                                                        thing - the player object we belong to
                                                                                                                                                      • See also:
                                                                                                                                                        /global/auto_load.c
                                                                                                                                                          set_range
                                                                                                                                                          void set_range(int i)
                                                                                                                                                          

                                                                                                                                                          This sets the range of the item
                                                                                                                                                          • Parameters:
                                                                                                                                                            i - The range in feet
                                                                                                                                                          • See also:
                                                                                                                                                            query_range()
                                                                                                                                                              set_range_mess
                                                                                                                                                              void set_range_mess(string * str)
                                                                                                                                                              

                                                                                                                                                              This function sets the messages used when the item is ranged
                                                                                                                                                              • Parameters:
                                                                                                                                                                str - An array of one or two strings. If one, the message is shown to everyone. If two, the first is shown to the ranger, the second to everyone else.
                                                                                                                                                              • See also:
                                                                                                                                                                set_reload_mess(), set_target_mess()
                                                                                                                                                                  set_reload_command
                                                                                                                                                                  void set_reload_command(string str)
                                                                                                                                                                  

                                                                                                                                                                  This is slightly misleading. You can load using "put". Reload is like cocking the weapon, or yanking the bolt, or winding the springs.
                                                                                                                                                                  • Parameters:
                                                                                                                                                                    str - The command for readying the item
                                                                                                                                                                  • See also:
                                                                                                                                                                    set_fire_command(), set_sight_command(), set_target_command()
                                                                                                                                                                      set_reload_mess
                                                                                                                                                                      void set_reload_mess(string * str)
                                                                                                                                                                      

                                                                                                                                                                      This function sets the messages used when the item is reloaded.
                                                                                                                                                                      • Parameters:
                                                                                                                                                                        str - An array of one or two strings. If one, the message is shown to everyone. If two, the first goes to the reloader, the second to everyone else
                                                                                                                                                                      • See also:
                                                                                                                                                                        set_target_mess(), set_sight_mess()
                                                                                                                                                                          set_sight_command
                                                                                                                                                                          void set_sight_command(string str)
                                                                                                                                                                          

                                                                                                                                                                          This is the function to set the command used to sight the item through the various rooms.
                                                                                                                                                                          • Parameters:
                                                                                                                                                                            str - The command to use to adjust the sights
                                                                                                                                                                          • See also:
                                                                                                                                                                            set_fire_command(), set_sight_range_command(), set_target_command()
                                                                                                                                                                              set_sight_mess
                                                                                                                                                                              void set_sight_mess(string * str)
                                                                                                                                                                              
                                                                                                                                                                                set_target_command
                                                                                                                                                                                void set_target_command(string str)
                                                                                                                                                                                
                                                                                                                                                                                  set_target_mess
                                                                                                                                                                                  void set_target_mess(string * str)
                                                                                                                                                                                  

                                                                                                                                                                                  This sets the targeting messages
                                                                                                                                                                                  • Parameters:
                                                                                                                                                                                    str - An array of one or two messages. If one, this message is shown to everyone. If two, the first is shown to the targeter, and the second to everyone else
                                                                                                                                                                                  • See also:
                                                                                                                                                                                    set_reload_command(), set_sight_command()
                                                                                                                                                                                      set_targeted
                                                                                                                                                                                      void set_targeted(object ob)
                                                                                                                                                                                      

                                                                                                                                                                                      This function sets who the item is currently targeted on
                                                                                                                                                                                      • Parameters:
                                                                                                                                                                                        ob - The new target
                                                                                                                                                                                          store_booleans
                                                                                                                                                                                          void store_booleans(int i)
                                                                                                                                                                                          

                                                                                                                                                                                          This function stores the boolean values you give it. USE WITH EXTREME CAUTION!
                                                                                                                                                                                          • Parameters:
                                                                                                                                                                                            i - An integer with the booleans stored in it
                                                                                                                                                                                              string_manip
                                                                                                                                                                                              string string_manip(string str)
                                                                                                                                                                                              

                                                                                                                                                                                              This does the string manipulations not supported by standard messaging
                                                                                                                                                                                              • Parameters:
                                                                                                                                                                                                str - The string to be manipulated
                                                                                                                                                                                                  target_died
                                                                                                                                                                                                  void target_died(object pl)
                                                                                                                                                                                                  

                                                                                                                                                                                                  This lets the holder know the target has died
                                                                                                                                                                                                  • Parameters:
                                                                                                                                                                                                    pl - The person speaking to the boney guy
                                                                                                                                                                                                      target_moved
                                                                                                                                                                                                      void target_moved(object ob,
                                                                                                                                                                                                                        mixed dest)
                                                                                                                                                                                                      

                                                                                                                                                                                                      This function is called when the target moves. It puts in a delay and then calls track_target
                                                                                                                                                                                                      • Parameters:
                                                                                                                                                                                                        ob - The object that is moving
                                                                                                                                                                                                        dest - Where they are moving to
                                                                                                                                                                                                          track_target
                                                                                                                                                                                                          void track_target(object ob,
                                                                                                                                                                                                                            mixed dest)
                                                                                                                                                                                                          

                                                                                                                                                                                                          This function handles tracking of the target as they move
                                                                                                                                                                                                          • Parameters:
                                                                                                                                                                                                            ob - The object moving
                                                                                                                                                                                                            dest - The place they are moving to
                                                                                                                                                                                                              valid_target
                                                                                                                                                                                                              int valid_target()
                                                                                                                                                                                                              

                                                                                                                                                                                                              * This fuction decides if the tagret is a valid one. It * should be masked for things like anti-non-living things * @returns 1 if vaid target, 0 otherwise
Valid HTML 4.01 Transitional
Valid CSS!
Read More