next headache : %obj.setImageScriptAnimPrefix
by Grey9999 · in Torque 3D Professional · 03/12/2013 (3:37 am) · 3 replies
I can't get this to work at all. According to the documentation %obj.setImageScriptAnimPrefix( 0, "aim");
without any other prefixes should cause it to use animations like "aim_root, aim_run" etc....
how do you use this thing? These functions are called by some of my weapons states (which are triggered by the altfire trigger, in this cause mouse 2 being held down);
without any other prefixes should cause it to use animations like "aim_root, aim_run" etc....
how do you use this thing? These functions are called by some of my weapons states (which are triggered by the altfire trigger, in this cause mouse 2 being held down);
function WeaponImage::onReady(%this, %obj, %slot)
{
echo( "Ready!");
%obj.setImageScriptAnimPrefix( 0, "");
ServerConnection.zoomed = false;
setFov(ServerConnection.getControlCameraDefaultFov());
Reticle.setVisible(false);
zoomReticle.setVisible(false);
ppOptionsUpdateDOFSettings();
}
function WeaponImage::onAim(%this, %obj, %slot)
{
$Player::CurrentFOV = 65;
$Player::ZoomSpeed = 500;
%obj.setImageScriptAnimPrefix( 0, "aim");
ServerConnection.zoomed = true;
setZoomSpeed($Player::ZoomSpeed);
setFov($Player::CurrentFOV);
Reticle.setVisible(true);
zoomReticle.setVisible(false);
echo( "Aiming!" );
//DOFPostEffect.setAutoFocus( true );
//DOFPostEffect.setFocusParams( 0.5, 0.5, 50, 500, -5, 5 );
//DOFPostEffect.enable();
}About the author
Recent Threads
#2
It looks like the string passed into setImageScriptAnimPrefix() needs to be a network string. This is a special string type that is converted into a number so it may be passed between the client and server with minimal bandwidth. Unfortunately, the docs for this method don't point this out.
Here is how it is used when the player changes poses:
To convert an ordinary string to a networked string just call addTaggedString() on it.
And if you're using the standard player scripts, the Armor::onPoseChange() method may be overriding your own image prefix as you can see in the code above.
I hope that helps.
- Dave
03/12/2013 (8:05 am)
@Grey9999:It looks like the string passed into setImageScriptAnimPrefix() needs to be a network string. This is a special string type that is converted into a number so it may be passed between the client and server with minimal bandwidth. Unfortunately, the docs for this method don't point this out.
Here is how it is used when the player changes poses:
function Armor::onPoseChange(%this, %obj, %oldPose, %newPose)
{
// Set the script anim prefix to be that of the current pose
%obj.setImageScriptAnimPrefix( $WeaponSlot, addTaggedString(%newPose) );
}To convert an ordinary string to a networked string just call addTaggedString() on it.
And if you're using the standard player scripts, the Armor::onPoseChange() method may be overriding your own image prefix as you can see in the code above.
I hope that helps.
- Dave
#3
How would I make sure that %obj is my player??
03/12/2013 (10:53 am)
Ok changed it to a tagged network string. Also commented out Armor::onPoseChange. Still no luck.How would I make sure that %obj is my player??
Torque Owner Adam Gardner
Infected Games
I could be wrong though