More Melee Help
by Ken Johnston · in Torque 3D Professional · 08/26/2009 (1:50 am) · 70 replies
has anyone succeeded in porting melee into T3D? I have been attempting to port server side melee into beta 5, i have everything apparently working all the engine changes compile without errors and am no longer getting any errors in the scripts, but when the sword is mounted to the player and i attempt to fire i get the error in setarmplayonce() in the console which is being triggered from this code in weapon.cs
I do not understand why it is triggering the echo. All animation dsqs have been added to the animation folder and executed in the player datablock. anyone have any ideas?
switch$($action)
{
//case "JumpAttack":
//%attack = %this.jumpAttack;
case "Normal":
// for now we randomly choose an attack
%index = mFloor(getRandom()*(%this.hthNumAttacks-0.0001));
if (%index > (%this.hthNumAttacks-1))
%index = (%this.hthNumAttacks-1);
%attack = %this.hthAttack[%index];
}
// setup the "play once look anim"
%obj.hthDamageAttack = %attack;
%obj.hthDamageSeqPlaying = 1;
%obj.hthDamageStartMS = $sim::Time;
%obj.hthDamageLastId = -1;
if (!%obj.setArmPlayOnce(%attack.seqName))
echo("ERROR in setArmPlayOnce()");
return;
}I do not understand why it is triggering the echo. All animation dsqs have been added to the animation folder and executed in the player datablock. anyone have any ideas?
#3
really be:
Print to the console what your index is, I have a feeling it's not what you are expecting.
08/26/2009 (11:08 am)
Just a shot in the dark here but shouldn't%index = mFloor(getRandom()*(%this.hthNumAttacks-0.0001));
really be:
%index = getRandom(%this.hthNumAttacks-1);
Print to the console what your index is, I have a feeling it's not what you are expecting.
#4
08/26/2009 (12:20 pm)
Ryan you may be correct there, but unfortunately at the moment the code is returning the echo "ERROR in setArmPlayOnce()" and not executing that code block...I am starting to think i may have screwed something up in the engine modifications i made. At the moment the sword can be placed into the game world as a weapon and mounted to the player as a weapon but will not play the arm animations or the root animation for when the sword is mounted the code that is posted should only be for choosing which attack animation to be played when the fire button is pressed
#5
08/26/2009 (12:58 pm)
Out of curiousity what model are you trying to load the animations onto? If its Gideon it won't work as he is, since someone made him with a custom bone setup. Boombot or Forgesoldier would work since they use the biped that follow along the stock torque setup.
#6
08/26/2009 (1:01 pm)
i am using the forge soldier, i came to the same conclusion with gideon, looking around the forums this seems to be a common error in the other versions of torque when it was implemented, and the animations play fine on the player model in the shape editor, so for some reason they are not being called. I think i am narrowing down the problem to something with the function calling the look animation. I think there is some conflict between the stock look animation and the custom one i am trying to add.
#8
08/26/2009 (1:33 pm)
Put a breakpoint in the C++ code where it is returning the error, and see why.
#9
Run this and then look at your console output, I have a feeling that you are not getting what you expect for the sequence. Also I am not sure where you are putting this so I am not sure if the $action should be %action.
08/26/2009 (6:31 pm)
Kenneth try switch your switch statement above with this one:Warn("Melee action is:" SPC $action); //Why is this a global variable?
switch$($action)
{
//case "JumpAttack":
//%attack = %this.jumpAttack;
case "Normal":
// for now we randomly choose an attack
%index = getRandom(%this.hthNumAttacks-1);
Warn("random attack index is:" SPC %index);
if (%index > (%this.hthNumAttacks-1))
%index = (%this.hthNumAttacks-1);
%attack = %this.hthAttack[%index];
}
// setup the "play once look anim"
%obj.hthDamageAttack = %attack;
%obj.hthDamageSeqPlaying = 1;
%obj.hthDamageStartMS = $sim::Time;
%obj.hthDamageLastId = -1;
Warn("Attack Sequence Name is:" SPC %attack.seqName);
if (!%obj.setArmPlayOnce(%attack.seqName))
echo("ERROR in setArmPlayOnce()");
return;
}Run this and then look at your console output, I have a feeling that you are not getting what you expect for the sequence. Also I am not sure where you are putting this so I am not sure if the $action should be %action.
#10
@Jaimi, there is not a specific error that is occuring per sey but i am not recieving the results i am expecting. The code i have is returning this statement in the console.
when i should be returning this code
unless I am not understanding were the code is telling the engine which look animation and attack animation to play when the weapon is mounted it should work and yet it does not...If anyone is interested i can post all my engine changes and scripts and maybe someone else can figure out what i cannot.
08/28/2009 (12:09 am)
@Ryan, I tried the code you indicated and i still recieve the "Error in setArmPlayOnce()" in the console, @Jaimi, there is not a specific error that is occuring per sey but i am not recieving the results i am expecting. The code i have is returning this statement in the console.
if (!%obj.setArmPlayOnce(%attack.seqName))
echo("ERROR in setArmPlayOnce()"); when i should be returning this code
switch$($action)
{
//case "JumpAttack":
//%attack = %this.jumpAttack;
case "Normal":
// for now we randomly choose an attack
%index = mFloor(getRandom()*(%this.hthNumAttacks-0.0001));
if (%index > (%this.hthNumAttacks-1))
%index = (%this.hthNumAttacks-1);
%attack = %this.hthAttack[%index];
}
// setup the "play once look anim"
%obj.hthDamageAttack = %attack;
%obj.hthDamageSeqPlaying = 1;
%obj.hthDamageStartMS = $sim::Time;
%obj.hthDamageLastId = -1;unless I am not understanding were the code is telling the engine which look animation and attack animation to play when the weapon is mounted it should work and yet it does not...If anyone is interested i can post all my engine changes and scripts and maybe someone else can figure out what i cannot.
#11
08/28/2009 (1:10 am)
@Kenneth - I've seen this before, it happened because the animation was not found. What I am suggesting is to walk through the C++ code, and see why the function is not returning what you think it should. My guess is that %attack.seqName is not found, though it's possible some change you did is causing it. But you will know what causes it if you put a breakpoint there, and walk through the c++ code.
#13
08/28/2009 (1:50 am)
Kenneth, what was in the console? The code I posted would print out the name of the selected attack sequence. Jaimi and I are pointing basically in the same direction, just with 2 different methods. If the sequence that is outputted to the console does not exist then you are going to get an error.
#14
08/28/2009 (2:31 am)
it was not printing out any sequence, it gave the same result as the previous code which printed out the error in setarmthread...i relize that the code i have is not finding the animations, im just not sure why yet and being a complete novice at C++ i am struggling with finding were the animations should even be called from in the C++ files
#15
08/28/2009 (2:54 am)
Which melee resource are you using? Also can you post for me the console output from "Melee action is:" to the error? I am curious what the output is.
#16
datablock GameBaseData(OneHandedAttackSwing)
{
seqName = "h1swing";
timeScale = 1.5;
damageAmount = 30;
//startDamage = 0.2;
//endDamage = 0.6;
startDamage = 0.2;
endDamage = 1.3;
};
etc?
and in the sword/weapon image
// Here are the Attacks we support
hthNumAttacks = 3;
hthAttack[0] = OneHandedAttackSwing;
hthAttack[1] = OneHandedAttackSlice;
hthAttack[2] = OneHandedAttackThrust;
08/28/2009 (11:15 am)
Have you declared the various datablocks needed?datablock GameBaseData(OneHandedAttackSwing)
{
seqName = "h1swing";
timeScale = 1.5;
damageAmount = 30;
//startDamage = 0.2;
//endDamage = 0.6;
startDamage = 0.2;
endDamage = 1.3;
};
etc?
and in the sword/weapon image
// Here are the Attacks we support
hthNumAttacks = 3;
hthAttack[0] = OneHandedAttackSwing;
hthAttack[1] = OneHandedAttackSlice;
hthAttack[2] = OneHandedAttackThrust;
#17
@Aleksander, i am 99% certain that the datablock you are indicating has been added, but i will double check it. Thanks.
08/28/2009 (12:14 pm)
@Ryan, i will post the console out put for you when i get home in a few hours, and i have been using the server side melee port for TGEA 1.8.1 located here www.garagegames.com/community/forums/viewthread/76217@Aleksander, i am 99% certain that the datablock you are indicating has been added, but i will double check it. Thanks.
#18
08/28/2009 (9:55 pm)
ryan here is the console output. as you can see the animations are not being selected....Mapping string: MsgItemPickup to index: 13 Mapping string: You picked up %1 to index: 14 onServerMessage: +- a: You picked up a sword Mapping string: use to index: 3 scripts/server/inventory.cs (134): Unable to find object: 'Blaster' attempting to call function 'getName' Mapping string: MsgWeaponUsed to index: 15 Mapping string: Weapon selected to index: 16 onServerMessage: +- a: Weapon selected Melee action is: Attack Sequence Name is: ERROR in setArmPlayOnce()
#19
08/28/2009 (10:46 pm)
Ok, this confirms what I was suspecting. Your $action is not populating with a value, therefore it doesn't make it into the case "Normal" statement to set the animation sequence. So now you just need to track down how this variable is supposed to be set.
#20
08/28/2009 (11:26 pm)
ok so based on what you said with the $action i was able to trace down one typo and now i am getting a animation to assign yet it is not playing, here is the console output now..ERROR in setArmPlayOnce() Melee action is: random attack index is: 2 Attack Sequence Name is: h1thrust ERROR in setArmPlayOnce() Melee action is: random attack index is: 1 Attack Sequence Name is: h1slice ERROR in setArmPlayOnce() Window focus status changed: focus: 0 Using background sleep time: 200 DirectInput deactivate
Torque Owner Ken Johnston
Indiestructable Systems