Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - detah

Pages: [1] 2
Dead Souls Support / room updates, but loads with error
« on: February 10, 2010, 12:56:17 am »
I added several functions to /lib/std/room.c. Then I wrote a brand new room using some of those functions.
/lib/std/room.c updated with no errors. /domains/default/room/arcania1.c updated with no errors also.
Then I did
goto /domains/default/room/arcania1.c
and I got the following error:

Code: [Select]
--- Arcania
*Bad type argument to +. Had string and mapping
Object: /secure/save/creators/d/detah (/lib/events/describe.c) at line 106

'<fake>' at /secure/save/creators/d/detah (/<driver>) at line 0
'cmdAll' at /secure/save/creators/d/detah (/lib/command.c) at line 210
'do_look' at /verbs/items/look at line 96
'eventDescribeEnvironment' at /secure/save/creators/d/detah (/lib/creator.c) at
line 116
'eventDescribeEnvironment' at /secure/save/creators/d/detah
(/lib/events/describe.c) at line 106
Trace written to /log/runtime

I never touched any of the player.c or creator.c code. But there seems to be an issue with /lib/events/describe.c at L106. Is that what this error message is telling me? If so here it is and I have no idea what it means.

Code: [Select]
    if( smell ) this_object()->eventPrint("%^GREEN%^" + smell, MSG_ROOMDESC);

I didn't touch that file either. It is all stock.
Any help would be appreciated.

General / AI, spells and skills
« on: February 05, 2009, 11:25:53 am »
AI/spells/skills combat design question:

Suppose you want to make an npc which always casts faerie fire on rd 2 of combat. Where/how would you implement that?

Suppose you want your npc to always attack the player who has the lowest MaxHP first. Would you build this in combat.c and make it a function AttackLowestLevelFirst() in npc.c?
How about just plain old spellcasting and skills? Do you build a giant switch like ds has? Forget about whether spellcasting or skills should be in addition to or instead of a melee attack for a moment. The question here is how would you implement the ability to cast spells or use skills during combat. I can think of several ways to implement these abilities. But surely there are advantages, disadvantages and pitfalls witrh each design. I am curious if you have discovered a way to make AI flexible, to using spells and skills in combat. What are the pros and cons of doing it that way?

Design 1 (independence)
Each skill & spell is coded in its own skill file as a command. Obvious disadvantages are that one could cast a huge number of spells and execute a large number of skills per round, governed only by command entering speed and processor time. Also, there is no ability to set or control npc AIs.

Design 2 (categorical)
Each attack type (skill, spell, melee) have their own 'slot' in the combat code. When the player casts fireball, they are just setting the switch to fireball during that round. Fireball specs are taken from the caster's traits, like magic skill and intelligence. Again, disadvantage is that no AI can be built into this. Adding a controlling front end to the switch seems like the equivalent putting second car engine into your car just to move the steering wheel.

Both design ideas clearly fail at adding AI in any kind of easy way.

I am trying to make a system which allows for modular additions of AI actions. I know how to code this stuff. I do not need technical advice. Right now I am just trying to work out a good design to allow the most flexibility for adding spells and skills.

Suggestions, comments?

General / function of armor
« on: September 15, 2008, 11:08:08 am »
Conceptually, should your worn mithril breastplate make an attacker hit more or less? Should it reduce the damage that you receive?

This is mostly a taste thing, I suppose. But I am curious what the majority are doing.


Dead Souls Support / CanMelee resolution
« on: September 05, 2008, 02:51:50 pm »
I have read thru eventExecuteAttack to eventMeleeRound to eventMeleeAttack to CanMelee. CanMelee (a misnomer if ever there was one) determines how tohit is resolved for the player and the npc.

CanMelee is broken into 2 pieces by an if-else statement.

