Bo2 newsbar script5/8/2023 Custom Named Scripts Specifics #Ĭustom scripts can be organized efficiently as well.Īny script the game parses will also have its includes parsed as well as long as they are in the same folder or a subfolder of that folder. Therefore, always use ReplaceFunc() in a main() of a custom script. ReplaceFunc() MUST always be called before the function you want to replace is called otherwise it won't have any effect. You can get around this limitation by overriding the entire script by placing it in the same sub path it expects in storage/gamename/, or overriding all the functions it calls.įor example if you wanted to replace maps/mp/gametypes/_globallogic.gsc the path would be storage/T6/maps/mp/gametypes/_globallogic.gsc. A function exclusive to zombies called gamemode_callback_setup() also located in the mapname.gsc.Any main() in a script with the same name as the gametype.Any main() in a script with the same name as the map.Any functions that start with CodeCallback_.You cannot replace any function that is directly called by the engine such as: Now while I had previously stated you can replace any function using this GSC function that is not completely accurate. Now that I have thoroughly explained the basics of these two features I will go into detailing every quirk or potentially useful bit of information about ReplaceFunc() and custom name scripts. Then you can also use init() to override specific variable values and utilize other code a _clientids::init() would usually contain. So knowing this you can use main() to setup any kind of logic you want initialized before anything else the game normally runs. In fact it is roughly around the same time as _clientids::init() is called. This of course means you would need to change how your code works due to this load order right?Īctually in addition to a main() custom scripts also have an init() that the game will automatically call after the gametype logic has started. You can ReplaceFunc() any function in the main() of a custom script because custom script main(s) are always executed before any stock scripts. Therefore, custom scripts have a main() for this purpose. It is no longer necessary to override scripts such as _clientids or _development_dvars.Īdditionally, ReplaceFunc() needs to be executed before a function is executed otherwise the changes you would want to be made would never happen. In conjunction with ReplaceFunc() it is now possible to create fully custom scripts independent of stock scripts. So you may be wondering: "Why is that example code using a main() instead of an init()?" This is of course only an example of replacing a simple utility function to have a better understanding of the order of which flags might be set (which is a huge part of the logic in zombies) at some times. Now whenever a flag is set by the normal call, it instead calls our function and prints the name of the flag being set. When used in a script it would look like this: It will likely depend on the type of function you want to replace that you will need to base the new function on the one you are replacing to minimize the likelihood that there will be issues. The second argument is the function you want the game to call instead of the stock function. It can also be a function in the same script. It can be a function in any script currently loaded by the game (so map dependent scripts have to be overridden in a slightly different manner). ReplaceFunc() works like this: The first argument is the exact function you would like to replace. The primary usage would be alter a core gameplay mechanic that is controlled by GSC and the only way to do so normally is by overriding the entire script even if you only need to modify one or two functions. The concept is similar to how a function pointer works already but replaceFunc() will work on any function regardless of whether it is called as a function pointer or not. ReplaceFunc() allows a scripter to replace any script function from a stock script with their own version. This topic will outline how the currently existing GSC function called replaceFunc() added quite some time ago works, and go into detail about how custom scripts work as well. This topic will serve as a resource for those wanting to know what scripting features/improvements are available as well as those that are confirmed to be upcoming. For IW5, you should place map/gametype scripts inside a mp folder (So, scripts/mp/mp_rust/myGsc.gsc, or scripts/mp/dm/myFfaGsc.gsc) Getting Started #
0 Comments
Leave a Reply. |