Author Topic: LIB_SENTIENT  (Read 3082 times)

Offline shadyman

  • Friend
  • **
  • Posts: 50
    • View Profile
LIB_SENTIENT
« on: November 10, 2007, 07:37:37 pm »
As far as SetCommandResponse, SetEmoteResponse, etc go, it'd be nice if we could make the NPCs not only say, but do actions in response.

I don't have the code in front of me, but does anyone have any ideas?

Offline daelaskai

  • BFF
  • ***
  • Posts: 174
    • View Profile
Re: LIB_SENTIENT
« Reply #1 on: November 10, 2007, 08:16:47 pm »
If I recall correctly, you can have them do actions.  All you would need to do is something like this:

Code: [Select]
    SetEmoteResponses( ([
        "smile": (: do_function :),
    ]) );

Afterward, you just need to make the do_function() or whatever you wish them to do.

Daelas

Offline petriomelony

  • Acquaintance
  • *
  • Posts: 34
    • View Profile
Re: LIB_SENTIENT
« Reply #2 on: November 12, 2007, 09:50:27 am »
is there a way to set a talk response that works off "say" as opposed to "ask <mob>"?

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1024
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
Re: LIB_SENTIENT
« Reply #3 on: November 12, 2007, 04:03:01 pm »
Quote
is there a way to set a talk response that works off "say" as opposed to "ask <mob>"?

That is exactly how talk responses work. It is command responses that key on "ask".

http://dead-souls.net/doc/manual/chapter26

-Crat

Offline petriomelony

  • Acquaintance
  • *
  • Posts: 34
    • View Profile
Re: LIB_SENTIENT
« Reply #4 on: November 12, 2007, 07:51:44 pm »
well, Crat:

i did read the sentient thing, no worries, and i programmed a sentient.  but here's what i want (perhaps my question was not clear):

right now, i can do this:
Code: [Select]
ask ollivader what's a wand?
You ask, "Ollivader what's a wand?"
Ollivander asks in English, "Do you want me to explain wands?"
but i can't do this:
Code: [Select]
say what's a wand?
You ask in Common, "What's a wand?"
** nothing happens**

... and i totally just realized my mistake!! wow.  ok, i thought "ask ollivander" was a part of the syntax, when it was really just "ask" that triggers the talk response! gah

is there a way to make it work with say as well?  because saying with a question transforms to asking, but yet it doesn't trigger a response.

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1024
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
Re: LIB_SENTIENT
« Reply #5 on: November 12, 2007, 08:26:59 pm »
Code: [Select]
#include <lib.h>

inherit LIB_SENTIENT;

static void create() {
    sentient::create();
    SetKeyName("zafo");
    SetId(({"dude"}));
    SetAdjectives(({"punk rock", "punkrock", "rock", "cool"}));
    SetShort("Zafo");
    SetLong("Zafo is a cool dude, and totally punk rock.");
    SetLevel(1);
    SetRace("human");
    SetClass("fighter");
    SetGender("male");
    SetInventory( ([
        "/domains/town/armor/jacket" : "wear jacket",
        "/domains/town/armor/pants" : "wear pants",
        "/domains/town/armor/boot_l" : "wear left boot",
        "/domains/town/armor/boot_r" : "wear right boot",
    ]) );
    SetTalkResponses( ([
        "s up" : "Nothin'.",
        "re you rebelling against" : "Waddaya got?",
    ]) );
}
void init(){
    sentient::init();
}

Quote
update zafo
/domains/town/npc/zafo: Ok
Dead Souls Omega /domains/town/npc >
clone zafo
Zafo wears leather pants.
Zafo wears a black leather jacket.
Zafo wears a black leather boot.
Zafo wears a black leather boot.
You clone Zafo ( /domains/town/npc/zafo.c ).
Dead Souls Omega /domains/town/npc >
'what're you rebelling against?
You ask in Common, "What're you rebelling against?"
Zafo asks in English, "Waddaya got?"

As you can see it works ok. You'll notice, though, that
Zafo speaks English and I speak Common. Since Zafo
is level 1 (a newbie) he can understand me. When I
set his level above MAX_NEWBIE_LEVEL, though, he
hears what I say as gibberish, because he doesn't grok
Common. That is probably what is happening in your case.

Quote
bk zafo
Copied: /domains/town/npc/zafo.c to /realms/cratylus/bak/zafo.c.1194920581
Dead Souls Omega /domains/town/npc >
modify zafo level 10
Indenting file...
"/tmp/indent.1194920589.tmp.dat" 29 lines 782 bytes
Exit from ed.

Done.
Indenting file...
"/tmp/indent.1194920589.tmp.dat" 29 lines 783 bytes
Exit from ed.

Zafo wears leather pants.
Zafo wears a black leather jacket.
Zafo wears a black leather boot.
Zafo wears a black leather boot.
Done.
Dead Souls Omega /domains/town/npc >
'what're you rebelling against?
You ask in Common, "What're you rebelling against?"
Dead Souls Omega /domains/town/npc >

If that's what you're running into, then just add this
to your NPC's create() function:

Quote
SetPolyglot(1);

And that'll fix him right up.

Sadly that's not a QCS option yet, you'll have to
add it with an editor, but I'll add it for a future release.

-Crat

Offline petriomelony

  • Acquaintance
  • *
  • Posts: 34
    • View Profile
Re: LIB_SENTIENT
« Reply #6 on: November 13, 2007, 08:04:13 am »
ahh, interesting!  the mud i usually play on only has one language (generally speaking) so it never even crossed my mind that it might be that, wow

yes, i've mostly been using a manual editor as opposed to the QCS anyways :) i think i might just set english only and then be done with it.  thanks a lot, Crat :)