Player Recoil mystery
by John Burch · in Torque Game Engine · 06/29/2004 (12:52 am) · 2 replies
Hi,
I'm confused about how a script change at the server get implemented at the client.
I added recoil with F7 on/off to my game and it works for me, but no one else. I log in to my dedicted server and I have recoil available, but no one else does. I copied all my files to the dedicated server and still it does not work.
If I remember correctly, I can log into game A and see recoil and log into game B and not have recoil. How come my server doesn't provide recoil to everyone?
It appears I may have to make all players download a set of files to upgrade their system. but that is crazy since I can use recoil on other systems without doing that.
Here are the changes i made to my server which gave me F7 controlled recoil:
Thanks,
john
This will add Player recoil to your crossbow.
and turn it on/off with F7
I found that my key function sent two commands. One at key down and the other at key up. Unexpected, since the other key functions did not have to deal with that.
***************************
Add to rw\server\scripts\commands.cs
function serverCmdtoggleRecoil(%client)
{
// this handles the two commands ,
%client.player.recoilState += 1;
if( %client.player.recoilState > 3)
%client.player.recoilState = 0;
}
****************************
Add to rw\server\scripts\weapons\crossbow.cs
in function CrossbowImage::onFire(%this, %obj, %slot)
right after MissionCleanup.add(%p);
add:
if( %obj.client.player.recoilState != 0)
{
%obj.applyimpulse(%obj.getworldboxcenter(),vectorscale(%obj.getMuzzlevector(%slot),-10 *90));
}
******************************
Not sure this is needed.
In
rw\data\shapes\player\orc\player_info.cs
add:
%recoilState = 1;
*******************************
In rw\client\scripts\default.bind.cs
add:
function toggleRecoil()
{
commandToServer('toggleRecoil');
}
moveMap.bind(keyboard, "F7", toggleRecoil );
*********************************
in rw\client\scripts\optionsDlg.cs
add the following at the bottom of the list about line 263
$RemapName[$RemapCount] = "Toggle Recoil";
$RemapCmd[$RemapCount] = "toggleRecoil";
$RemapCount++;
I'm confused about how a script change at the server get implemented at the client.
I added recoil with F7 on/off to my game and it works for me, but no one else. I log in to my dedicted server and I have recoil available, but no one else does. I copied all my files to the dedicated server and still it does not work.
If I remember correctly, I can log into game A and see recoil and log into game B and not have recoil. How come my server doesn't provide recoil to everyone?
It appears I may have to make all players download a set of files to upgrade their system. but that is crazy since I can use recoil on other systems without doing that.
Here are the changes i made to my server which gave me F7 controlled recoil:
Thanks,
john
This will add Player recoil to your crossbow.
and turn it on/off with F7
I found that my key function sent two commands. One at key down and the other at key up. Unexpected, since the other key functions did not have to deal with that.
***************************
Add to rw\server\scripts\commands.cs
function serverCmdtoggleRecoil(%client)
{
// this handles the two commands ,
%client.player.recoilState += 1;
if( %client.player.recoilState > 3)
%client.player.recoilState = 0;
}
****************************
Add to rw\server\scripts\weapons\crossbow.cs
in function CrossbowImage::onFire(%this, %obj, %slot)
right after MissionCleanup.add(%p);
add:
if( %obj.client.player.recoilState != 0)
{
%obj.applyimpulse(%obj.getworldboxcenter(),vectorscale(%obj.getMuzzlevector(%slot),-10 *90));
}
******************************
Not sure this is needed.
In
rw\data\shapes\player\orc\player_info.cs
add:
%recoilState = 1;
*******************************
In rw\client\scripts\default.bind.cs
add:
function toggleRecoil()
{
commandToServer('toggleRecoil');
}
moveMap.bind(keyboard, "F7", toggleRecoil );
*********************************
in rw\client\scripts\optionsDlg.cs
add the following at the bottom of the list about line 263
$RemapName[$RemapCount] = "Toggle Recoil";
$RemapCmd[$RemapCount] = "toggleRecoil";
$RemapCount++;
About the author
#2
06/29/2004 (5:41 am)
You many be right. I don't have documentation to explain such fine details unless you figure out the SDK code. Just kept changing things till it worked. The inital value is not being specified correctly so I guess the player_info stuff is not correct. John
Torque Owner Gonzo T. Clown
maybe you should try
%player.recoilState = 1;
Since I'm not looking at your exact code, I'm going to take a guess here, but aren't the %obj and %obj.client.player the exact same thing? Meaning...
if( %obj.recoilState != 0 )
would be the same thing with less hassle?