Raised This Month: $ Target: $400
 0% 

I cannot get this to work. I must be missing something. (AI speed control)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CryForMe
Junior Member
Join Date: Sep 2014
Old 12-18-2014 , 22:37   I cannot get this to work. I must be missing something. (AI speed control)
Reply With Quote #1

I've tried to get this to work, in numerous ways. I just can't determine what I'm missing. It compiles just fine, no errors. But it just doesn't work. All I want this to do is control the speed of the AI zombies. (I'm looking to speed them up.)

Here's what I've done.
PHP Code:
/*
* SourceMod Script
*/

#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "1.0"

new Handle:g_Cvar_zSpeed

public Plugin:myinfo 
{
    
name "zSpeed",
    
author "CryForMe",
    
description "Speeds Up Zombies",
    
version PLUGIN_VERSION,
    
url "http://www.contagiondeathsquad.clanservers.com/"
};


public 
OnPluginStart()
{
    
CreateConVar("sm_zSpeed_version"PLUGIN_VERSION"zSpeed Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY)
    
g_Cvar_zSpeed    CreateConVar("sm_zSpeed""3.0"" Sets the zombies speed "FCVAR_PLUGIN)
   
    
AutoExecConfig();   
}


public 
OnEntityCreated(ent, const String:classname[])
{
    if(
StrEqual(classname"zombie"false)) {
        
SetEntPropFloat(entProp_Data"m_flLaggedMovementValue"GetConVarFloat(g_Cvar_zSpeed))
    }

.
Game is Contagion.
..
CryForMe is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 12-19-2014 , 03:07   Re: I cannot get this to work. I must be missing something. (AI speed control)
Reply With Quote #2

I believe you need to update this value on every server frame.

Try this OnGameFrame I think it is.
__________________
Neuro Toxin is offline
CryForMe
Junior Member
Join Date: Sep 2014
Old 12-19-2014 , 03:40   Re: I cannot get this to work. I must be missing something. (AI speed control)
Reply With Quote #3

Quote:
Originally Posted by Neuro Toxin View Post
I believe you need to update this value on every server frame.

Try this OnGameFrame I think it is.
Thanks, Neuro! But where do I try it?
CryForMe is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 12-19-2014 , 06:37   Re: I cannot get this to work. I must be missing something. (AI speed control)
Reply With Quote #4

No he just can't do it on the same frame as the entitys is reaced, you have to delay this, and you don't have to repeat it...
__________________

Last edited by zipcore; 12-19-2014 at 06:37.
zipcore is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 12-19-2014 , 18:40   Re: I cannot get this to work. I must be missing something. (AI speed control)
Reply With Quote #5

Quote:
Originally Posted by zipcore View Post
No he just can't do it on the same frame as the entitys is reaced, you have to delay this, and you don't have to repeat it...

On entity created -> hook on entity spawned as post hook
On entity spawned -> set net prop as your already doing
__________________
Neuro Toxin is offline
CryForMe
Junior Member
Join Date: Sep 2014
Old 12-20-2014 , 20:11   Re: I cannot get this to work. I must be missing something. (AI speed control)
Reply With Quote #6

I've tried variations of all of this, still nothing seems to work. This is very frustrating, but perhaps I'm misunderstanding how movement is controlled for Contagion's zombies.

Last edited by CryForMe; 12-20-2014 at 20:14.
CryForMe is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 12-21-2014 , 00:08   Re: I cannot get this to work. I must be missing something. (AI speed control)
Reply With Quote #7

I have some code somewhere for this. Let me try dig it up for you.
__________________
Neuro Toxin is offline
CryForMe
Junior Member
Join Date: Sep 2014
Old 12-21-2014 , 02:40   Re: I cannot get this to work. I must be missing something. (AI speed control)
Reply With Quote #8

Quote:
Originally Posted by Neuro Toxin View Post
I have some code somewhere for this. Let me try dig it up for you.
Man, that would be great, thanks.
CryForMe is offline
CryForMe
Junior Member
Join Date: Sep 2014
Old 12-21-2014 , 12:47   Re: I cannot get this to work. I must be missing something. (AI speed control)
Reply With Quote #9

Here's the latest for reference. I think my brain is tricking me into thinking its actually making a slight difference when I test it. Haha! It still doesn't work though.

PHP Code:
/*
* SourceMod Script
*/

#include <sourcemod>

#define PLUGIN_VERSION "1.0"

new Handle:g_hEnabled;
new 
Handle:g_Cvar_zSpeed

public Plugin:myinfo 
{
    
name "zSpeed",
    
author "CryForMe",
    
description "Speeds Up Zombies",
    
version PLUGIN_VERSION,
    
url "http://www.contagiondeathsquad.clanservers.com/"
};


public 
OnPluginStart()
{
    
CreateConVar("sm_zSpeed_version"PLUGIN_VERSION"zSpeed Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY)
    
g_hEnabled  CreateConVar("sm_zSpeed_enabled""0""Enable/disable plugin"FCVAR_PLUGIN);
    
g_Cvar_zSpeed   CreateConVar("sm_zSpeed""1.0""Sets the zombies speed"FCVAR_PLUGIN)
    
    
AutoExecConfig();
}

public 
Action:OnEntityCreated(ent, const String:classname[], bool:dontBroadcast)
{
    if (
GetConVarBool(g_hEnabled)) {
        if(
StrEqual(classname"npc_zombie"false)) {
            
SetEntPropFloat(entProp_Data"m_flLaggedMovementValue"GetConVarFloat(g_Cvar_zSpeed))
        }
    }
    return 
Plugin_Continue;

CryForMe is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 12-21-2014 , 14:07   Re: I cannot get this to work. I must be missing something. (AI speed control)
Reply With Quote #10

Quote:
Originally Posted by CryForMe View Post
Here's the latest for reference. I think my brain is tricking me into thinking its actually making a slight difference when I test it. Haha! It still doesn't work though.

PHP Code:
/*
* SourceMod Script
*/

#include <sourcemod>
#include <sdkhooks>

#define PLUGIN_VERSION "1.0"

new Handle:g_hEnabled;
new 
Handle:g_Cvar_zSpeed

public Plugin:myinfo 
{
    
name "zSpeed",
    
author "CryForMe",
    
description "Speeds Up Zombies",
    
version PLUGIN_VERSION,
    
url "http://www.contagiondeathsquad.clanservers.com/"
};


public 
OnPluginStart()
{
    
CreateConVar("sm_zSpeed_version"PLUGIN_VERSION"zSpeed Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY)
    
g_hEnabled  CreateConVar("sm_zSpeed_enabled""0""Enable/disable plugin"FCVAR_PLUGIN);
    
g_Cvar_zSpeed   CreateConVar("sm_zSpeed""1.0""Sets the zombies speed"FCVAR_PLUGIN)
    
AutoExecConfig();
}

public 
Action:OnEntityCreated(ent, const String:classname[], bool:dontBroadcast)
{
    if (
GetConVarBool(g_hEnabled)) {
        if(
StrEqual(classname"npc_zombie"false)) {
            
SetEntPropFloat(entProp_Data"m_flLaggedMovementValue"GetConVarFloat(g_Cvar_zSpeed))
        }
    }
    return 
Plugin_Continue;

Try this:
PHP Code:
public Plugin:myinfo 
{
    
name "zSpeed",
    
author "CryForMe",
    
description "Speeds Up Zombies",
    
version PLUGIN_VERSION,
    
url "http://www.contagiondeathsquad.clanservers.com/"
};


public 
OnPluginStart()
{
    
CreateConVar("sm_zSpeed_version"PLUGIN_VERSION"zSpeed Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY)
    
g_hEnabled  CreateConVar("sm_zSpeed_enabled""0""Enable/disable plugin"FCVAR_PLUGIN);
    
g_Cvar_zSpeed   CreateConVar("sm_zSpeed""1.0""Sets the zombies speed"FCVAR_PLUGIN)
    
AutoExecConfig(true);
}

public 
OnEntityCreated(entity, const String:classname[])
{
    if (
GetConVarBool(g_hEnabled) && StrEqual(classname"npc_zombie"false))
        
SDKHook(entitySDKHook_SpawnPostPost_Spawn);
}

public 
Post_Spawn(entity)
{
        
SetEntPropFloat(ententityProp_Data"m_flLaggedMovementValue"GetConVarFloat(g_Cvar_zSpeed))

__________________

Last edited by WildCard65; 12-21-2014 at 18:11.
WildCard65 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 00:44.


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