Jump to content

Mod Entry Points


Recommended Posts

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.
 

Share this post


Link to post

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 by ramon.dexter

Share this post


Link to post

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.

 

Share this post


Link to post

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

Share this post


Link to post
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.

mod.png.7efc6488f0177f0546a6c4748ae2ed8e.png
 

Share this post


Link to post

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.

Share this post


Link to post

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.
 


 

Share this post


Link to post

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 by ramon.dexter

Share this post


Link to post
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!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...