Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
It doesn't work, maybe impossible?!
Amnesiaplayer Offline
Senior Member

Posts: 539
Threads: 105
Joined: Jun 2014
Reputation: 0
#12
RE: It doesn't work, maybe impossible?!

(05-10-2015, 07:45 PM)FlawlessHappiness Wrote: I believe you forgot to copy in the rest of the code.

PHP Code: (Select All)
void MoveEntityToEntity(string &in asEntity, string &in asDestEntity, float afSpace, float afFreq)
{
    if(
GetLocalVarInt("Moving"+asEntity) == 1)
    {
        
AddDebugMessage("Object already moving", false);
        return;
    }
    
Now I get a lot of Errors... Do I need to fill Everything in the script either?! :O
    SetLocalVarFloat
("MoveFreq_"+asEntity, afFreq);
    
    
SetLocalVarFloat("MoveSpace_"+asEntity, afSpace);
    
    
float afAmountX = GetEntityPosX(asDestEntity)-GetEntityPosX(asEntity);
    
SetLocalVarFloat("MoveAmountX_"+asEntity, MathSqrt(MathPow(afAmountX, 2)));
    
SetLocalVarFloat("MoveSpaceX_"+asEntity, afSpace);
    if(
afAmountX < 0)
    {
        
SetLocalVarFloat("MoveSpaceX_"+asEntity, -afSpace);
    }
    
    
float afAmountY = GetEntityPosY(asDestEntity)-GetEntityPosY(asEntity);
    
SetLocalVarFloat("MoveAmountY_"+asEntity, MathSqrt(MathPow(afAmountY, 2)));
    
SetLocalVarFloat("MoveSpaceY_"+asEntity, afSpace);
    if(
afAmountY < 0)
    {
        
SetLocalVarFloat("MoveSpaceY_"+asEntity, -afSpace);
    }
    
    
float afAmountZ = GetEntityPosZ(asDestEntity)-GetEntityPosZ(asEntity);
    
SetLocalVarFloat("MoveAmountZ_"+asEntity, MathSqrt(MathPow(afAmountZ, 2)));
    
SetLocalVarFloat("MoveSpaceZ_"+asEntity, afSpace);
    if(
afAmountZ < 0)
    {
        
SetLocalVarFloat("MoveSpaceZ_"+asEntity, -afSpace);
    }
    
    
AddTimer(asEntity, 0.0f, "MoveObjectTimer");
}

void MoveEntityOnAxis(string &in asEntity, float afAmountX, float afAmountY, float afAmountZ, float afSpace, float afFreq)
{
    if(
GetLocalVarInt("Moving"+asEntity) == 1)
    {
        
AddDebugMessage("Object already moving", false);
        return;
    }
    
    
SetLocalVarFloat("MoveFreq_"+asEntity, afFreq);
    
    
SetLocalVarFloat("MoveSpace_"+asEntity, afSpace);
    
    
SetLocalVarFloat("MoveAmountX_"+asEntity, MathSqrt(MathPow(afAmountX, 2)));
    
SetLocalVarFloat("MoveSpaceX_"+asEntity, afSpace);
    if(
afAmountX < 0)
    {
        
SetLocalVarFloat("MoveSpaceX_"+asEntity, -afSpace);
    }
    
    
SetLocalVarFloat("MoveAmountY_"+asEntity, MathSqrt(MathPow(afAmountY, 2)));
    
SetLocalVarFloat("MoveSpaceY_"+asEntity, afSpace);
    if(
afAmountY < 0)
    {
        
SetLocalVarFloat("MoveSpaceY_"+asEntity, -afSpace);
    }
    
    
SetLocalVarFloat("MoveAmountZ_"+asEntity, MathSqrt(MathPow(afAmountZ, 2)));
    
SetLocalVarFloat("MoveSpaceZ_"+asEntity, afSpace);
    if(
afAmountZ < 0)
    {
        
SetLocalVarFloat("MoveSpaceZ_"+asEntity, -afSpace);
    }
    
    
AddTimer(asEntity, 0.0f, "MoveObjectTimer");
}

void MoveObjectTimer(string &in asTimer)
{
    
SetLocalVarInt("Moving"+asTimer, 1);

    if(
GetLocalVarFloat("MoveAmountX_"+asTimer) != 0)
    {
        
SetEntityPos(asTimer, GetEntityPosX(asTimer)+GetLocalVarFloat("MoveSpaceX_"+asTimer), GetEntityPosY(asTimer), GetEntityPosZ(asTimer));
        
AddLocalVarFloat("MoveAmountX_"+asTimer, -GetLocalVarFloat("MoveSpace_"+asTimer));
        if(
GetLocalVarFloat("MoveAmountX_"+asTimer) < 0)
        {
            
SetLocalVarFloat("MoveAmountX_"+asTimer, 0);
        }
    }

    if(
GetLocalVarFloat("MoveAmountY_"+asTimer) != 0)
    {
        
SetEntityPos(asTimer, GetEntityPosX(asTimer), GetEntityPosY(asTimer)+GetLocalVarFloat("MoveSpaceY_"+asTimer), GetEntityPosZ(asTimer));
        
AddLocalVarFloat("MoveAmountY_"+asTimer, -GetLocalVarFloat("MoveSpace_"+asTimer));
        if(
GetLocalVarFloat("MoveAmountY_"+asTimer) < 0)
        {
            
SetLocalVarFloat("MoveAmountY_"+asTimer, 0);
        }
    }

    if(
GetLocalVarFloat("MoveAmountZ_"+asTimer) != 0)
    {
        
SetEntityPos(asTimer, GetEntityPosX(asTimer), GetEntityPosY(asTimer), GetEntityPosZ(asTimer)+GetLocalVarFloat("MoveSpaceZ_"+asTimer));
        
AddLocalVarFloat("MoveAmountZ_"+asTimer, -GetLocalVarFloat("MoveSpace_"+asTimer));
        if(
GetLocalVarFloat("MoveAmountZ_"+asTimer) < 0)
        {
            
SetLocalVarFloat("MoveAmountZ_"+asTimer, 0);
        }
    }
    
    if(
GetLocalVarFloat("MoveAmountX_"+asTimer) == 0 && GetLocalVarFloat("MoveAmountY_"+asTimer) == 0 && GetLocalVarFloat("MoveAmountZ_"+asTimer) == 0)
    {
        
SetLocalVarInt("Moving"+asTimer, 0);
        
OnArrival(asTimer);
        return;
    }

    
AddTimer(asTimer, GetLocalVarFloat("MoveFreq_"+asTimer), "MoveObjectTimer");
}

void OnArrival(string &in asEntity)
{
    
} 

This just has to be in your scriptfile somewhere

Oh, So I have to paste it into my script?! lol, K I paste it at the end Smile
(This post was last modified: 05-10-2015, 08:05 PM by Amnesiaplayer.)
05-10-2015, 08:03 PM
Find


Messages In This Thread
RE: It doesn't work, maybe impossible?! - by Amnesiaplayer - 05-10-2015, 08:03 PM



Users browsing this thread: 1 Guest(s)