Author Topic: Newbee problem  (Read 1822 times)

Offline gruad

  • Acquaintance
  • *
  • Posts: 0
    • View Profile
Newbee problem
« on: October 24, 2006, 05:39:44 PM »

Greetings to you,



today I tried to code my first thing, I tried to create a 'glowing sword'



here it is:



#include <lib.h>

#include <damage_types.h>

#include <vendor_types.h>



inherit LIB_ITEM;



static void create() {

    item::create();

    SetKeyName("sword");

    SetId( ({ "weapon"}));

    SetAdjectives( ({ "generic" }));

    SetShort("an old rune-covered sword");

    SetLong("You look at an old sword, forged long time ago. Strange runes, written in an unknown language cover the blade.");

    SetMass(50);

    SetVendorType(VT_WEAPON);

    SetClass(30);

    SetDamageType(BLADE);

    SetWeaponType("blade");

    SetRadiantLight(20);



}



int EquipMessage() {write("As you touch the hilt of the sword it begins to shine brightly.");

                    say(possessive(this_player())+" sword begins to glow as they grasp the hilt!");



   return 1;

}  



void init(){

    ::init();

}





.. but somehow it won't work, maybe you can help me. :-$


Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1020
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
Newbee problem
« Reply #1 on: October 24, 2006, 05:43:56 PM »
Try this.

You forgot to add the SetWield function.

code:
#include <lib.h>
#include <damage_types.h>
#include <vendor_types.h>

int EquipMessage();

inherit LIB_ITEM;

static void create() {
item::create();
SetKeyName("sword");
SetId( ({ "weapon"}));
SetAdjectives( ({ "generic" }));
SetShort("an old rune-covered sword");
SetLong("You look at an old sword, forged long time ago. Strange runes, written in an unknown language cover the blade.");
SetMass(50);
SetVendorType(VT_WEAPON);
SetClass(30);
SetDamageType(BLADE);
SetWeaponType("blade");
SetRadiantLight(20);
SetWield( (: EquipMessage :) );
}

int EquipMessage() {write("As you touch the hilt of the sword it begins to shine brightly.");
say(possessive(this_player())+" sword begins to glow as they grasp the hilt!");

return 1;
}

void init(){
::init();
}


Offline daelaskai

  • BFF
  • ***
  • Posts: 174
    • View Profile
Newbee problem
« Reply #2 on: October 24, 2006, 05:43:59 PM »
Try this:



code:

#include <lib.h>
#include <damage_types.h>
#include <vendor_types.h>

inherit LIB_ITEM;

static void create() {
item::create();
SetKeyName("sword");
SetId( ({ "weapon"}));
SetAdjectives( ({ "generic" }));
SetShort("an old rune-covered sword");
SetLong("You look at an old sword, forged long time ago. Strange runes, written in an unknown language cover the blade.");
SetMass(50);
SetVendorType(VT_WEAPON);
SetClass(30);
SetDamageType(BLADE);
SetWeaponType("blade");
SetRadiantLight(20);
SetWield( (: EquipMessage :) );

}

int EquipMessage() {write("As you touch the hilt of the sword it begins to shine brightly.");
say(possessive(this_player())+" sword begins to glow as they grasp the hilt!");

return 1;
}

void init(){
::init();
}





P.S. I'm too slow :(

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1020
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
Newbee problem
« Reply #3 on: October 24, 2006, 05:44:48 PM »
Hah! Beatyou!

Offline gruad

  • Acquaintance
  • *
  • Posts: 0
    • View Profile
Newbee problem
« Reply #4 on: October 24, 2006, 05:54:49 PM »
thank you guys :>