Coding Class: Dagger

From LSWiki

(Difference between revisions)
Jump to: navigation, search

Revision as of 12:02, 1 May 2008

In this initial section we are going to be an item from the ground up; in this case a dagger (everyone loves to stab). Commented code examples will appear followed by a 'notes' section below the example. Any further elaboration on that particular section I will place there, and any discussion regarding that particular section should go there as well.

// Include our base header file
#include <item.h>
// Inherit our base object for what we're creating
inherit "/std/item";
// configure() is where we define what the object -is-, and indirectly what it does.
void configure() {
    ::configure();
    weapon()->set_weapon_type(Weapon_Type_Dagger);
    set_craft(Craft_Good);
    add_description(Description_Type_Generic);
    add_proportion(([
        Element_Type       : Material_Iron,
        Element_Proportion : 1.0,
    ]));
}

Notes

Personal tools