Jump to content

llPushObject not triggering


Pieguymystery
 Share

You are about to reply to a thread that has been inactive for 68 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

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.

Link to comment
Share on other sites

1 hour ago, Wulfie Reanimator said:

Your force is probably too small. Add a bit of upward force to avoid friction with the ground. Make the pushing object larger.

No dice.
I upped it to <20.0,20.0,20.0> and then to <100.0,100.0,100.0> and other variations for the impulse vector of the function just to test, the agent/avatar didn't move an inch.

I've since tested the snippet of code provided as an example on the llPushObject wiki page, and that snippet did work. Still at a loss for why mine isn't working.
I'll just continue messing with it in case I somehow stumble across a solution.

Link to comment
Share on other sites

Okay, I've partially solved it with the help of a friend.
They made a prim with a script a long time ago revolving around llPushObject and gave me a copy of said script to take a look at, it worked.
I got curious and deleted the script inside and then put my script (the one posted at the top of the page) in and it suddenly just works.

I then copied the prim's parameters over (to my knowledge shouldn't matter) to a fresh prim and put my script in, script doesn't work.

Am I just missing something that's related to prim properties or something?

Edited by Pieguymystery
Clearing up info. Mentioning the item my friend gave me was a prim with a script, not just a script.
Link to comment
Share on other sites

I figured it out.
 

1 hour ago, Pieguymystery said:

I then copied the prim's parameters over (to my knowledge shouldn't matter) to a fresh prim and put my script in, script doesn't work.

For some reason this made the new prim miniscule. I'm assuming it has to do with something with energy, but making the prim large again caused it to work.
I'm embarrassed it took so long to realize it was a sizing issue but also relieved that I figured it out.

  • Like 1
Link to comment
Share on other sites

5 hours ago, Pieguymystery said:

I'm embarrassed it took so long to realize it was a sizing issue but also relieved that I figured it out.

The energy system is anything but intuitive and affects very few specific systems; Thanks for telling us how you figured it out!

  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 68 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...