Author Topic: eventForce  (Read 3184 times)

Offline capo

  • Friend
  • **
  • Posts: 70
    • View Profile
eventForce
« on: September 18, 2006, 08:34:13 AM »
code:


#include <lib.h>

inherit LIB_LEADER;
inherit LIB_SENTIENT;

int JoinGuild(object ob, string verb, string what);

static void create() {
    sentient::create();
    SetKeyName("thief");
    SetId( ({"thief", "man", "shadowy", "shadow", "figure", "shadowy figure"}) );
    SetAdjectives(({"non-player", "non player"}));
    SetShort("A shadowy figure");
    SetLong("    This npc is a test-guard npc setting the default settings for someone who joins a guild.  This can be done with either an npc or an invisible/visible object.  $
    SetLevel(1);
    SetMelee(1);
    SetRace("human");
    SetGender("male");
    SetCommandResponses( ([ "join": (: JoinGuild :), ]) );

}

int JoinGuild(object ob, string verb, string what)
    {
    if(ob->GetClass() == "thief")
           {
        eventForce("say You are already a member of the guild.");
        return 1;
           }

    if(ob->GetClass() == "explorer" || !ob->GetClass())
           {
        eventForce("say very well, "+ob->GetName()+".");
        eventForce("say Welcome to the guild!");
        ob->ChangeClass("thief");
        ob->AddChannel("thief");
        ob->eventForce("say hi");
        return 1;
           }
        eventForce("say I'm sorry, it looks to me like you have already chosen your guild.");
        return 1;
     }

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


Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1020
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
eventForce
« Reply #1 on: September 18, 2006, 08:44:32 AM »

I had to fix the SetLong, but aside from that, this worked

fine for me.



I suspect your modifications to lib files are

undermining your work on your area.





> update thief

/realms/cratylus/area/npc/thief: Ok

> ls

/realms/cratylus/area/npc/:

 1   fighter.c   *001 thief.c                                      





> clone thief

You clone A shadowy figure (/realms/cratylus/area/npc/thief.c).

> ls

/realms/cratylus/area/npc/:

 1   fighter.c   *001 thief.c                                      





> ask thief to join

You ask Thief to join.

Thief says in English, "Very well, Cratylus."

Thief exclaims in English, "Welcome to the guild!"



Offline capo

  • Friend
  • **
  • Posts: 70
    • View Profile
eventForce
« Reply #2 on: September 18, 2006, 08:46:31 AM »
Crat, that part works perfectly for me as well.  The problem was the eventforce that was supposed to make the player broadcast on the guildchannel.

Offline tigwyk

  • Acquaintance
  • *
  • Posts: 45
    • View Profile
eventForce
« Reply #3 on: September 18, 2006, 01:22:48 PM »

Ah well, your code is wrong then, silly.



Use ob->eventForce("thief hi");



Tada!


Offline capo

  • Friend
  • **
  • Posts: 70
    • View Profile
eventForce
« Reply #4 on: September 18, 2006, 02:19:47 PM »
According to Crat that is blocked.

Offline tigwyk

  • Acquaintance
  • *
  • Posts: 45
    • View Profile
eventForce
« Reply #5 on: September 18, 2006, 04:03:48 PM »
Ah, well then... I have no solution. :P

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1020
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
eventForce
« Reply #6 on: September 18, 2006, 04:06:58 PM »

Capo...I thought you found a solution in CHAT_D?



Did I misunderstand?



Offline capo

  • Friend
  • **
  • Posts: 70
    • View Profile
eventForce
« Reply #7 on: September 18, 2006, 05:02:43 PM »
I did!

Offline Atomic

  • BFF
  • ***
  • Posts: 115
  • To infinity and beyond!
    • View Profile
eventForce
« Reply #8 on: September 20, 2006, 03:48:45 PM »
so shoot with it!  :P




.: To infinity and beyond! :.
Always remember that the early bird gets the worm first, but the fi...*SNAP*...second mouse gets the cheese.