Tutorials - vagos/gauzarbeit GitHub Wiki

Creating New Things

Everything in Gauzarbeit, from a piece of equipment to an NPC is a "Thing". This way, you have a unified way of creating new content. That means that you are never restricted with what your new item can do. You could have a chair that can also attack the player!

So, let's make a chair that will bite anyone that tries to sit on it.

EvilChair.lua

-- doInit runs when the Thing is created
function EvilChair:doInit() 
    self:setMaxHealth(20)
    self.setAttack(10)
end

-- onUse runs when someone interacts with the Thing. 
function EvilChair:onUse(user) 
    user:sendMessage("You try to sit on the chair...\n")
    self:doAttack(user)
    user:sendMessage("The chair goes back to sitting still...\n")
end

-- onInspect runs when a Player inspects the Thing. 
-- Returns a description of the Thign.
function EvilChair:onInspect(inspector)     
    return "You notice the chair moving slightly.\n"
end

Creating New Rooms

A room is basically a square on the map grid. Inside it can be Players and Things. A room can either be an important landmark where important NPCs reside or just a regular part of the map like a forest area. Let's create a simple kitchen room.

Kitchen.lua

-- This function will run once when the Room is created.
function Kitchen:doInit()
    Gauzarbeit.Spawn(self, "WanderingCook") 
    
    -- Here, you could spawn other Things or 
    -- initialise neighbouring rooms.
end

WanderingCook.lua

-- This is in case we want to change the name of our "Thing" later.
Thing = WanderingCook 

-- This will run when a player talks to this NPC.
function Thing:onTalk(talker) 

    self:doSay(talker, "Looking to cook, eh?\n")

end

Creating New Quests

Quests in Gauzarbeit are also Things, however they get a seperate section because they require some extra attention.

Let's create a quest that will require that our player kills 5 Rats and grab a piece of cheese from the floor.

TODO