AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Chest no block players [Pirates, vikings, knight II] (https://forums.alliedmods.net/showthread.php?t=342183)

ORdli 03-15-2023 02:51

Chest no block players [Pirates, vikings, knight II]
 
Can anyone write a plugin that will allow players to freely walk through chests in this game? and that they don't block or push players? the game has a Weapon_Chest weapon in simple words, you need to remove the collision from this object so that players can no longer get stuck in it


https://forums.alliedmods.net/attachment.php?attachmentid=199917&stc=1&d=16 78863225[/IMG]

https://forums.alliedmods.net/attachment.php?attachmentid=199916&stc=1&d=16 78863225[/IMG]

Bacardi 03-15-2023 17:49

Re: Chest no block players [Pirates, vikings, knight II]
 
Try this
PHP Code:

#include <sdktools>
#include <sdkhooks>

#define COLLISION_GROUP_DEBRIS        1 // trigger not work
#define COLLISION_GROUP_DEBRIS_TRIGGER        2
#define COLLISION_GROUP_WEAPON        11

public void OnPluginStart()
{
    
HookEvent("chest_respawn"chest);
}


public 
void OnEntityCreated(int entity, const char[] classname)
{
    if(
StrEqual(classname"weapon_chest"false))
        
SDKHook(entitySDKHook_SpawnPostSpawnPost);
}

public 
void SpawnPost(int entity)
{
    
int ref EntIndexToEntRef(entity);
    
    if(
ref != -1)
        
RequestFrame(delayref);
}

public 
void chest(Event event, const char[] namebool dontBroadcast)
{
    
int entity event.GetInt("chestid");

    
int ref EntIndexToEntRef(entity);

    if(
ref != -1)
        
RequestFrame(delayref);
}

public 
void delay(any data)
{
    
SetCollisionGroup(dataCOLLISION_GROUP_DEBRIS_TRIGGER);
}

void SetCollisionGroup(int refint collisionGroup)
{
    if(
IsValidEntity(ref) && IsValidEdict(ref))
    {
        
SetEntProp(refProp_Send"m_CollisionGroup"collisionGroup);
        
//PrintToServer("SetCollisionGroup %i", ref);
    
}


...those chests, what spawn on top of small pilar. Pilar have higher colllision box what block player, chest itself can lay top of pilar. If you wonder.

ORdli 03-16-2023 13:46

Re: Chest no block players [Pirates, vikings, knight II]
 
it works thanks, now there will be less bugs in the game!


All times are GMT -4. The time now is 05:02.

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