LateToDOOM2020 Posted November 13, 2022 I hope this is the right place to post this I dont see many questions of mod development on here. I did some searching the last few days on learning to use ZScript but there are some things I couldn't figure out. From what I understand I should be able to have a folder with a file named zscript.zs in it and then I can load it in to doom with an argument like this -file "C:\User\LateToDoom\Documents\Mods\MyTestMod\zscript.zs" I was able to do this and load an actor that was a inherited class of the marineshotgun class through the summonfriend command so I know It worked. What I can not figure out is if there is an entry point where it can execute code the moment I load a game. I want to be able to make a mod where I can play other peoples wads but load in my own mods for fun. I did see there are Event Handlers but I did not see how they can be loaded without modifying a wad file. I even have seen the source code for another mod that adds new weapons to secret areas when the game loads but while attempting to reverse engineer it I have failed to get anything to execute. I am not Interested in modifying a wad file I would prefer if I could load in this stand alone mod and it execute. On another note similarly related I thought it may be possible to use a command like "sommonfriend MyClass" and cause it to execute a constructor where I can treat it as my entry point for running code i want but I did not see any documentation on Construtors in Zscript. Does ZScript have constructors? I Have not found a way to just load a mod and run code easily. If anyone could guide me in the right direction I would be very thankful for the help on this subject. I did look through Zdoom Wiki and other documentation but so far I have wasted time with errors in the syntax and only had code not execute. Thanks to anyone who may be able to help. 0 Quote Share this post Link to post
ramon.dexter Posted November 13, 2022 (edited) Entry point for mods? What do you mean? So, you've loaded a custom file. Mods are being loaded in similar way. There's no 'correct place' or 'entry point'. Better said, the entry point is chosen only by yourself. The theme of eventhandlers - most eventhandlers are integral part of mods, so don't worry about this. The eventhandler will not work without the rest of the mod. Maybe, if you were a liitle bit more specific with your question, I could give you more specific answer. Edited November 13, 2022 by ramon.dexter 0 Quote Share this post Link to post
LateToDOOM2020 Posted November 13, 2022 Sure My bad so I understand what you mean about event handlers being a integral part of mods but I am trying to find out if there is a way to execute code immediately upon starting a game and not wait for something to trigger it. For example so I can add random items or monsters to the map? I have seen examples where an event handler is used and WorldLoaded() is called but I have not been able to get this to execute when the game loads. I am not sure if I have to turn my zscript files in to a single mod file like a pk3 file to make it work or if I can leave it as a folder with zscript files. 0 Quote Share this post Link to post
ramon.dexter Posted November 14, 2022 If you want specific answers, you have to be more specific also. Show a code. 0 Quote Share this post Link to post
LateToDOOM2020 Posted November 14, 2022 Specific Question "I am trying to find out if there is a way to execute code immediately upon starting a game and not wait for something to trigger it. For example so I can add random items or monsters to the map?" I don't think this is going anywhere but I mean it with no disrespect what so ever Thanks for the help 0 Quote Share this post Link to post
Rifleman Posted November 14, 2022 I'd probably use events like void WorldLoaded (WorldEvent e) or void PlayerEntered (PlayerEvent e) to do that in ZScript. If you don't know it, check this ZScript guide, it may help. 1 Quote Share this post Link to post
LateToDOOM2020 Posted November 15, 2022 11 hours ago, Rifleman said: If you don't know it, check this ZScript guide, it may help. @Rifleman Thanks for the link this looks like some good documentation I missed. Do you happen to know if the events will still work if you load the zscript file directly with the argument "-file C:\path\to\zscript.zs" instead loading it from a created pk3 file? From what i read MAPINFO.txt is needed for these events so I don't know if its possible so I thought I may ask someone with some experience before wasting my time to figure it out. 0 Quote Share this post Link to post
Rifleman Posted November 15, 2022 I don't think it works like that, but I can't tell for sure - am not that experienced. Closest thing I can think of is just putting that ZS file in a WAD/PK3, just with its own MAPINFO and loading up that file along with your main one. Haven't tried this myself though. There are even some managers, where you can set the order of loading user files. Or just drag both onto gzdoom.exe. 1 Quote Share this post Link to post
ramon.dexter Posted November 15, 2022 Use the path like this: "-file C:\path\to\" and you're okay. Use the directory storing the files the same way as you would use a .wad or a .pk3. 2 Quote Share this post Link to post
LateToDOOM2020 Posted November 16, 2022 Thank you guys this is exactly what I suspect my difficulties are from. Ill just figure out how to turn the zscript in to a wad through a batch script so I can quickly be able to play around with all this fun modding. 0 Quote Share this post Link to post
ramon.dexter Posted November 16, 2022 (edited) Use slade to turn it into a wad... also, you dont need to do that, as pk3 works the same as wad, and it's only a renamed zip... Edited November 16, 2022 by ramon.dexter 1 Quote Share this post Link to post
LateToDOOM2020 Posted November 16, 2022 7 hours ago, ramon.dexter said: Use slade to turn it into a wad... also, you dont need to do that, as pk3 works the same as wad, and it's only a renamed zip... Thats cool then I can easily make pk3 files with no new tools then. Thanks! 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.