AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   How to control fake client movement? (https://forums.alliedmods.net/showthread.php?t=263420)

Beaverboys 05-25-2015 02:34

How to control fake client movement?
 
I've created a bot using CreateFakeClient and I'm writing code inside of OnGameFrame to try to control it. The code is based largely on an AMXX plugin and I don't know what to replace EngFunc_RunPlayerMove with.
PHP Code:

public OnGameFrame() 
{
    static 
idbuttonsIsUserClosemsecFloat:floatvar[3], Float:targ_origin[3], Float:v_length;
    
global_get(glb_frametimev_length);
    
msec RoundFloat(v_length 1000.0);

    for (
id 1id <= IsBot[31]; id++)
        if (
PumpFake[id] > 0)
            
PumpFake[id] += 4;
        else if (
IsBot[id])
            if (
IsPlayerAlive(id))
            {
                
GetEntPropVector(idProp_Send"m_vecOrigin"floatvar);
                
targ_origin TargetOrigin[id], targ_origin[2] = floatvar[2];
                
IsUserClose = (GetVectorDistance(floatvartarg_origin) > 30.0) ? 1buttons 0;

                if (!
IsUserClose)
                {
                    
targ_origin[0] -= floatvar[0], targ_origin[1] -= floatvar[1], targ_origin[2] -= floatvar[2];
                    
v_length GetVectorLength(targ_origin);
                    
targ_origin[0] /= v_lengthtarg_origin[1] /= v_lengthtarg_origin[2] /= v_length;
                    
GetVectorAngles(targ_originfloatvar);
                    
floatvar[0] *= -1;
                    if (
floatvar[1] > 180.0floatvar[1] -= 360;
                    else if (
floatvar[1] < -180.0floatvar[1] += 360;
                    else if (
floatvar[1] == 180.0 || floatvar[1] == -180.0floatvar[1] = -179.999999;

                    
SetEntPropVector(idProp_Data"m_angEyeAngles"floatvar);
                    
floatvar[0] /= -3.0;
                    
SetEntPropVector(idProp_Data"m_vecAngles"floatvar);
                }
                else if (
Snapstat != || TeamWithBall == (GetClientTeam(id) - 1))
                    
buttons = (Snapstat == && (id == TCenter || id == CTCenter)) ? IN_DUCK IN_ATTACK;

                
engfunc(EngFunc_RunPlayerMoveidfloatvar, (!IsUserClose && Snapstat != && !(Kicking && !Snapstat) && GameActive) ? 400.0 0.00.00.0buttons0msec);
            }


I also need to figure out what to replace "global_get(glb_frametime, v_length)" with.

kadet.89 05-25-2015 03:35

Re: How to control fake client movement?
 
This may work with fake clients https://forums.alliedmods.net/showthread.php?t=132773

Beaverboys 05-25-2015 04:56

Re: How to control fake client movement?
 
Quote:

Originally Posted by kadet.89 (Post 2300717)

Could I just set the fake clients angles toward a particular entity and make them move forward?

kadet.89 05-25-2015 05:16

Re: How to control fake client movement?
 
You can use https://sm.alliedmods.net/new-api/sd...TeleportEntity but it will not look naturally. If you want a naturall result, then you should hook and override AI with c++ extension

Miu 05-25-2015 07:57

Re: How to control fake client movement?
 
I don't think you can set fake clients' angles, only proper bots

Beaverboys 05-25-2015 21:09

Re: How to control fake client movement?
 
I just need a bot to run toward a certain player and slash them, what would be the best way to do that?

Miu 05-25-2015 22:06

Re: How to control fake client movement?
 
I think you need to set the move and maybe angles vectors in onplayerruncmd, i think move should be the same as the vector youre setting in your code

Beaverboys 05-26-2015 02:28

Re: How to control fake client movement?
 
Quote:

Originally Posted by Miu (Post 2301085)
I think you need to set the move and maybe angles vectors in onplayerruncmd, i think move should be the same as the vector youre setting in your code

I'm not sure exactly how to do this, could you maybe provide some example code?

Michalplyoutube 05-26-2015 04:47

Re: How to control fake client movement?
 
if ure on tf2 use item_teamflag trick to make bot move to func_caputrezone

Benoist3012 05-26-2015 07:13

Re: How to control fake client movement?
 
Quote:

Originally Posted by Michalplyoutube (Post 2301130)
if ure on tf2 use item_teamflag trick to make bot move to func_caputrezone

Like said Michal, you can look my plugin MannVsTank I used this for force bot Giant to Capture a point.


All times are GMT -4. The time now is 07:54.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.