... the hell? (Script problem)
Posted: 11 Sep 2006, 23:23
I've got some weird problems (and we REALLY need that damn scripting forum since I have no idea if this goes in Help&Bugs or Mods or Art or General). My infantry is aiming completely incorrectly. Somehow they confuse heading and pitch and they don't turn around properly either (at least not at the proper angles). It worked without any changes to the aiming part before, though I don't know if that was before I installed build 2097. WTF is happening there? Why are they switching heading and pitch?


This is the script causing that:
For comparison, the tank script works properly despite using the parameters in the same way:


This is the script causing that:
Code: Select all
PoseAimUpper(heading,pitch)
{
signal SIG_AnimUpper;
turn chest to x-axis (0 - pitch / 2) speed <720>;
turn chest to y-axis (heading - <40>) speed <720>;
turn chest to z-axis 0 speed <720>;
turn head to x-axis (0 - pitch / 2) speed <720>;
turn head to y-axis <40> speed <720>;
turn head to z-axis 0 speed <720>;
turn rarm0 to x-axis (<-20> - pitch/2) speed <720>;
turn rarm0 to y-axis <40> speed <720>;
turn rarm1 to x-axis <-120> speed <720>;
turn rarm1 to z-axis 0 speed <720>;
turn rhand to x-axis <50> speed <720>;
turn larm0 to x-axis (<-80> - pitch/2) speed <720>;
turn larm0 to y-axis 0 speed <720>;
turn larm0 to z-axis 0 speed <720>;
turn larm1 to x-axis <-10> speed <720>;
turn larm1 to z-axis 0 speed <720>;
turn lhand to z-axis 0 speed <720>;
}
AimWeapon1(h,p)
{
signal SIG_Aim;
set-signal-mask SIG_Aim;
if (weapontype) return FALSE;
if (ammunition <= 0) {
show ammosymbol;
return FALSE;
}
oldreverse=reverse;
reverse=0;
if (h > <130> && h < <300>) {
h = h - <180>;
reverse = TRUE;
}
if(oldreverse!=reverse) {
if (moving) {
start-script AnimRun(reverse);
} else {
start-script AnimIdleLower();
}
}
start-script PoseAimUpper(h,p);
start-script ResetAim();
return TRUE;
}
Code: Select all
AimWeapon1(h,p)
{
signal SIG_Aim1;
set-signal-mask SIG_Aim1;
if (ammunition > 0)
{
mainheading = h;
turn turret to y-axis h speed <80>;
turn cannon to x-axis 0-p speed <60>;
wait-for-turn turret around y-axis;
wait-for-turn cannon around x-axis;
return TRUE;
}
else
{
show ammosymbol;
return FALSE;
}
}