Jump to content

Method(s) request - Related to isInteracting


FushigiBot

Recommended Posts

Background

SF has a Is Interacting and Is Not Interacting checks. However, these are general checks and only come true if an (any) npc is interacting with the player. It doesn't take into account whether the distance you're trying to check comes from that interacting npc or whether the action you want to perform will be performed on the interacting npc. Having the following would be extremely useful for making more advanced scripts.

Methods:
If Player Distance to Entity <-- Add isInteracting filter

Interact with NPC <-- Add isInteracting filter

If NPC Overhead Prayer is <--  Add isInteracting filter

If NPC Overhead Prayer is not <-- Add isInteracting filter

If NPC Health percent is <-- Ad isInteracting filter

isInteracting(Character<?> character)
Returns whether this character is facing/interacting with the specified character.

Why is this useful?

There are certain actions in osrs that require for you to take an action based on the interacting npc rather that any npc. This includes trying to keep a safe distance from an npc in a room full of other, similar npcs (Undead Druids, Brutal Dragons, etc.). Switching to correct attack style (Demonic Gorillas). Also, when creating a slayer script so that the slayer items such as bag of salt, ice, etc. are used in the interacting npc rather than any npc in the room.

How can it be used?
Moving away from melee range in Undead Druids:

[0, Variables, getBoolean, 1:shouldMoveAway, 3:false]
[0, MyPlayer, getDistanceTo, 1:Undead Druid, 1:NPC, 1:<=, 2:1, 3:true] (isInteracting Filter)
[0, Variables, editBoolean, 1:shouldMoveAway, 3:true]

Changing to the correct weapon in Demonic Gorillas

[1, NPC, getPrayerIcon, {true}, 1:Demonic Gorilla, 1:PROTECT_FROM_MELEE] (isInteracting Filter)
[1, Variables, editString, 1:Weapon Type, 1:enableRangeWeapon]

Interacting with the correct NPC during slayer:

[2, Variables, getBoolean, 1:shouldUseSlayerItem, 3:false]
[2, NPC, getCurrentHealthPercent, 1:Rock Slug, 2:10, 1:<=] (isInteracting Filter)
[2, Variables, editBoolean, 1:shouldUseSlayerItem, 3:true]

[3, Variables, getBoolean, 1:shouldUseSlayerItem, 3:true]
[3, NPC, getCurrentHealthPercent, 1:Rock slug, 2:11, 1:>=] (isInteracting Filter)
[3, Variables, addOr]
[3, Variables, getBoolean, 1:shouldUseSlayerItem, 3:true]
[3, MyPlayer, myPlayerIsInteracting, {false}]
[3, Variables, editBoolean, 1:shouldUseSlayerItem, 3:false]

[4, Variables, getBoolean, 1:shouldUseSlayerItem, 3:true]
[4, Inventory, interactWith, 1:Bag of salt, 1:Use]
[4, NPC, interactWith, 1:Rock slug, 1:Use, 3:true, 3:false, 3:true, 3:false, 3:false] (isInteracting Filter)

 

Edited by FushigiBot
  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...