Hi, this is my first time making a post on here and I haven't found any posts with a solution for this and I'm at a loss.
For a bit of background, I'm making a script to push anyone in front of my avatar back a little bit, mostly because I want to test llPushObject but I might use it for a sort of 'stay on top of the tower' type game, like the wii sports resort swordplay minigame.
default
{
attach(key id)
{
if(id)
{
llReleaseControls();
llResetScript();
}
else
{
llSensorRemove();
llReleaseControls();
}
}
state_entry()
{
llSensorRemove();
llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
}
run_time_permissions (integer perm)
{
if (perm & PERMISSION_TAKE_CONTROLS)
{
llTakeControls(CONTROL_ML_LBUTTON,TRUE,TRUE);
}
}
control (key id, integer level, integer edge)
{
integer start = level & edge;
integer end = ~level & edge;
integer held = level & ~edge;
integer untouched = ~(level | edge);
if (start & CONTROL_ML_LBUTTON)
{
llSensorRepeat("","",ACTIVE|PASSIVE|AGENT,5.0,PI/4,0.08);
llOwnerSay("Sensor started."); //Test code, delete after.
}
if (end & CONTROL_ML_LBUTTON)
{
llSensorRemove();
llOwnerSay("Sensor removed."); //Test code, delete after.
}
}
sensor (integer detectedAgent)
{
while(detectedAgent--)
{
key agentKey = llDetectedKey(detectedAgent); //Get detected agent's key.
vector agentPos = llDetectedPos(detectedAgent); //Get detected agent's position.
vector agentVelocity = llDetectedVel(detectedAgent); //Get the movement velocity of detected agent.
if (llGetAgentSize(agentKey) != ZERO_VECTOR) //If the detected agent hasn't left the region, perform task.
{
float agentMass = llGetObjectMass(agentKey); //Get the mass of the agent.
llPushObject(agentKey, <5.0,5.0,0.0> * agentMass, ZERO_VECTOR, FALSE); //Push the agent 5 units back on the x and y axis.
llOwnerSay("Key is " + (string)agentKey + "! Push triggered."); //Test code, delete after.
//Everything works, but llPushObject doesn't move the agent.
}
}
}
}
The issue I'm having is that it's working up into the if (llGetAgentSize(agentKey) != ZERO_VECTOR) loop, but the llPushObject is not moving anything. I've tested it on an alt I made to test code that requires another person and nothing happens.
Before it's mentioned, the land I'm on has pushing enabled and scripts allowed.