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

[CS:GO] Entity Spawner (v1.01 2/27/2019)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Rachnus
Senior Member
Join Date: Jun 2016
Location: Funland
Plugin ID:
6215
Plugin Version:
v1.01
Plugin Category:
General Purpose
Plugin Game:
Counter-Strike: GO
Plugin Dependencies:
Servers with this Plugin:
 
Plugin Description:
Spawn entities randomly across the map
Old 08-02-2018 , 10:02   [CS:GO] Entity Spawner (v1.01 2/27/2019)
Reply With Quote #1

Entity Spawner v1.01


THIS PLUGIN REQUIRES: NAV AREA UTILITIES

Description:
Spawn entities randomly across the map. Entities spawned can be set in configs/entityspawner/entities.cfg

Commands:
Quote:
sm_esspawn - Force spawn all props on the current map. (Will remove previously spawned props first) - flag Z
sm_esclear - Force remove all props spawned by this plugin - flag Z
sm_esreload - Reload entities.cfg - flag Z
Convars:
Quote:
entityspawner_nav_areas_required - 50 - Amount of nav areas required for items to spawn
entityspawner_spawn_limit - 1900 - Stop spawning entities once global entity count reaches this value
Preview:


Stock Config:
PHP Code:
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//                            INFO
//
//    The config is read from top to bottom, so maps put further up
//     the config will be prioritized
//
//    Example:
//    - de_dust2
//    - de_
//
//    If the map is dust2, the spawns for that section will be read.
//     If the map is nuke, the spawns for "de_" section will be read.
//
//    MAP KEYS:
//    "spawnroundstart"    "<number>"            - 0 will disable entity spawning on round start
//                                            - 1 will enable entity spawning on round start
//
//    "maxroundspawns"    "<number>"            - Amount of rounds entities will spawn
//                                            - 0 will spawn entities every round
//
//    "spawninterval"        "<number>"            - Amount of seconds until entities should spawn again
//                                            - 0 will disable
//
//    "resettimer"        "<0/1>"                - Should the spawn timer be reset on round start or transfer over rounds
//
//
//    ENTITY KEYS:
//    "classname"            "<string>"            - The classname of the entity you want to spawn
//                                            - List of CSGO specific entities can be found here: [url]https://developer.valvesoftware.com/wiki/List_of_Counter-Strike:_Global_Offensive_Entities[/url]
//
//    "keyvalue<number>"    "<key> <value>"        - Enter a keyvalue for a entity, this is optional
//                                            - If you need to set multiple keyvalues, just increment the number after the key
//                                            Example:
//                                            - "keyvalue0"    "model modelpath/modelname.mdl"
//                                            - "keyvalue1"    "modelscale 5.0"
//
//    "prop<number>"        "<prop> <value>"    - Enter a value for an entity property, this is optional
//                                            - If you need to set multiple props, just increment the number after the key
//                                            Example:
//                                            - "prop0"    "m_iHealth 2"
//                                            - "prop1"    "m_vecOrigin 50.0 24.5 36.0"
//                                            - "prop2"    "m_iszName hehehehe"
//
//    "maxspawns"            "<number">            - Max amount of times this entity could be spawned per round.
//                                              However, it does not guarantee that it will spawn this amount of times.
//
//    "zoffset"            "<decimal>"            - If the terrain is very uneven like dust2, increase this value a bit (5.0 - 10.0)
//                                              and you might see an increase of spawns.
//                                            - The reason for this key is because everytime a prop is spawned, it makes sure
//                                              that the prop fits around the area its spawned.
//                                            - Increasing this value will make the prop spawn higher above the ground
//
//    "slopes"            "<0/1>"                - Can this entity spawn on slopes or only flat surfaces
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////

// This stock config will spawn AWPS/Breakable crates/Chickens on maps that start with "de_" or "cs_"