Code: [Select]
if(!this_object()->GetMelee()) {  ...
then tohit is calculated one way.

else {} tohit is calculated a different way.

Surprisingly this function is pretty simple to read. My difficulty is that GetMelee is simply defined as
Code: [Select]
int GetMelee() return melee;
in /lib/body.c L1759.

There is also a SetMelee which is defined as
Code: [Select]
int SetMelee(int i) { melee = i; return melee; }

The weird part is that nowhere can I find where SetMelee is set for the player. So if melee is not ever set, what does GetMelee resolve to? null? 0? It is not clear to me.

Then one logic step further, what on earth does !this_object()->GetMelee mean if melee is not set/initialized?


General / efficiency of functions
« on: September 03, 2008, 01:12:47 pm »
Are one of these prefered over the other for speed reasons?

Code: [Select]
int x;
void function1() {
  write("This is sentence #1.\n");
  if(x=2) { write("This is sentence #2.\n"); }
  write("This is sentence #3.\n");
or 2)
Code: [Select]
int x;
void function1() {
  write("This is sentence #1.\n");
  if(x=2) { call_out(function2()); }
  write("This is sentence #3\n")

void function2() {
write("This is sentence #2.\n");

At first glance it seems like 1) is more efficient because it does not use the call_out fun, which takes up some resources. However, is 1) still superior when the probability of x is high? and when the amount of stuff in function2 is large?


General / Real Suits of Armor
« on: August 14, 2008, 08:17:04 am »
These are pictures I took in Altena, Germany which are housed in the ancient castle, Altena Fortress, which is now mostly a museum. I find it interesting how two of these have very asian qualities about them. The caption under many of these pieces stated that full suits of armor, like these, were only worn by the super rich and were often given as gifts. Most of them are over 100 pounds.

*Thank you to Cratylus for hosting these images.

LPMud 2.x and Amylaar / init() causes WRITE before entering room
« on: April 03, 2008, 10:08:36 am »
I am still struggling with an init() issue.

I want an NPC to react when a player brings a specific item into the room. The problem is, that all my efforts to write such a routine, cause the WRITE to execute before the player actually enters the room.

What the player sees in the room:
Boobay says: I see you have the gem of eternity with you.
Archway of Heroes.
Boobay, the superhero.

Here was my first attempt to code this. This is in the room file right after the configure() fun.
Code: [Select]
notify_enter(ob) {
x=sizeof(filter(all_inventory(this_player()),(: load_name($1)=="players/detah/heroquest/obj/gem" :)));
    if(present("boobay") && x>0) {
      write("Boobay says: I see you have the gem of eternity with you.\n");
      return 1;

Then I tried a variant on the same theme, trying to slow it down. by using the same fun with a callout with a delay of 5 seconds. It was still instantaneous when the player typed south. I tried 25 delay and got the same result.

Here is my second attempt to code this:
Code: [Select]
init() {
    if(objectp(this_player())) { /*players are objects, therefore always TRUE*/

[further down in the same room file]

menlos_check() {
    x=sizeof(filter(all_inventory(this_player()),(: load_name($1)=="players/detah/heroquest/obj/gem" :)));
    if(present("boobay") && x>0) {
      write("Boobay says: I see you have the gem of eternity with you.\n");
      return 1;
Again, same results. the WRITE occurs before the player enters the next room.
Any suggestions how to fix this?

LPMud 2.x and Amylaar / baffling 'function not found' error
« on: March 07, 2008, 10:38:02 am »
This is regarding a room in LPMUD v3.2.9-dev.438.

I have some code to let the player type 'lift slab' to lift a slab in the room. To do so, I created an addaction for lift. However, when the player types 'lift slab' it generates an error:
Code: [Select]
function lift1 not found.
program: , object: players/detah/gornak/room/hhhhh line 0
Here is the room file from the top of the file to the end of the init fun. [I do not wish to show the whole file because this area is going on a live mud shortly.]
Code: [Select]
#include <prop/room.h>
#include <worlds.h>
#include "/players/detah/defs.h"
inherit "/complex/room";

reset() {

init() {
     add_action("lift1","take"); //changed from take1
     if(notify_leave(this_player())) {
       return 1;
I have tried dozens of things to 'fix' this error. I tried changing functions around. Renaming functions. Moving ifs around. Commenting out stuff. Here is the latest incarnation of the lift1 function.
Code: [Select]
lift1(str) {
    if(!str) {
      write("Lift what?\n");
      return 1;
    if(str!="slab") {
      write("Lift what?\n");
      return 1;
    if(str=="slab") {
      if(this_player()->query_str() < XX) {  //number commented out to protect the innocent
        write("The slab does not budge. You are not strong enough to lift the "+
              "slab. Try again when you are stronger.\n");
        return 1;
      if(SLAB_LIFTED==1) {
        write("The slab is already lifted.\n");
        return 1;
      if(SLAB_LIFTED==0) {
        write("You lift the slab with ease.\n");
       return 1;
I am baffled. Anyone have a suggestion?

General / notify_enter
« on: February 18, 2008, 07:33:28 pm »
Anybody got a good man file for notify_enter?
My man file (from an old LPMUD) has
notify_enter(ob,from) as the whole syntax.
This is not helpful.

General / combat mechanics
« on: December 21, 2007, 09:44:29 am »
I know most admins will be loath to disclose their actual tohit functions or damage functions for melee combat. But perhaps a general form of the equation can be given and still provide enough information to make this an interesting discussion.

Here is what I am proposing for Arcania:
tohit=f(Dexterity, Perception, attack skill, <weapon> skill, hitroll mods from eq (to borrow from DIKU jargon), encumbrance; target's ac, Dexterity, Perception, encumbrance; status effects of attacker and target)

damage=f(Strength, weapon base damage, damroll mods, <weapon> skill, attack skill, critical hit skill; target's Constitution, Vitality, AC)

I have initialized the values of the tohit equation such that a L1 newbie player with a newbie weapon (from a newbie package) will hit a newbie monster with 0 eq and the lowest possible stats (1 DEX, 1 PER, 0% all skills) 25% of the time. Tohit progression is geometric, not linear. So if the player advances stats and skills versus the same newbie monster, they get to 100% tohit very quickly (by L19). Tohit versus monsters of similar 'level' to the player remains in the 25-75% range. There are some higher level skills which can lower that tohit in favor of the target. eg. at high skill levels of the Dodge skill, players can potentially dodge ~25% of the attacks (this is modified by DEX) and there is also the Phase skill, which some magical guild members can learn. The effects of this skill are similar to the Dodge skill.

I have weighted stats very highly in these equations. Stats are expensive to raise, and I figured there should be noticeable and valuable increases gained with those 'purchases'.

Got anything cool or different to share?

General / temporary eq enchantments
« on: October 19, 2007, 02:27:04 pm »
What are the choices for this?
Shadows or invis objects in player inventory with ctimers?
There has got to be a better way.

What about this:
base char strength is 23.
giant strength adds +7 for 150 seconds (cast on player)
bless adds +6 for 282 seconds (cast on wielded shortsword)

pfile stats
Strength = ({"23","7","150","6","282"})
ctimers tick down the 150 and 282 in the pfile.
Current strength is 23+7+6 until that 150 is greater than 0. All functions which call GetStrength until that point return 36.

So now there are no invis objects in the player's inventory and there are no shadows.

a) is this doable? I think so. and b) how expensive is this for the processor? I have no idea.

Comments please.

General / AddEnemy query versus member_array
« on: September 21, 2007, 08:43:58 am »
This question regards some combat code in Dead Souls 2.5a12.
But the real question is about good old fashioned LPC, so I put it in this section of the forum, as any LPC coder might know this.

The goal is to check if the array, Enemies, contains a particular object called target.

The current code has if(AddEnemy(target)). AddEnemy returns 1 when the obj is added to the array Enemies. Specifically

AddEnemy looks like this:
Code: [Select]
int AddEnemy(object ob) {
    if( !ob || (member_array(ob, Enemies) != -1) ) {
return 0;
    if( !living(ob) ) {
return 0;
    Enemies += ({ ob });
    return 1;

So when Enemies += ({ ob }) it returns 1.

This seems this seems like a very convoluted way to do the standard
if(member_array(ob, Enemies)!=-1)

Can anyone think of a reason why the former is prefered to the latter?


General / effective hit rate
« on: September 20, 2007, 10:54:18 am »
What is a good effective hit rate for a total newbie?

Example: a L1 total newbie with a newbie sword from a newbie package attacks a L1 monster with no eq and no enhancements of any kind. What should his/her effective hit rate be? 10%, 25%, 35%, 50%, 75%? Of course anything will work.

I am not interested in simulating reality. That is, I dont care if the effective hit rate is close to reality. I am mostly interested in making a fun game, where the player has multiple possible actions during a round. For example, they can use a simple heal spell to heal themselves of 1 or 2 pts of damage, they can drink a healing potion, or they can cast a simple spell which does 1-3 damage. By default they will do a normal melee attack with whatever weapon is wielded. I am asking about the effective hit rate for the normal melee attack.

If you make the hitrate too low like 1%, then combat will take forever even for an extremely low hp monster, with say 5 hp. For a player who does 1-3 damage with their weapon, 1% of the time, the average combat will take 350 rds. I think the player will be utterly bored by this. Likewise if you make the effective hit rate too high, you will have one or two rd combats. This may simulate an easy battle well, but it does not give the player time to 'do' anything. Nor would they have any incentive to. Then you start asking the question, has the player consumed any resources during this battle? Its highly unlikely that they bothered to heal or cast their damage spell, so no sp was used. At most they received 4 damage, and they need to wait 4 ticks to heal up to max. So both extremes of 1% and 100% effective hit rate seem unreasonable. I think everyone would agree.

A Level 1 newbie will have 0% Attack skill and 0% Sword skill. So I am wanting to leave some 'room above' for advancement in this area. That is, it seems logical to me that a player with 75% Attack and 70% Sword attacking that same L1 newbie monster should hit more frequently than the L1 newbie. So I'm leaning towards something below 75% for that reason alone.

Probably anything between 25-75% is fairgame.

So, what do you use for your mud's effective hit rate? What issues did you consider to make this determination? Did you target a specific effective hit rate, or did you just compose a ToHit function/formula and let the chips fall where they may with respect to the effective hit rate?


General / public variables
« on: September 04, 2007, 11:54:38 am »
"A public variable is available to any object down the inheritance tree from the object in which the variable is declared." /doc/manual/chapter14 (by Descartes)

So for example, the public variable Strength in /lib/race.c L38. body.c inherits race.c. So some function in body.c can call the Strength variable. Can a totally separate object, like an iron box in a room, call on that public variable? If so, can someone provide some pseudo-code as to what the syntax would look like?

Thank you

Dead Souls Support / Why aren't you in Beta?
« on: August 12, 2007, 09:57:21 pm »
Why aren't you in Beta?
Maybe you are just starting out? Maybe you lack original areas? I'm just plain curious why people are not in Beta yet. Is there one particular system, file or function that is preventing you from going Beta or going LIVE? It has been almost 1.5 years since DS was made available in a fully functional state and there are still no LIVE muds yet. I find that curious. I know precisely how much work I have before I can go LIVE. Its a fair bit still.

I was thinking that if the admin of each DS-based mud were to state their current project in this thread, then maybe we could build some partnerships so we are not each reinventing the wheel.... or at least not alone.


Pages: [1] 2