(08-21-2015, 06:18 PM)Daemian Wrote: where's Distance declared?
Debug it all, check each value. I'd start with this: (Speed >= 0.25f && GetPropIsInteractedWith(asParent))
Try without those conditions. If it works, try using the conditions separated, like:boolean a = (Speed >= 0.5f);
boolean b = (GetPropIsInteractedWith(asParent));
if ( a && b ) { playmusic... }
Nope, did not work. The same thing happens. I might as well send the entire script of how it looks like atm.
float Distance = 0.015f;
void Impact1(string &in asParent , string &in asChild , int alState)
{
AddTimer("ImpactTime" , 1.0f , "HitTime"); // This doesnt need to call anything
}
void Impact2(string &in asParent, string &in asChild, int alState)
{
float Time = (1.05f - GetTimerTimeLeft("ImpactTime")); // Get's the time taken to impact
float Speed = (Distance / Time); // Gets the speed
bool a = (Speed >= 0.25f);
bool b = (GetPropIsInteractedWith(asParent));
if(a && b) // Minimum necessary speed (don't want this to happen if the rock is hold)
{
PlayMusic("17_paper_herbert01.ogg", false, 0.7f, 0, 10, false);
CompleteQuest("MainVaultDoorsClosed", "MainVaultDoorsClosed");
SetEntityActive("shovel_joint_1", false); //Prepare new shovel
SetEntityActive("shovel_joint_2", true);
ShovelImpulse();
SetMoveObjectStateExt("slide_doo_thick_1", -0.5f, 1.0f, 1.0f, 0.0f, true);
SetMoveObjectStateExt("slide_doo_thick_2", 0.5f, 1.0f, 1.0f, 0.0f, true);
SetEntityActive("AreaRockOnShovel", false);
SetEntityActive("AreaRockOnShovel_1", false);
SetEntityActive("AreaRockTooFarIn", false);
SetEntityActive("AreaLeftSide", false);
SetEntityActive("AreaRightSide", false);
SetEntityActive("AreaInteractDoors", false);
}
else
{
SetMessage("Ch04Level21", "ThrownHarder", 0);
AddDebugMessage("Stone too lazy thrown or interacted!", false);
}
}
I think I'm able to change the script so you have to check where the player is located so you cannot stand infront of the shovel and throw it. But I'd rather wanna know if this function is impossible to use or not.
Derp.