"entities"
{
    
"de_"
    
{
        
"spawnroundstart"    "1"
        "maxroundspawns"    "0"
        "spawninterval"        "0"
        "resettimer"        "1"
        
        "AWP"
        
{
            
"classname"        "weapon_awp"
            "maxspawns"        "20"
            "zoffset"        "10.0"
            "slopes"        "1"
        
}
        
        
"Breakable Crate"
        
{
            
"classname"        "prop_physics_override"
            "keyvalue0"        "model models/props_junk/wood_crate001a.mdl"
            "prop0"            "m_takedamage 2"
            "maxspawns"        "50"
            "zoffset"        "10.0"
            "slopes"        "1"
        
}
        
        
"Chicken Medium"
        
{
            
"classname"        "chicken"
            "maxspawns"        "20"
            "zoffset"        "5.0"
            "slopes"        "1"
        
}
    }
    
    
"cs_"
    
{
        
"spawnroundstart"    "1"
        "maxroundspawns"    "0"
        "spawninterval"        "0"
        "resettimer"        "1"
        
        "AWP"
        
{
            
"classname"        "weapon_awp"
            "maxspawns"        "20"
            "zoffset"        "10.0"
            "slopes"        "1"
        
}
        
        
"Breakable Crate"
        
{
            
"classname"        "prop_physics_override"
            "keyvalue0"        "model models/props_junk/wood_crate001a.mdl"
            "prop0"            "m_takedamage 2"
            "maxspawns"        "50"
            "zoffset"        "10.0"
            "slopes"        "1"
        
}
        
        
"Chicken Medium"
        
{
            
"classname"        "chicken"
            "maxspawns"        "20"
            "zoffset"        "5.0"
            "slopes"        "1"
        
}
    }

Include:
PHP Code:
#if defined _entityspawner_included
 #endinput
#endif
#define _entityspawner_included

#define ES_PREFIX " \x09[\x04ES\x09]"
#define ES_MAX_ENTITIES 256
#define ES_INVALID_MAX_SPAWNS 0
#define ES_INVALID_SPAWN_INTERVAL 0
#define ES_INVALID_PROP_SEND_OFFSET -1
#define ES_INVALID_PROP_DATA_OFFSET -1

/**
 * Spawns random entities on the map (Set in entityspawner.cfg)
 * @return int         amount of entities spawned
 */
native int ES_SpawnEntities();

/**
 * Clears all randomly spawned entities
 * @return int         amount of entities removed
 */
native int ES_ClearEntities();

/**
 * Returns true if spawning is enabled on round start
 * @return bool        are entities spawning on round start
 */
native bool ES_IsSpawningOnRoundStart();

/**
 * Returns true if theres enough nav areas (Set by convar) and if config is setup for current map
 * @return bool        enough nav areas/config setup
 */
native bool ES_IsRandomSpawnsEnabled();

/**
 * Called when entities are randomly spawned across the map
 * @param entities that spawned (Entity references)
 * @param amount of entities spawned
 * @noreturn
 */
forward void ES_OnEntitiesSpawned(int entities[ES_MAX_ENTITIES], int entCount);

/**
 * Called when all randomly spawned entities are removed
 * @param amount of entities removed
 * @noreturn
 */
forward void ES_OnEntitiesCleared(int entCount);

public 
SharedPlugin __pl_entityspawner  =
{
    
name "entityspawner",
    
file "entityspawner.smx",
#if defined REQUIRE_PLUGIN
    
required 1
#else
    
required 0
#endif
};

#if !defined REQUIRE_PLUGIN
public __pl_entityspawner_SetNTVOptional()
{    
    
MarkNativeAsOptional("ES_SpawnEntities");
    
MarkNativeAsOptional("ES_ClearEntities");
    
MarkNativeAsOptional("ES_IsSpawningOnRoundStart");
    
MarkNativeAsOptional("ES_IsRandomSpawnsEnabled");
}
#endif 
Changelog:
Spoiler


Extra:
Make sure your map has a .nav file. Will barely work if not.

Credits:
  • Me

DOWNLOAD
__________________
Github: https://github.com/jimppan
Steam: http://steamcommunity.com/id/jimppan
_____________________________________________ _________
Taking private requests

Last edited by Rachnus; 02-21-2024 at 13:57.
Rachnus is offline
Bara
AlliedModders Donor
Join Date: Apr 2012
Location: Germany
Old 08-02-2018 , 10:09   Re: [CS:GO] Entity Spawner (v1.0 8/2/2018)
Reply With Quote #2

Nice!

This plugin with "mp_weapons_allow_map_placed 0" could be useful for some gamemodes like TTT (randomly placed weapons).
__________________
Discord (Bara#5006) | My Plugins (GitHub)
You like my work? Support is not a crime.

Last edited by Bara; 08-02-2018 at 10:36.
Bara is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 08-02-2018 , 10:55   Re: [CS:GO] Entity Spawner (v1.0 8/2/2018)
Reply With Quote #3

Quote:
Originally Posted by Bara View Post
Nice!

This plugin with "mp_weapons_allow_map_placed 0" could be useful for some gamemodes like TTT (randomly placed weapons).
wouldn't you need valid nav for this to work?

most custom map don't have it?
__________________
8guawong is offline
Bara
AlliedModders Donor
Join Date: Apr 2012
Location: Germany
Old 08-02-2018 , 11:46   Re: [CS:GO] Entity Spawner (v1.0 8/2/2018)
Reply With Quote #4

Quote:
Originally Posted by 8guawong View Post
wouldn't you need valid nav for this to work?

most custom map don't have it?
Run "nav_generate" via. rcon and it should be generated
__________________
Discord (Bara#5006) | My Plugins (GitHub)
You like my work? Support is not a crime.
Bara is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 08-02-2018 , 11:54   Re: [CS:GO] Entity Spawner (v1.0 8/2/2018)
Reply With Quote #5

Quote:
Originally Posted by Bara View Post
Run "nav_generate" via. rcon and it should be generated
Yes but sometimes the server will timeout when trying to generate the nav
__________________
8guawong 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 22:21.


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