Raised This Month: $ Target: $400
 0% 

[Orpheu] Weapon respawn delay


Post New Thread Reply   
 
Thread Tools Display Modes
teh ORiON
Member
Join Date: Sep 2011
Location: Denmark
Old 10-25-2012 , 17:22   Re: [Orpheu] Weapon respawn delay
Reply With Quote #11

Quote:
Originally Posted by Arkshine View Post
I've tried the game, I don't know much about it, but I don't see weapon on the ground, except probably at spawn but you pickup right away. That's why I thought you might talk about the items around the maps, is it not the case ? Yes, it's well called, and there is no reason altering time is not working unless you're trying to respawn the wrong thing.
Ah yes, for normal standard maps there won't be weapons on the ground. It is however possible to have weapons on the ground which respawn when you pick them up in custom maps which is what I want to use it for.
teh ORiON is offline
teh ORiON
Member
Join Date: Sep 2011
Location: Denmark
Old 10-25-2012 , 17:40   Re: [Orpheu] Weapon respawn delay
Reply With Quote #12

I made a little test map, if you have time to test it out.
Attached Files
File Type: zip weapontest.zip (116.2 KB, 47 views)
teh ORiON is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-25-2012 , 18:41   Re: [Orpheu] Weapon respawn delay
Reply With Quote #13

I don't understand what happens. Not sure I've something wrong with my installation.

Without the plugin, the weapon respaws right away.
With the plugin, the weapon doesn't respawn at all.

Function is well called, but as post, it returns always 0.

Also, just by hooking InstallGameRules and doing nothing more, the weapon doesn't respawn. Something is fucked up. If it doesn't happen for you, there is something wrong with my configuration, probably.

Can you ZIP your orpheu directory and attach here ?
__________________
Arkshine is offline
teh ORiON
Member
Join Date: Sep 2011
Location: Denmark
Old 10-25-2012 , 19:01   Re: [Orpheu] Weapon respawn delay
Reply With Quote #14

Quote:
Originally Posted by Arkshine View Post
I don't understand what happens. Not sure I've something wrong with my installation.

Without the plugin, the weapon respaws right away.
With the plugin, the weapon doesn't respawn at all.

Function is well called, but as post, it returns always 0.

Also, just by hooking InstallGameRules and doing nothing more, the weapon doesn't respawn. Something is fucked up. If it doesn't happen for you, there is something wrong with my configuration, probably.

Can you ZIP your orpheu directory and attach here ?
Sure thing. And no that doesn't happen for me at all.
Attached Files
File Type: zip orpheu.zip (124.3 KB, 49 views)
teh ORiON is offline
teh ORiON
Member
Join Date: Sep 2011
Location: Denmark
Old 10-26-2012 , 17:43   Re: [Orpheu] Weapon respawn delay
Reply With Quote #15

So ended up finding a solution with a different approach.

PHP Code:
//=========================================================
// Respawn- this item is already in the world, but it is
// invisible and intangible. Make it visible and tangible.
//=========================================================
CBaseEntityCBasePlayerItem::Respawnvoid )
{
    
// make a copy of this weapon that is invisible and inaccessible to players (no touch function). The weapon spawn/respawn code
    // will decide when to make the weapon visible and touchable.
    
CBaseEntity *pNewWeapon CBaseEntity::Create( (char *)STRINGpev->classname ), g_pGameRules->VecWeaponRespawnSpotthis ), pev->anglespev->owner );

    if ( 
pNewWeapon )
    {
        
pNewWeapon->pev->effects |= EF_NODRAW;// invisible for now
        
pNewWeapon->SetTouchNULL );// no touch
        
pNewWeapon->SetThinkAttemptToMaterialize );

        
DROP_TO_FLOOR ENT(pev) );

        
// not a typo! We want to know when the weapon the player just picked up should respawn! This new entity we created is the replacement,
        // but when it should respawn is based on conditions belonging to the weapon that was taken.
        
pNewWeapon->pev->nextthink g_pGameRules->FlWeaponRespawnTimethis );
    }
    else
    {
        
ALERT at_console"Respawn failed to create %s!\n"STRINGpev->classname ) );
    }

    return 
pNewWeapon;

So reading in the SDK I figured I could just grab the weapon entity and change it's nextthink value and then return the entity. So that's what I did.

PHP Code:
#include <amxmodx>
#include <orpheu>
#include <fakemeta>

public plugin_init()
{    
    
OrpheuRegisterHook(OrpheuGetFunction("Respawn","CBasePlayerItem"), "OnWeaponRespawn",OrpheuHookPost)     
}

public 
OrpheuHookReturn:OnWeaponRespawn()
{
    new 
iWeapon OrpheuGetReturn()
    
set_pev(iWeapon,pev_nextthink,get_gametime() + 1.0)
    
    
OrpheuSetReturn(iWeapon)
    return 
OrpheuOverride

PHP Code:
{
    
"name" "Respawn",
    
"class" "CBasePlayerItem",
    
"library" "mod",
    
"return" 
    {
        
"type" "CBaseEntity *"
    
},
    
"identifiers" 
    [
        {
            
"os"    "windows",
            
"mod"   "tfc",
            
"value" 0x872E0
        
}
    ]

Works like a charm! But that of course doesn't change the fact that the other method should work as this virtual function clearly uses the value returned from the aforementioned function.

Anyway this can of course also be accomplished with hamsandwich for each individual weapon with Ham_Respawn.

Last edited by teh ORiON; 10-26-2012 at 17:46.
teh ORiON is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-26-2012 , 19:09   Re: [Orpheu] Weapon respawn delay
Reply With Quote #16

After using your files, it was working, something wrong somewhere. Anyway, tried and you're right, it's somehow ignored or overwritten ; tried things without success. It's really weird. Wanted to test if it was the same by using a signature instead, but not the time to do it yet. I remember it works fine for CS and some functions, it should be the same for TFC. The truth is always elsewhere.
__________________
Arkshine 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 03:00.


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