Author Topic: Playertype Help: Sprinting and Changing to a NoMovement/NoWeaponUsage Playertype  (Read 2789 times)

1. I don't immediately see what is wrong with that portion.
But there is an easy way to find out what code does not work.
Just add messages inside the code to see where it stops:
Code: [Select]
messageclient(%client,"",'Enter stage of code here for easy reference');You can even display variables.


2.You aren't calling the parent of the serverCmdUseTool and UnUseTool, that is why you can't use any tools.
It is bad to do it like this.
If you don't want them to use tools, don't give them any or add code to remove the tools. But don't overwrite the entire function.

You can also just compare the datablock names instead of adding variables in the datablock.
Code: [Select]
%player.getDatablock().getName() $= "PlayerStandardArmor"
« Last Edit: February 02, 2016, 12:08:54 PM by honytawk »

There's no point in doing %db = %obj.getDatablock(); because %this is the datablock.
Is all this even in a package?
You're not parenting serverCmdUseTool or serverCmdUnUseTool.
Instead of checking %client.isPlayerType == 1. Check if(%client.player.getDataBlock().getName() $= "MyDataBlock").
Instead of doing %client.player.setMaxForwardSpeed(8); do %client.player.setMaxForwardSpeed(%client.player.getDataBlock().maxForwardSpeed)
If you want them to not be able to move at all, you'll also need to change their backward speed, side speed, crouch forward speed, crouch side speed, crouch backward speed, and underwater speeds.
And if you want them to not be able to jump/crouch then you'll just need to change their datablock instead.

honytawk please make sure that the code you post is correct before you post it.

honytawk please make sure that the code you post is correct before you post it.
Yup sorry.
I modified the "==" to a "$="

Yup sorry.
I modified the "==" to a "$="
The second argument of messageClient should also be two apostrophes. Not two quotation marks.

So what is $= and how is it different from == ?

So what is $= and how is it different from == ?
$= compares two strings and == is for integers
you can't compare two strings using == which is weird but that's torquescript for you

$= is to compare strings

while == is to compare values



String comparison

%fruit1 = "apples";
%fruit2 = "bananas";


if(%fruit1 $= %fruit2)
     ..code..



Value comparison

%bl_id1 = 1;
%bl_id2 = 2;

if(%bl_id1 == %bl_id2)
     ..code..


The second argument of messageClient should also be two apostrophes. Not two quotation marks.
I thought you only had to do that if you wanted quotation marks in the string like most other languages I know.
And it does work.
Torque is weird :/
« Last Edit: February 02, 2016, 12:13:46 PM by honytawk »

Fixed the sprinting not working. I forgot to change the armor name back. :cookieMonster:
Is all this even in a package?
How do I make sure it is?
Quote
You're not parenting serverCmdUseTool or serverCmdUnUseTool.
How do I do this? Similar to the parent in onTrigger?
Quote
And if you want them to not be able to jump/crouch then you'll just need to change their datablock instead.
I'm thinking of just having these disabled altogether, what are the prefs in the playertype file for this?

How do I make sure it is?
It should be structured like this:

package packageName
{
     ..your code..
};


You can check out this too: http://tsforblockland.weebly.com/packages.html

what are the prefs in the playertype file for this?

You can do playerObject.dataBlock.dump(); and look through the Datablock fields.