Remaing in a crouch pose
by CIMO · in Technical Issues · 09/17/2006 (8:15 am) · 15 replies
Function crouch(%val)
{
if (%val)
commandToServer('playCel', crouch);
}
moveMap.bind(keyboard, "ctrl x", crouch);I put this in "default.bind.cs" and i try and function..But my player not remaing....
A metod for stay crouch my player?
Thanks...
#2
But i receiver a this error in consolle:
starter.fps/client/scripts/default.bind.cs (0): Unknown command setActionThread.
Object PlayerBody(71) PlayerBody -> armor -> PlayerData -> ShapeBaseData -> GameBaseData -> SimDataBlock -> SimObject
Any idea?
09/17/2006 (3:27 pm)
I use thisfunction crouch(%val)
{
if (%val)
PlayerBody.setActionThread(crouch);
}
moveMap.bind(keyboard, "ctrl x", crouch);But i receiver a this error in consolle:
starter.fps/client/scripts/default.bind.cs (0): Unknown command setActionThread.
Object PlayerBody(71) PlayerBody -> armor -> PlayerData -> ShapeBaseData -> GameBaseData -> SimDataBlock -> SimObject
Any idea?
#3
someone tell me why this wouldnt work.... :)
the best solution would be to modify the source code for what you want.
09/18/2006 (8:02 am)
Cimo youre calling setactionthread() function for the datablock, you should call it on the player ID. also, like Caleb said, this would only make the character crouch until you move. once you move, the player will go back to the run animation. if you create an animation for moving while crouched, you may be able to override this default behavior by specifying a lower priority number for the crouch-move animation when you export it. other than that, without engine changes, your best bet is to either modify the players datablock directly or use multiple datablocks. if you're making a multiplayer game, you might be better off using multiple datablocks. someone tell me why this wouldnt work.... :)
the best solution would be to modify the source code for what you want.
#4
I would stay a my player in a crouch pose when i press a key...
And return in a stand pose when i re-press a key...
THANKS...
09/18/2006 (8:08 am)
But you take me a example?....I would stay a my player in a crouch pose when i press a key...
And return in a stand pose when i re-press a key...
THANKS...
#6
Unknown command setPlayerPosition.
Object (1924) Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject"
09/18/2006 (8:48 am)
But i have this problem in consolle:Unknown command setPlayerPosition.
Object (1924) Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject"
#7
Unknown command setPlayerPosition.
Object (1924) Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject"
09/18/2006 (9:37 am)
But i have this problem in consolle:Unknown command setPlayerPosition.
Object (1924) Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject"
#8
This just means that the program can't find the subroutine setPlayerPosition. If you added it like they show in the resource then it should be there - it could something as small as a typo. eg estPlayerPosition
Look for the declaration:
void Player::setPlayerPosition(S32 position)
in player.cc. Note that this player.cc not .cs.
Also make sure your call has the right number of arguments - ie setPlayerPosition(1); because C++ sees this differently than setPlayerPosition(); or setPlayerPosition(1,2);.
Also check your .h file to make sure you declared it because this can effect the subroutines visibility. Some environments will treat this as warning and some as an error.
Hope that helps,
=Tod
09/18/2006 (12:42 pm)
@CimoThis just means that the program can't find the subroutine setPlayerPosition. If you added it like they show in the resource then it should be there - it could something as small as a typo. eg estPlayerPosition
Look for the declaration:
void Player::setPlayerPosition(S32 position)
in player.cc. Note that this player.cc not .cs.
Also make sure your call has the right number of arguments - ie setPlayerPosition(1); because C++ sees this differently than setPlayerPosition(); or setPlayerPosition(1,2);.
Also check your .h file to make sure you declared it because this can effect the subroutines visibility. Some environments will treat this as warning and some as an error.
Hope that helps,
=Tod
#9
and i this problem in consolle:
starter.fps/server/scripts/commands.cs (151): Unknown command setPlayerPosition.
Object (1633) Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject
in default.bind.cs have this:
I don't say the problem =( help
09/18/2006 (3:05 pm)
Mmm i reinstall the resource...and i this problem in consolle:
starter.fps/server/scripts/commands.cs (151): Unknown command setPlayerPosition.
Object (1633) Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject
in default.bind.cs have this:
function changePlayerPosition(%val)
{
if (%val)
// calling it with a 0 will bump us up to the next position
CommandtoServer('SetPlayerPos', 0);
}
moveMap.bind( keyboard, "ctrl x", changePlayerPosition );I don't say the problem =( help
#10
Look for the declaration:
void Player::setPlayerPosition(S32 position)
in player.cc. Note that this player.cc not .cs.
as prescribed by the resource? The console error is telling you it can't find "setPlayerPosition" which means you are calling it - but it's not going anywhere. That means the above code is not the current problem.
If this were a private forum I would ask you print the declaration of the subroutine and first couple lines - but since it is not don't post them but do check you player.h and player.cc implementation of setPlayerPosition.
=Tod
09/18/2006 (3:25 pm)
Did make the changes to player.cc?Look for the declaration:
void Player::setPlayerPosition(S32 position)
in player.cc. Note that this player.cc not .cs.
as prescribed by the resource? The console error is telling you it can't find "setPlayerPosition" which means you are calling it - but it's not going anywhere. That means the above code is not the current problem.
If this were a private forum I would ask you print the declaration of the subroutine and first couple lines - but since it is not don't post them but do check you player.h and player.cc implementation of setPlayerPosition.
=Tod
#11
But this not is a private section?
For resolve a my problem i post in? sorry but i noob sorry for my ignorance
09/18/2006 (3:36 pm)
I don't say to change a "void Player::setPlayerPosition(S32 position)"But this not is a private section?
For resolve a my problem i post in? sorry but i noob sorry for my ignorance
#12
Your script call
If you're using the resource Scott Burns posted a link to then you need to implement all of the changes not just the scripting changes. He makes extensive changes to the underlying C++ code to make his solution work. I don't know if you can do what you want to do with scripting only but I know you can't do it the resource way without changing the C++.
I hope this helps,
=Tod
09/18/2006 (4:43 pm)
No, is not the private section so do not post any C++ code here.Your script call
function changePlayerPosition(%val)
{
if (%val)
// calling it with a 0 will bump us up to the next position
CommandtoServer('SetPlayerPos', 0);
}
moveMap.bind( keyboard, "ctrl x", changePlayerPosition );is calling a subroutine that does not exist - you have to create this subroutine and recompile the code to make the above call work. This is what it is trying to tell you in the console error:starter.fps/server/scripts/commands.cs (151): Unknown command setPlayerPosition.Nothing will fix this error in the script call except creating the setPlayerPosition subroutine to match your call.
If you're using the resource Scott Burns posted a link to then you need to implement all of the changes not just the scripting changes. He makes extensive changes to the underlying C++ code to make his solution work. I don't know if you can do what you want to do with scripting only but I know you can't do it the resource way without changing the C++.
I hope this helps,
=Tod
#13
thanks very thanks
09/18/2006 (5:30 pm)
I you say the private section to me where to mail in order to resolve the problem? I do not succeed to understand what I must modify in order to make to work this resourcethanks very thanks
#14
He is very clear about what needs to be modified and what file it is in. Review it - everything in bold is new code added. You know which subroutine you are missing search for it in the resource and find the code you are missing. There are a lot of code modifications that need to happen but they are clearly spelled out. You will need to make those changes and recompile to make that new code available.
You might do better to slow down a look and see how problems are solved. It is obvious from the console error what was wrong if you learn to read console messages. This should have told you where to look in the resource to find what was wrong. These kinds of these crop up all the time when you code - learning how to fix them is part of learning how TGE works. If you learn to do this for yourself instead of depending on others you will get farther much faster in the long run.
Good luck,
=Tod
09/18/2006 (6:28 pm)
I recommend you look at this resource again carefully.He is very clear about what needs to be modified and what file it is in. Review it - everything in bold is new code added. You know which subroutine you are missing search for it in the resource and find the code you are missing. There are a lot of code modifications that need to happen but they are clearly spelled out. You will need to make those changes and recompile to make that new code available.
You might do better to slow down a look and see how problems are solved. It is obvious from the console error what was wrong if you learn to read console messages. This should have told you where to look in the resource to find what was wrong. These kinds of these crop up all the time when you code - learning how to fix them is part of learning how TGE works. If you learn to do this for yourself instead of depending on others you will get farther much faster in the long run.
Good luck,
=Tod
#15
The problem was in player.h in public section ;)
thanks =D
09/19/2006 (7:37 am)
I resolve =D thanks for all =DThe problem was in player.h in public section ;)
thanks =D
Torque Owner Caleb
Default Studio Name
If you just want to be crouched when holding a certain key, you could try animating a cyclic animation of your character crouched, then do something like this.
while (ctrl x is down)
{
yourPlayerName.setActionThread(yourCrouchAnim); //or whatever works
}
Then your character will stay crouched until you let go of your key, (or you move).
Now I'm not sure if this will work since I've never tried it, and even if it does this is not the best way of doing this.
I have seen tutorials on crouching before, so try using google.
O ya, what is (%val) for, its proably not hurting anything but its not going to help either.
Good Luck!
P.S. - I'm gona need to know how to do this some time, so post info if you figure this out.