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

[TF2] Simple Ghost


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Plugin ID:
4186
Plugin Version:
1.0
Plugin Category:
Fun Stuff
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Allows you to spawn a simple_bot & ghost hybrid
    Old 05-06-2014 , 15:47   [TF2] Simple Ghost
    Reply With Quote #1

    TF2 Simple Ghost



    What is it?
    It's an unused entity called simple_bot that i made to mimic the TF2 ghost as best as i could


    Can i configure it in any way?
    Of cource you can! BUT BE NOTED THE GHOST WILL NOT MOVE IF YOUR MAP DOESN'T HAVE A .NAV MESH!

    Commands:

    sm_simpleghost : Spawns a simple_ghost on top of you [Default acces: ROOT]
    sm_killghost : Kills all the simple_ghosts on the map [Default acces: ROOT]

    Cvars:
    sm_ghost_minvistime (default: 5.0) Minimum duration to stay visible
    sm_ghost_maxvistime (default: 10.0) Maximum duration to stay visible

    sm_ghost_mininvistime (default: 60.0) Minimum duration to stay invisible
    sm_ghost_maxinvistime (default: 120.0) Maximum duration to stay invisible

    sm_ghost_stunduration (default: 5.0) Duration of the 'BOO!' condition on client
    sm_ghost_checkdelay (default: 0.1) How often to check for nearby clients to Spook
    sm_ghost_checkdistance (default: 240.0) How far away to stun clients

    Changelog:
    1.0 Initial Release
    1.1 Fixed unescessary looping
    1.2 Fixed removing other simple_bots than the ones that were spawned by this plugin
    1.3 Sentries should no longer target the ghost

    Credits to Leonardo for some of the code i use in this plugin
    Attached Files
    File Type: sp Get Plugin or Get Source (simple_ghost.sp - 1384 views - 11.8 KB)
    __________________

    Last edited by Pelipoika; 07-07-2014 at 18:26.
    Pelipoika is offline
    Mitchell
    ~lick~
    Join Date: Mar 2010
    Old 05-06-2014 , 15:56   Re: [TF2] Simple Ghost
    Reply With Quote #2

    Command_KillBot would kill any simple_bots in the map. Could cause issues.

    Also the ghost think is quite redundant.
    You have a think for each ghost, but within that think instead of finding every one around the 1 ghost and scare the players it find everyone around all of the simple_bots and scares them.

    so if there was 5 active ghosts (visible) and 32 active players all alive and playing it would do:
    FindByClassname 5 time per think
    and would check the distance away from a ghost and a player 5*32 times, that's alot of unneeded math.

    If my math is right anyways..

    Last edited by Mitchell; 05-06-2014 at 15:58.
    Mitchell is offline
    Pelipoika
    Veteran Member
    Join Date: May 2012
    Location: Inside
    Old 05-06-2014 , 16:03   Re: [TF2] Simple Ghost
    Reply With Quote #3

    Quote:
    Originally Posted by Mitchell View Post
    Command_KillBot would kill any simple_bots in the map. Could cause issues.

    Also the ghost think is quite redundant.
    You have a think for each ghost, but within that think instead of finding every one around the 1 ghost and scare the players it find everyone around all of the simple_bots and scares them.

    so if there was 5 active ghosts (visible) and 32 active players all alive and playing it would do:
    FindByClassname 5 time per think
    and would check the distance away from a ghost and a player 5*32 times, that's alot of unneeded math.

    If my math is right anyways..
    Fixed the too many loops thing.
    Not so sure about how to fix not removing other simple_bot's
    __________________
    Pelipoika is offline
    Mitchell
    ~lick~
    Join Date: Mar 2010
    Old 05-06-2014 , 16:45   Re: [TF2] Simple Ghost
    Reply With Quote #4

    Quote:
    Originally Posted by Pelipoika View Post
    Fixed the too many loops thing.
    Not so sure about how to fix not removing other simple_bot's
    You could use ADT Arrays,

    I THINK THIS WOULD WORK:
    or another simple, but still cost the same amount of processing time just change the class name after the entity is created:
    PHP Code:
            new Ghost CreateEntityByName("simple_bot"); 
            if(
    Ghost || Ghost 2048
            {
                
    DispatchKeyValue(Ghost"classname""ghost_ent");
                
    DispatchSpawn(Ghost); 
                
    SetEntProp(GhostProp_Data"m_takedamage"01);
                
    SetEntProp(GhostProp_Send"m_CollisionGroup"2);
                
    TeleportEntity(GhostposNULL_VECTORNULL_VECTOR); 
                
    AttachParticle(Ghost"ghost_appearation"_5.0);
                
    SetEntityModel(Ghost"models/props_halloween/ghost.mdl");
                
    g_bInvisible[Ghost] = false;
                
    CreateTimer(GetRandomFloat(g_flCvarMinVisibleg_flCvarMaxVisible), Timer_ToggleInvisEntIndexToEntRef(Ghost));
                
    SDKHook(GhostSDKHook_TouchGhostThink); 
            } 
    and change all the FindByClassname functions to search for "ghost_ent"

    ADT Example would be:
    PHP Code:
    new Handle:hGhosts;
    //To Create:
    //USE ON PLUGIN START:
    hGhosts CreateArray();

    //Delete Index:
    new entity EntRefToEntIndex(GetArrayCell(hGhostsINDEX_HERE));
    if(
    IsValidEntity(entity))
    {
        
    AcceptEntityInput(entity"Kill");
    }

    //Delete All: (Since all entities are deleted when the round restarts just clear the array)
        
    new entity = -1;
        for(new 
    0GetArraySize(hGhosts); i++)
        {
            
    entity EntRefToEntIndex(GetArrayCell(hGhostsi));
            if(
    IsValidEntity(entity))
            {
                
    AcceptEntityInput(entity"Kill");
            }
        }
        
    ClearArray(hGhosts);

    //Find an entity in the array: (probably wont use it.)
    FindValueInArray(hGhosts,  EntIndexToEntRef(Entity));

    //Clear Array:
    ClearArray(hGhosts);

    //To add (push) to the ADT:
    PushArrayCell(hGhostsEntIndexToEntRef(Ghost)); 
    i may or may not have screwed up on something within that. You dont need to convert the entity back into a reference if you dont want to.

    Last edited by Mitchell; 05-06-2014 at 16:47.
    Mitchell is offline
    SoulSharD
    Member
    Join Date: Oct 2013
    Location: United Kingdom
    Old 07-07-2014 , 17:55   Re: [TF2] Simple Ghost
    Reply With Quote #5

    Hmm, the sentries appear to be able to attack the ghosts, both RED and BLU sentries.

    Wouldn't it be worth adding FL_NOTARGET flag onto the ghosts? Just an idea, perhaps make it a CVAR or something.
    __________________

    SoulSharD is offline
    Pelipoika
    Veteran Member
    Join Date: May 2012
    Location: Inside
    Old 07-07-2014 , 18:27   Re: [TF2] Simple Ghost
    Reply With Quote #6

    Quote:
    Originally Posted by SoulSharD View Post
    Hmm, the sentries appear to be able to attack the ghosts, both RED and BLU sentries.

    Wouldn't it be worth adding FL_NOTARGET flag onto the ghosts? Just an idea, perhaps make it a CVAR or something.
    Done, didn't test it tho
    __________________
    Pelipoika is offline
    Reply


    Thread Tools
    Display Modes

    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 17:55.


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