Author Topic: Issue with the input event OnPlayerTouch  (Read 461 times)

I am experiencing an issue with OnPlayerTouch - it doesn't work in certain situations.

Some background: I am using this for my Event based CRPG.  To test out my food system, I made an apple.  To make this apple work, you click it, a message appears asking "Would you like to pick up some Apples?".  In response to this, the player says "Yes".  Another message appears asking "How many would you like to pick up?", and the player types in a number less than or equal to the carriable space they have left for food.

This works perfectly when the apple is on the map floor away from any other brick, which is where I initially made it.  I then duplicated it into the build it was intended for (such that the apple was surrounded by bricks), and when I tested (activated) it, only the "Would you like to pick up some Apples?" message appeared (which was based on an OnActivate input).  When I tried typing "Yes", nothing happened.

After being discouraged by this issue and doing other things, I came back to the apple to run some diagnostic tests.  My first test, I planted a brick on top of another brick that is in the build where the apple is supposed to be (on the floor in a building).  On this brick, I evented the following:

Code: [Select]
[x] [0] [OnPlayerTalk] [Self] [SetColor] [red]

When I talked near this brick, the brick turned red, thus proving that OnPlayerTalk works when near other bricks.  After this, I used some VCE that is similar to the apple's system:

Code: [Select]
[x] [0] [OnPlayerTalk] [Self] [VCE_IfValue] [<var:gl:lastmsg>] [==] [Yes] [1 1]
[x] [1] [OnVariableTrue] [Self] [SetColor] [Red]

When I typed "Yes", the brick changed color, thus proving that OnPlayerTalk is compatible with at least that bit of VCE.  After this, I got impatient and copied the entirety of the apple's events onto this brick, and added some "OnVariableTrue/False>Self>SetColor" lines of events in there every time there was an Ifvalue or Ifvariable.  Regardless, nothing changed color - only the "Would you like to pick up some Apples?" message came up.  I will now attempt to replicate the problem area in the apple's events (idk the exact line numbers, just goin with what I remember).

Code: [Select]
[x] [5] [OnVariableTrue] [Client] [Chatmessage] [<color:00ff00>Grocery<color:ffffff>: Would you like to pick up some Apples?"]
[x] [6] [OnVariableTrue] [Player] [VCE_ModVariable] [FoodVariable] [Set] [Apple1A]
[x] [7] [OnPlayerTalk] [Player] [VCE_IfVariable] [FoodVariable] [==] [Apple1A] [8 8]
[x] [8] [OnVariableTrue] [Self] [VCE_IfValue] [<var:gl:lastmsg>] [Yes] [9 10]
[x] [9] [OnVariableTrue] [Client] [Chatmessage] [<color:00ff00>Grocery<color:ffffff>: How many would you like to pick up?]
[x] [10] [OnVariableTrue] [Player] [VCE_ModVariable] [FoodVariable] [Set] [Apple1B]
[x] [11] [OnPlayerTalk] [Player] [VCE_IfVariable] [FoodVariable] [==] [Apple1B] [12 12]
[x] [12] [OnVariableTrue] [Self] [VCE_IfValue] [<var:gl:lastmsg>] [<=] [<var:pl:FoodEmpty>] [13 17]
[x] [13] [OnVariableFalse] [Client] [Chatmessage] [<color:00ff00>Grocery<color:ffffff>: You did not enter a valise number.  Please try again.]
[x] [14] [OnVariableTrue] [Player] [VCE_ModVariable] [FoodTotal] [Add] [<var:gl:lastmsg>]
[x] [15] [OnVariableTrue] [Player] [VCE_ModVariable] [FoodEmpty] [Subtract] [1]
[x] [16] [OnVariableTrue] [Player] [VCE_ModVariable] [Apple] [Add] [<var:gl:lastmsg>]
[x] [17] [OnVariableTrue] [Self] [VCE_IfValue] [<var:gl:lastmsg>] [==] [1] [18
[x] [18] [OnVariableTrue] [Client] [Chatmessage] [<color:00ff00>Grocery<color:ffffff>: You have picked up one Apple.]
[x] [19] [OnvariableFalse] [Client] [Chatmessage] [<color:00ff00> Grocery<color:ffffff>: You have picked up the Apples.

That should be all that is necessary.  So, when this is on the brick, and I click it and say "Yes" while the brick is inside my build and on the floor, it doesn't give the "How many..." message.  After this, I duplicated it on to the map floor (far from other bricks) and it worked fine.  When I placed another brick near the one with events on the map floor (such as one brick away, two bricks away, etc.), if the brick is right next to the evented brick, nothing happens beyond the initial message.  When the bricks are two-three bricks away, the events work, and I can type "Yes" and the number of apples wanted.

Help me figure out why the apple brick does not respond to OnPlayerTalk when near any other brick.

IT'S ONPLAYERTALK, NOT TOUCH.  MY PHONE AUTOCORRECTED and [noedit]

Locking because title may be skewing who comes here to help.