Raised This Month: $51 Target: $400
 12% 

Solved [CS:GO]How to make chicken follow player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 06-30-2018 , 05:17   [CS:GO]How to make chicken follow player
Reply With Quote #1

How to make chicken follow player?
If you press E on chicken it start to follow you, but how to make it with code
And it is important to make it follow another player for example after 30 seconds

Last edited by Indarello; 07-05-2018 at 08:43.
Indarello is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 06-30-2018 , 08:37   Re: [CS:GO]How to make chicken follow player
Reply With Quote #2

Try:

SetEntPropEnt(chickenEntity, Prop_Send, "m_leader", client);

Try Prop_Data if you get error that m_leader doesn't exist.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 06-30-2018 , 10:35   Re: [CS:GO]How to make chicken follow player
Reply With Quote #3

Dont work
Indarello is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 06-30-2018 , 11:10   Re: [CS:GO]How to make chicken follow player
Reply With Quote #4

Quote:
Originally Posted by Indarello View Post
Dont work
Same thing with m_hOwnerEntity instead of m_leader. Remember to swap Send and Data if one is an error.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 07-01-2018 , 03:51   Re: [CS:GO]How to make chicken follow player
Reply With Quote #5

Ownerentity propdata is not integer, propsend dont work, I will try create entity and make it follow nav mesh
Indarello is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-02-2018 , 11:13   Re: [CS:GO]How to make chicken follow player
Reply With Quote #6

Quote:
Originally Posted by Indarello View Post
Ownerentity propdata is not integer, propsend dont work, I will try create entity and make it follow nav mesh
Isn't Ownerentity an entity?...
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 07-02-2018 , 12:27   Re: [CS:GO]How to make chicken follow player
Reply With Quote #7

Quote:
Originally Posted by eyal282 View Post
Isn't Ownerentity an entity?...
Sorry dont understand you
Indarello is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 07-02-2018 , 15:59   Re: [CS:GO]How to make chicken follow player
Reply With Quote #8

Here it's working fine with m_leader,
my test case:
PHP Code:
public void OnPluginStart()
{
    
RegConsoleCmd("sm_follow"Cmd_Follow);
    
RegConsoleCmd("sm_stopfollow"Cmd_UnFollow);
}

public 
Action Cmd_Follow(int clientint args)
{
    
int target GetClientAimTarget(clientfalse);
    if (
target == -1)
    {
        
ReplyToCommand(client"Ent not found");
        return 
Plugin_Handled;
    }
    
SetEntPropEnt(targetProp_Send"m_leader"client);
    return 
Plugin_Handled;
}

public 
Action Cmd_UnFollow(int clientint args)
{
    
int target GetClientAimTarget(clientfalse);
    if (
target == -1)
    {
        
ReplyToCommand(client"Ent not found");
        return 
Plugin_Handled;
    }
    
SetEntPropEnt(targetProp_Send"m_leader", -1);
    return 
Plugin_Handled;

__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 07-03-2018 , 00:12   Re: [CS:GO]How to make chicken follow player
Reply With Quote #9

Sorry, i made mistake with entityindex when i was testing leader before
Somebody know how to make chicken faster?
I tried:
SetEntPropFloat(chicken, Prop_Data, "m_flGroundSpeed", 2.0);
SetEntPropFloat(chicken, Prop_Data, "m_flSpeed", 2.0);

Last edited by Indarello; 07-03-2018 at 00:45.
Indarello is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 07-05-2018 , 08:39   Re: [CS:GO]How to make chicken follow player
Reply With Quote #10

Code:
public OnPluginStart ()
{
	RegAdminCmd("sm_spawnpet", ClientExec3, ADMFLAG_RCON);
}

public OnMapStart()
{
	PrecacheModel("models/chicken/chicken.mdl", true);
	CreateTimer(0.1, Timer_PetGo, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
	//less timer better chicken follow accuracy but can make more load on cpu?
}

public Action:ClientExec3 (client, args)
{
	decl Float:pos[3];
	GetClientAbsOrigin(client, pos);
	if(!(pet[client] = CreateEntityByName("chicken")))
		return;
	
	SetEntityModel(pet[client], "models/chicken/chicken.mdl");
	DispatchSpawn(pet[client]);
	//SetEntityMoveType(pet[client], MOVETYPE_NOCLIP);
	TeleportEntity(pet[client], pos, NULL_VECTOR, NULL_VECTOR);
	SetEntPropEnt(pet[client], Prop_Send, "m_leader", client);
}

public Action:Timer_PetGo(Handle:Timer, any:data)
{
	for (new client=1;client<=MaxClients;client++)
	{
		if(pet[client] > 0)
		{
			
			decl Float:ang[3], Float:speed2[3];
			GetEntPropVector(pet[client], Prop_Data, "m_angRotation", ang);
			GetAngleVectors(ang, speed2, NULL_VECTOR, NULL_VECTOR);
			ScaleVector(speed2, 150.0); //speedboost
			TeleportEntity(pet[client], NULL_VECTOR, NULL_VECTOR, speed2);
		}	
	}	
}
this is example of alpha version of plugin, if somebody will use it, i recommend:
1)make more health for pet or maybe if it dont work - create another solid prop with some health and 0 alpha which will protect it from fast death
2)change speedboost from distance to chicken owner

Last edited by Indarello; 07-05-2018 at 08:43.
Indarello is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:34.


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