Sven Co-op

Sven Co-op

Ajax Pain Jan 27, 2017 @ 5:42pm
Weapon Replace complete
I want to replace weapons on certain map ex: sc_psyko weapon_shotgun(default) per weapon_rpg(or custom weapon).

some scrypt(angelscript) or plugin(amx mod)?
< >
Showing 1-6 of 6 comments
Orphanage Jan 27, 2017 @ 5:45pm 
Use ripent program to edit .ent and then recompile back with same ripent.
KernCore  [developer] Jan 27, 2017 @ 7:01pm 
create an ItemMapping array:
array<ItemMapping@> g_ItemMappings;

Add the weapons you want to replace, then the custom weapon that will be replacing it:
array<ItemMapping@> g_ItemMappings = {
ItemMapping( "weapon_shotgun", "weapon_rpg" )
};

Now we'll do some calls on MapInit Function:
void MapInit()
{
g_ClassicMode.EnableMapSupport();
g_ClassicMode.SetShouldRestartOnChange( false );
g_ClassicMode.SetItemMappings( @g_ItemMappings );

if( !g_ClassicMode.IsEnabled() )
g_ClassicMode.Toggle();

g_ClassicMode.ForceItemRemap( true );
}

You just replaced weapon_shotgun with weapon_rpg, now everytime you see a place where a shotgun should be, it will show up as an Rpg instead
Last edited by KernCore; Jan 27, 2017 @ 9:40pm
Ajax Pain Jan 27, 2017 @ 8:23pm 
Originally posted by KernCore:
create an ItemMapping array:
array<ItemMapping@> g_ItemMappings;

Add the weapons you want to replace, then the custom weapon that will be replacing it:
array<ItemMapping@> g_ItemMappings = {
ItemMapping( "weapon_shotgun", "weapon_rpg" )
}

Now we'll do some calls on MapInit Function:
void MapInit()
{
g_ClassicMode.EnableMapSupport();
g_ClassicMode.SetShouldRestartOnChange( false );
g_ClassicMode.SetItemMappings( @g_ItemMappings );

if( !g_ClassicMode.IsEnabled() )
g_ClassicMode.Toggle();

g_ClassicMode.ForceItemRemap( true );
}

You just replaced weapon_shotgun with weapon_rpg, now everytime you see a place where a shotgun should be, it will show up as an Rpg instead
The weapon not change http://prnt.sc/e1bhef http://prnt.sc/e1bhuh

*The line 4 is fixed but it still doesn't work
Last edited by Ajax Pain; Jan 27, 2017 @ 8:55pm
KernCore  [developer] Jan 27, 2017 @ 9:39pm 
Originally posted by Ajax Pain:
Originally posted by KernCore:
create an ItemMapping array:


Add the weapons you want to replace, then the custom weapon that will be replacing it:


Now we'll do some calls on MapInit Function:


You just replaced weapon_shotgun with weapon_rpg, now everytime you see a place where a shotgun should be, it will show up as an Rpg instead
The weapon not change http://prnt.sc/e1bhef http://prnt.sc/e1bhuh

*The line 4 is fixed but it still doesn't work
Theres no need for the first line, i just added it there so you can know what variable you'll work on if you need to replace weapons in the future

This is how your code should look like: http://i.imgur.com/OsxuEK9.png
Last edited by KernCore; Jan 27, 2017 @ 11:17pm
Ajax Pain Jan 28, 2017 @ 5:45am 
Originally posted by KernCore:
Originally posted by Ajax Pain:
The weapon not change http://prnt.sc/e1bhef http://prnt.sc/e1bhuh

*The line 4 is fixed but it still doesn't work
Theres no need for the first line, i just added it there so you can know what variable you'll work on if you need to replace weapons in the future

This is how your code should look like: http://i.imgur.com/OsxuEK9.png
Is working, the problem was "," xd

thanks for everything goodman :D

Now I need to do it with custom weapons
Aod Apr 18, 2017 @ 1:24am 
Hello KernCore,
I have used your code to replace the 9mmAR and the shotgun with the classic Half Life Weapons. That works fine for the weapons i got at startup.
But how can I replace the items in the map?

Like example, the map has a point where you can pick up an m16. There is still an m16 and not the HLMP5. Can you help me to replace it?

I'm using a map skript with this code

#include "weapon_hlmp5" #include "weapon_hlshotgun" array<ItemMapping@> g_ItemMappings = { ItemMapping( "weapon_m16", GetHLMP5Name() ), ItemMapping( "weapon_9mmAR", GetHLMP5Name() ), ItemMapping( "weapon_shotgun", GetHLShotgunName() ) }; void MapInit() { RegisterHLMP5(); RegisterHLShotgun(); g_ClassicMode.EnableMapSupport(); g_ClassicMode.SetShouldRestartOnChange( false ); g_ClassicMode.SetItemMappings( @g_ItemMappings ); if( !g_ClassicMode.IsEnabled() ) g_ClassicMode.Toggle(); g_ClassicMode.ForceItemRemap( true ); if( g_ClassicMode.IsEnabled() ) g_ClassicMode.Toggle(); }
Last edited by Aod; Apr 18, 2017 @ 7:12am
< >
Showing 1-6 of 6 comments
Per page: 1530 50

Date Posted: Jan 27, 2017 @ 5:42pm
Posts: 6