Hi, im having issues with this script. I'm not really used to using triggeractions so I was wondering if anyone could help me figure out the issue as to why my triggeraction isn't actually being triggered. This code is in a Class. It seems fine as far as the button being called and checking for the player.x/y but when I try to do the trigger to serverside, it doesn't seem to trigger for some odd reason.
NPC Code:
function onCreated() setshape(1, 32, 32);
function onPlayerchats() {
if (player.chat == ":destroy") {
destroy();
}
}
function onActionPickup()
{
destroy();
player.chat = "Pick up item!";
}
//#CLIENTSIDE
function onCreated() {
setImg("block.png");
setshape(1, 32, 32);
dontblock();
drawunderplayer();
onTimeout();
}
function onTimeout()
{
if (player.x in |x - 3, x + 2| && player.y in |y - 3.5, y + 2|) {
client.inPickupRange = true;
} else {
client.inPickupRange = false;
}
setTimer(0.01);
}
function onKeyPressed(keycode, keyname)
{
if (keyname == "A") {
if (client.inPickupRange) {
triggeraction(x + 0.5, y + 0.5, "Pickup");
}
}
}