CUSTOM USE
This is the function from my recent Free Movement Interaction video.
This function provides an alternate way of interacting with objects and characters in Free Movement if you are experiencing issues with the collision based system.
This function will check all four tiles immediately around the player's tile at the time of execution (usually a keybind) in all four directions (north_tile, south_tile, west_tile, east_tile), store any characters and objects found in that radius, check the player's camera direction and then if in the direction of a valid object/character, will trigger a remote interact of the entity, using the extremely useful new (V1.1) interact_with_entity() command.
Few things to note:
This function prioritises Characters above Objects if both are found on the same tile.
If you wish to swap that, then check for object first, then else, check for character.
If you want to trigger both, then you could check if both are valid, then interact_with_entity character followed by object.
Also:
NAVIGATION REQUIRED!
For this function to work, although in Free Movement, the player no longer needs the navigation lines, for the north_tile, east_tile process to work, all tiles should be linked up in some fashion on the navigation grid.
Pending can be used as an alternative to none functionality wise.
To install, somply copy pase the following code into the Game Configuration > Global Functions panel.
function custom_use() begin
$player_tile = tile[player.coord.x, player.coord.y, player.coord.z];
if $player_tile.north_tile.objects != null then
$north_object = $player_tile.north_tile.objects[0];
end;
if $player_tile.east_tile.objects != null then
$east_object = $player_tile.east_tile.objects[0];
end;
if $player_tile.south_tile.objects != null then
$south_object = $player_tile.south_tile.objects[0];
end;
if $player_tile.west_tile.objects != null then
$west_object = $player_tile.west_tile.objects[0];
end;
if $player_tile.north_tile.characters != null then
$north_character = $player_tile.north_tile.characters[0];
end;
if $player_tile.east_tile.characters != null then
$east_character = $player_tile.east_tile.characters[0];
end;
if $player_tile.south_tile.characters != null then
$south_character = $player_tile.south_tile.characters[0];
end;
if $player_tile.west_tile.characters != null then
$west_character = $player_tile.west_tile.characters[0];
end;
if player.direction == NORTH then
if $north_character != null then
interact_with_entity($north_character);
else
if $north_object != null then
interact_with_entity($north_object);
end;
end;
elseif player.direction == EAST then
if $east_character != null then
interact_with_entity($east_character);
else
if $east_object != null then
interact_with_entity($east_object);
end;
end;
elseif player.direction == SOUTH then
if $south_character != null then
interact_with_entity($south_character);
else
if $south_object != null then
interact_with_entity($south_object);
end;
end;
elseif player.direction == WEST then
if $west_character != null then
interact_with_entity($west_character);
else
if $west_object != null then
interact_with_entity($west_object);
end;
end;
end;
end;
To use, make a script and add the following code to it to call the function.
custom_use();
Feel free to bind this script over the top of the base interact key, or to another key to benefit from both interaction styles.