AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Control Speed of AI Only? (https://forums.alliedmods.net/showthread.php?t=251947)

CryForMe 11-22-2014 18:32

Control Speed of AI Only?
 
I've really looked, but perhaps I just don't understand as much as I should.
I'm trying to develop a plugin that allows me to control the walking/running speed of the A.I. zombies on my server, but I can't even locate a cvar for it to begin. I thought with sm, I could use some sort of entity control on them to solve this, but I'm having trouble getting started. The game is Contagion. Any advice would be a great help.

zeroibis 11-22-2014 20:40

Re: Control Speed of AI Only?
 
If you can detect fake clients (ie AI players) and change a players speed you just detect all fake clients and change their speed.

thecount 11-22-2014 23:58

Re: Control Speed of AI Only?
 
Quote:

Originally Posted by zeroibis (Post 2227241)
If you can detect fake clients (ie AI players) and change a players speed you just detect all fake clients and change their speed.

I'm not experienced with this game, but I think the zombies might not be classified as actual clients. I'm thinking it's sort of like L4D2, but I may be wrong. So in that case, the zombies would not be able to be found by looping through all clients. Therefore, you would need to search through all entities of whatever the classname is and then adjust the (keyvalue?) speed that way.

PHP Code:

new ent = -1;
while((
ent FindEntityByClassname(ent"zombie?")) != -1){//For every zombie class
//Change speed here


OR

PHP Code:

public OnEntityCreated(ent, const String:classname[]){
if(
StrEqual(classname"zombie?"false)){
//Change speed here
}



CryForMe 11-23-2014 01:07

Re: Control Speed of AI Only?
 
Quote:

Originally Posted by thecount (Post 2227263)
I'm not experienced with this game, but I think the zombies might not be classified as actual clients. I'm thinking it's sort of like L4D2, but I may be wrong. So in that case, the zombies would not be able to be found by looping through all clients. Therefore, you would need to search through all entities of whatever the classname is and then adjust the (keyvalue?) speed that way.

PHP Code:

new ent = -1;
while((
ent FindEntityByClassname(ent"zombie?")) != -1){//For every zombie class
//Change speed here


OR

PHP Code:

public OnEntityCreated(ent, const String:classname[]){
if(
StrEqual(classname"zombie?"false)){
//Change speed here
}



Ah, this makes it a bit clearer. Thank you, I will work on this.

CryForMe 11-23-2014 16:16

Re: Control Speed of AI Only?
 
Ok, here's what I've tried so far and I can't seem to get it working.

PHP Code:

/*
* SourceMod Script
*/

#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "1.0"

new Handle:g_Cvar_zSpeed
new Handle:g_Cvar_zWeight

public Plugin:myinfo 
{
    
name "zSpeed",
    
author "",
    
description "Speeds Up Zombies",
    
version PLUGIN_VERSION,
    
url ""
};


public 
OnPluginStart()
{
    
CreateConVar("sm_zspeed_version"PLUGIN_VERSION"zSpeed Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY)
    
g_Cvar_zspeed    CreateConVar("sm_zspeed_speed""3.0"" Sets the zombies speed "FCVAR_PLUGIN)
    
g_Cvar_zweight   CreateConVar("sm_zspeed_weight""0.0"" Sets the zombies weight"FCVAR_PLUGIN)
   
    
AutoExecConfig();   
    
}

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




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

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