Adding a new hide type skill

Posted by Dralnu on Thu 28 Apr 2005 02:58 AM — 8 posts, 29,202 views.

USA #0
Looking to add a new skill similar to hide, and just want to make sure of what I'm doing.

Basically I can copy hide, change the flags, then add the flag to the do_visible. Anywhere else I would need to alter something so everything would work right?

Also I'd like to make it where onyl one class can detect people using the skill, so would I need to add to a detect skill something like:

if (is_npc( ch)&&(is_ranger)

ect. so that only rangers could see it?
USA #1
I don't like doing things for people.. so i'll just tell you the primary parts of what you want to do:


Copy the hide like you said.. rename it.. give it it's own AFF(such as how hide has AFF_HIDE) than in handler.c, after this in can_see:

if (!IS_AFFECTED(ch, AFF_TRUESIGHT)
{
blah
blah
blah
}
if (IS_AFFECTED(victim, AFF_YOURSKILL) && ch->class != CLASS_SOMECLASS)return FALSE;



This is basically all you'll need.. I didn't look at the code during this so it may not be exact, but you should get the idea. Try it and see if it works .. if not .. than me or someone else can give more detail
USA #2
Thanks. I don't want someone to do things for me, I'm happy with a general overview since I'm about as new to coding as you can get. I think I can get it working though, as I mostly needed to know if I was right or not.

Also, some help would be nice as to which .c files do what. I know player.c is mostly player info, mud.c is the general code for the rest, and a few others, unless their is a helpfile I have missed along the line (which may be the case)
USA #3
Hmm mine is kinda a jumble.. but:


mud.h is defines.. such as structures(CHAR_DATA etc.) and where #define is mostly used, along with commonly used function declarations. You also define your new commands here(DECLARE_DO_FUN(do_sit) etc.)

act_obj.c is things like drop, take sacrifice

Deity.c is just about everything relating to deities

act_wiz.c is immortal stuff.

db.c is basically any loading/database stuff

fight.c well... duh :-p

skills.c is... skills

magic.c is spells

handler.c is where most of the functions like get_class, can_see, etc. are kept.

const.c is where most of the in-file names for stuff is

tables.c is where the tables are kept, class_table, race_table and also skill/spell/command listings.

Most of the files are self-explanitory in what they do, especially if you go into them and read the big comment at the top.

For what you're doing you'll want these:
mud.h
handler.c
skills.c


If you need anything else just ask
USA #4
I'm looking throug handler.c for the TRUE_SIGHT bit, and getting nada. I got the skill added to the system, but finding the TRUE_SIGHT bit is a bit rough, and as for mud.h, like I said, I'm almost clueless...
USA #5
Near line 2719 in handler.c, there is alot about if a char can see you, and mentions hide/invis alot. That is what i need to alter, right?



/*
* True if char can see victim.
*/
bool can_see( CHAR_DATA * ch, CHAR_DATA * victim )
{
if( !victim ) /* Gorog - panicked attempt to stop crashes */
return FALSE;
if( !ch )
{
if( IS_AFFECTED( victim, AFF_INVISIBLE ) || IS_AFFECTED( victim, AFF_HIDE ) || xIS_SET( victim->act, PLR_WIZINVIS ) )
return FALSE;
else
return TRUE;
}

if( ch == victim )
return TRUE;

if( !IS_NPC( victim ) && xIS_SET( victim->act, PLR_WIZINVIS ) && get_trust( ch ) < victim->pcdata->wizinvis )
return FALSE;

/*
* SB
*/
if( IS_NPC( victim ) && xIS_SET( victim->act, ACT_MOBINVIS ) && get_trust( ch ) < victim->mobinvis )
return FALSE;

/* Deadlies link-dead over 2 ticks aren't seen by mortals -- Blodkai */
if( !IS_IMMORTAL( ch ) && !IS_NPC( ch ) && !IS_NPC( victim ) && IS_PKILL( victim ) && victim->timer > 1 && !victim->desc )
return FALSE;

if( !IS_NPC( ch ) && xIS_SET( ch->act, PLR_HOLYLIGHT ) )
return TRUE;

/*
* The miracle cure for blindness? -- Altrag
*/
if( !IS_AFFECTED( ch, AFF_TRUESIGHT ) )
{
if( IS_AFFECTED( ch, AFF_BLIND ) )
return FALSE;

if( room_is_dark( ch->in_room ) && !IS_AFFECTED( ch, AFF_INFRARED ) )
return FALSE;

if( IS_AFFECTED( victim, AFF_INVISIBLE ) && !IS_AFFECTED( ch, AFF_DETECT_INVIS ) )
return FALSE;

if( IS_AFFECTED( victim, AFF_HIDE )
&& !IS_AFFECTED( ch, AFF_DETECT_HIDDEN )
&& !victim->fighting && ( IS_NPC( ch ) ? !IS_NPC( victim ) : IS_NPC( victim ) ) )
return FALSE;
}

/*
* Redone by Narn to let newbie council members see pre-auths.
*/
if( NOT_AUTHED( victim ) )
{
if( NOT_AUTHED( ch ) || IS_IMMORTAL( ch ) || IS_NPC( ch ) )
return TRUE;

if( ch->pcdata->council && !str_cmp( ch->pcdata->council->name, "Newbie Council" ) )
return TRUE;

return FALSE;
}

/* Commented out for who list purposes
if (!NOT_AUTHED(victim) && NOT_AUTHED(ch) && !IS_IMMORTAL(victim)
&& !IS_NPC(victim))
return FALSE;*/
return TRUE;
}


I need to add

if (IS_AFFECTED(victim, AFF_CAMOUFLAGE) && ch->class != CLASS_RANGER)return FALSE;

and I need to add the
||IS_AFFECTED( victim, AFF_CAMOFLAUGE) in along with the invis/hide/wininvis

in line 10 in the above code, right? Sorry for all the questions btw, just want to make sure I understand this so that later I understand exactly what I am doing.
USA #6
Ok, added everything in, started to make
I got through a bunch of issues, mainly undeclared problems by hunting back through mud.h, handler.c, and skills.c, but now I'm into skills.c and keep getting an undeclared problem. using crtl-f and the equating HIDE setting, I cann't find the original issue with the undeclared problem. They both happen in do_camouflage and do_visible, and I'm pretty sure I've gotten everything fixed in mud.h and handler...
Edit: Turned out to be a typo. Silly me. Now I'm gettin:
undefinced referenced in:
affect_modify in handler.o (_gsn_camouflage)
do_camouflage in skills.o (same thing)
then there are a bunch of other odd things, but mostly just undeclared refrences. Help?
Amended on Fri 29 Apr 2005 09:33 PM by Dralnu
USA #7
Hmm you got any messengers? This makes it "difficult" to talk well :-p to me atleast lol