Adding to the weapon menu
#2
You know, this kinda reminds me about the time I asked V-Man about modding the game to have seperate weapons for CLA and RVSF. I like this concept Myke. Though if I'm not mistaken there's a very old script in akimbo's archives that allowed you to do something similar to this. You'd have your skin_weapon.jpg and skin_weaponx.jpg (or something like that). You'd execute a command to switch them in game.

If I get the chance I'll see if I have it lying around somewhere.



I just found it, though idk if it is compatable with 1.2 ... give it a shot! Everything in the code section is a read-me provided by V-Man.

SkinSwitcher by V-Man

This setup will allow you to switch weapon skins (.jpg) in-game via menu. Unfortunately, swapping 3d models does not work unless you quit the game first, which ruins the point of crafting CubeScript for it.
Another shortcoming to this is that it only supports one alternate skin per weapon. If this monstrosity becomes popular, I'll look into extending it.
After the instructions for use, I'll talk about the nerdy details of what this setup does.

To enable SkinSwitch:

1 - Place "skinswitch.bat" and "sleep.exe" in your main AssaultCube folder. It should be the same folder that contains "assaultcube.bat" and the folders "config" and "packages".

2 - Save each alternate skin as "skin_weaponx.jpg" and place it in the same folder as the skin you will replace in-game.

3 - Place skinswitch_menu.cfg in your "config" folder.

4 - Add the following line to your "autoexec.cfg" folder:

    exec config\skinswitch_menu.cfg


5 - If you want, you can keybind "skinwitch" to a particular key, or use it in a script to access the menu. If you want to switch skins without using the menu, reading the menu itself should give you a clue about how to do that.


To use SkinSwitch:

1 - Run "skinswitch.bat". Allow it to run in the background.

2 - In AssaultCube, type "skinswitch" (or activate the alias through a keybind).

3 - Select the weapon you have an alternate skin for. Voila!

"assault" contains a file named "skin_weaponx.jpg" as an example of a replacer-skin. It should go in the "packages\models\weapons\assault" folder if you do not already have an assault rifle alternate skin.

WARNING: Nerdy explanations ahead.

Thanks to DES|GeneralDisarray for showing me the "sleep.exe" file. This causes the batch file to use fewer system resources. "sleep.exe" is used in the batch file to pause for a second while assessing the files it is searching.

"skinswitch.bat" looks in the "packages\maps" folder for a map named one of four keywords: "switchout_AR.cgz", "switchout_SMG.cgz", "switchout_SR.cgz", or "switchout_SG.cgz". If any of those exist, it performs actions in the folder correspinding to the map name.
It goes to the designated weapon folder and checks if there is a file there called "skin_weaponx.jpg". If there is, it swaps its name with "skin_weapon.jpg". Then it deletes the indicator map file and goes back to monitoring the maps folder.

"skinswitch_menu.cfg" creates a new menu. It then gives four options, one for each weapon, to swap out the skin in question. I've added "menumdl" and "chmenumdl" as nifty whirligigs, but they don't actually portray the skin in question.
When a weapon is selected, the menu executes a "savemap" command, calling the current map "switchout_" followed by a code representing the weapon in question. It then executes the "resetgl" command, reloading all textures and skins.
The cfg file then defines alias "skinswitch" to open the menu and remind you of the most important parts of this setup.

If the "resetgl" part of this takes less than 1 second for you, you may experience a lack of skin-change. Simply enter "resetgl" yourself and it should be fine.

Download Skin Switcher by V-Man
Thanks given by:


Messages In This Thread
Adding to the weapon menu - by MykeGregory - 29 May 14, 04:07PM
RE: Adding to the weapon menu - by D3M0NW0LF - 29 May 14, 08:22PM
RE: Adding to the weapon menu - by MykeGregory - 29 May 14, 09:29PM
RE: Adding to the weapon menu - by D3M0NW0LF - 29 May 14, 11:46PM
RE: Adding to the weapon menu - by MykeGregory - 31 May 14, 11:31AM
RE: Adding to the weapon menu - by Cleaner - 31 May 14, 09:23PM
RE: Adding to the weapon menu - by MykeGregory - 31 May 14, 11:22PM