Resource icon

Script [VScript] MapPlugins v3.3.0

No permission to download
- Wrapped most of the script libraries inside dedicated "VS" namespace.
- Merged cast and enum scripts into single file, utils.
- Introduce function aliases
- Renamed entity util functions and it's aliases.
- Added VS.Entity.IsNull for checking actual null instance.
- Updated and move weapondefinitions to csgo folder since it's gamemod specific.

Wrapped most of utils inside "VS" namespace to prevent future conflicts and function aliases is a good method for using shorter function names to call any of the util functions.

Also, Entity.IsNull is an important function because... In some cases, doing usual comparison operator such as (!entity), (entity != null) or (entity.IsValid()) returns the wrong value. It's because the class instance still exists but not the internal entity pointer. It's possible to delay some ticks so that the server can remove the class instance but no, it's not a feasible method in the long run.

Anyway, this is the last update of the month. I've tested it using my npc, status effect and item plugin scripts. So far, there's no problem and stable. Just pm me if you have any error that's caused by MapPlugins.
- Revised folder structures
- Revised script structures.
- Added gamemod portability support.
- Renamed example plugin script's folder name.
- Renamed demo plugin's file name.

MapPlugins can now be ported to other gamemod such as CS:S, L4D2, Garry Mod and more.
MapScripts are now known as MapPlugins.

- Changed license to GPLv3.
- Separated codes to suit the license.
- Revised folder structures
- Updated Player codes.
- Updated Schedule codes.
- Changed example to something simple, and smaller.
- Mature mapspawn stages
- Revised folder structures.
- Added round_start, begin_newmatch, round_end, player_spawned, item_pickup, and item_remove events.
- Added player data extension stage to player_spawned event.
- Remade player util codes. Calling player execute functions now loop through all players including bot for performance efficiency
- Pseudo explicit cast util.
- Schedule util.
- Math.CompareVector function.
- Pseudo enum creation util.
- Pseudo weapon definition util for mapping hammer weapon entity classname to definition index.
- Updated entity prefabs.
- Example map with status effects and item drop detection (item detection drop will print null instance error if you pick up dual elite and then the knife. Weapon strip will remove elite weapon entity if you do so. Will try entity_killed event tomorrow for fix.
- Included map source.
- Included materials, models and particles.
- Optional - Look at maps/zero_demo_1_particles.txt for particle files you need to precache for viewing status particle effects.

Don't use my status effect and item scripts for your project yet. Status effect still don't elements interaction logic and item is just a partial script since the actual code can only be continued after fixing the weapon strip bug.
Sorry about this, I'm cancelling v2.6 release due to one reason. Mapspawn stages and events for v2 are very immature. Due to that ONE reason, I faced a lot of problems when trying to develop my item and status effect scripts. I had to revise the stages, add few more event listeners, and more.

v3.0.0 will be released today for real. The mapspawn stages and events should be mature enough since I can easily develop 3 scripts with different requirements now. Example map vmf, status effects and item drop detection demo scripts will be included in the release.
I've been developing my item scripts and found out that there's more stuffs to add.
Also, weapon entity loading priority is higher than logic_script. Therefore, any global utils or global enums declared by using logic_script as proxy will not be available in the weapon entity script when it's first loaded. In order to deal with this priority loading problem, you can use model prop or physbox parented to the weapon to load any sort of configuration and setup weapon's OnPlayerPick function and output from there. They have lower loading priority than logic_script entity.

New Flow for Map Spawn Functions
OnMapStart -> OnBadPreRoundStart -> OnPreRoundStart -> OnWarmupPeriod / OnRoundStart -> OnRoundEnd -> OnBadPreRoundStart

OnBadPreRoundStart only occurs when the round was ended prematurely. An example would be "mp_restartgame".

Changelog for Incoming v2.6 Update
- Renamed and added more mapspawn functions.
- Schedule utility for calling a delayed global utility function
- Setup all players' targetname during mapspawn and player's first spawn. Performance guaranteed, using schedule to register as many players as possible. Therefore, players is only scanned when scheduled function triggered.
The scripts will be uploaded tomorrow or later.

Current Changelog

- More entity proxies. Player_Speedmod and Env_Fade.
- Entity proxies are now being setting up directly from script instead of relying on postspawn.
- Renamed "OnMapLoad" function to "OnMapStart" function.
- Added util for creating enum using array of key strings.
- Updated entity prefab

Not Implemented Yet
- Math Rotate 3D functions. Couldn't verify if the functions working properly yet.

My thought on changing proxy setup method (Ignore this if you're not interested in learning about player_speedmod's bug or potential server bug when doing any advance mapping technique)
Entity's "OnPostSpawn" function is called after Mapscripts round setup is finished. Setting up proxies during the postspawn defeats the purpose. The reason is that, some of the server-sided internal player properties don't reset after entering the new round. It's a server bug from Valve side. (All of the internal boolean flags might be affected). Proxies are needed in order to reset those properties back. Therefore, these proxies must be available when a coder requires any of them during the mapscript round setup.

A very good example would be a situation where a player's movement speed has been changed using "player_speedmod" entity with these flags enabled, surpress jump, and surpress duck. If you don't set the player's modifyspeed back to 1.0 after the current round ends, the affected player wouldn't be able to jump or duck until the modifyspeed is set back to 1.0 through entity with the same flags enabled or reconnect to the server. It's the reason why you don't really see player_speedmod with any surpress flags enabled in any map with speedmod. Resetting these properties back using only hammer editor is not possible. Especially when a player's internal properties has been changed using multiple speedmods with different flags enabled.

It's the reason why player_speedmod and some other entities are not available in default csgo fgd. It's buggy as hell.

Single player fade in wouldn't work due to a bug existing in current envfade code. Need to untick "triggering player" flag to remove the active fade out.
I'm not gonna change the fade in proxy flag until valve fix it or opt for SM plugin.
Issue link :
- Added Random.Float, Random.FloatRange, Random.GeneratePointWithinRectangle, Random.GeneratePointWithinSquare and Random.GeneratePointWithinCircle. (mapscripts/framework/util/random.nut)
- Added Point class for random util usage. (mapscripts/framework/classes/point.nut)
- Fixed shufflebag bug where the array is actually a global variable instead of member variable.

CSGO already provided randomint and randomfloat utils but please forgive me for reinventing the wheel.
Those provided functions are not overloaded like what stated in the dev's wiki. I had to reinvent so that I know how to implicitly cast integer value to float value. It's damn important since there's no proper documentation and no explicit cast available. Also, I recently noticed that there's a huge bug with class instance after I tried spawning multiple npcs using my script. The skill pattern shufflebag didn't start from an empty array. It's caused by declaring member variable to an empty array. This bug makes the variable act as global variable. Table might be included but I'm not gonna waste time to verify it. In order to fix the bug, I had to declare the member variable as null and initialize the variable as empty array in constructor.
- Updated Math.WithinAngle for simpler calculations.

I was in a bad shape when I coded the previous version. The new code is faster.
- Updated Math.WithinAngle. It should be 100% accurate now.
- Added some more entity utils.
- Added Random Util. Only random integer is supported for now.
- Added ShuffleBag class definition.
- Ported damage Utils from Raid Scripts
- Added prop Utils.
- Added hudhint create utils