You need 3 files (no file extensions unless added):
MAPINFO
zscript.txt
script.zs
The bare data you need in these files are as follows:
MAPINFO:
Code: Select all
GameInfo {
AddEventHandlers = "Cat"
forcetextinmenus = true
}
AddEventHandlers is a list of EventHandlers you have overwritten.
zscript.txt:
Code: Select all
version "4.0"
#include "script.zs"
You can include all ZScript files of your project in here. Make sure you place things in the order they are used.
script.zs:
Code: Select all
class Cat : EventHandler
{
Actor player;
override void WorldLoaded(WorldEvent e)
{
super.WorldLoaded(e);
self.player = players[consoleplayer].mo;
Console.Printf("%s", "Activating Mod...");
}
override void WorldThingSpawned(WorldEvent e)
{
super.WorldThingSpawned(e);
Actor npc = e.Thing;
if (!npc.bIsMonster
|| npc.IsFriend(self.player)
|| npc.GetClassName() == "Lost Soul") {
return;
}
double rand = Random(0, 1);
if (rand) {
return;
}
npc.Health *= Random(2.0, 3.0);
npc.SetDamage(npc.Damage*1.10);
}
}
Grabs the player on Map load and prints a message. Also increases health and damage of monsters roughly 50% of the time. I shaded them in at one point but could not get the monsters to look the way I wanted to. I will play with this in future. I also hate Lost Souls!
FINAL:
Create a zip file called whatever name you want, but rename it so the extension is "pk3", copy the above files to it, and drag it onto GZDoom.exe and pick a game to play.
-------------------------------------------------------------------------------------
Why post this? I spent 2 days reading the forum, watching videos and reading the wiki, and looking at other people's work before I could get a simple hello world mod working. I figured if I posted this here I can use this as a reference in future and others will have a place to start. I will hopefully follow up with a simple set of tutorials that do things, but in a way that is very simple to follow and understand.