Author Topic: Playing an animation when a player gets in a vehicle?  (Read 1491 times)

I'm attemping to have a script where whenever a play gets in the driver seat of a vehicle that they would raise their arms, like in the /hug emote. I found this snippet of code in Phy's bikes.
Code: [Select]
   numMountPoints = 1;
   mountThread[5] = "armreadyboth";
   mountNode[0] = 5;
};
How ever, I'm not exactly sure how I would go about making a script where this would affect all vehicles. Help would be nice.

You don't appear to know much about torquescript
Here:
Code: [Select]
packageAllHug
{
    function Armor::onMount(%this,%obj,%col,%slot)
    {
        Parent::onMount(%this,%obj,%col,%slot);
        %obj.playthread(hug);
        //or whatever the hug animation is
    }
};
activatePackage(AllHug);
[\code]

Appears to have a syntax error of some sort.
Code: [Select]
Loading Add-On: Script_AllHug (CRC:1231078410)
Add-Ons/Script_AllHug/server.cs Line: 2 - Syntax error.
>>> Some error context, with ## on sides of error halt:
ackageAllHug

{##
##
    function Armor::onMount(%this,%obj,%col,%slot)

    {

        Parent::onMount(%this,%obj,%col,%slot);

        %obj.playthread(m_armreadyboth);

        //or whatever the hug animation is

    }

};

activatePackage(AllHug);
>>> Error report complete.

ADD-ON "Script_AllHug" CONTAINS SYNTAX ERRORS

Change the first line from this: packageAllHug
To this: package AllHug

No syntax errors, but it doesn't do anything.
Also, does it matter what program what you save the .cs in? I've been saving it in notepad but when i save it in notepad++ it suddenly doesn't have any errors.
Quote
package AllHug

{

    function Armor::onMount(%this,%obj,%col,%slot)

    {

        Parent::onMount(%this,%obj,%col,%slot);

        %obj.playthread(m_armreadyboth);

        //or whatever the hug animation is

    }

};

activatePackage(AllHug);

Oops, thought I put the space there

Anyway, did you enable it?
Just to make sure, you should have a folder named Server_AllHug or something similar. In it, you should have a description.txt, and a server.cs with the code in it.

Just me or did you do the wrong arguments on the playThread() function? Isn't there two arguments- don't remember them exactly atm though

Just me or did you do the wrong arguments on the playThread() function? Isn't there two arguments- don't remember them exactly atm though
The first one is the slot and the second is the animation, I believe

Why not simply call serverCmdHug(%client); instead of doing the animations yourself?

Code: [Select]
package AllHug
{
function Armor::onMount(%this,%player,%obj,%a,%b,%c,%d,%e,%f)
{
Parent::onMount(%this,%player,%obj,%a,%b,%c,%d,%e,%f);
servercmdhug(%player.client);
}
};
activatepackage(AllHug);