[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Changing skills to commands

Changing skills to commands

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Toy   (206 posts)  [Biography] bio
Date Sun 19 May 2002 04:41 PM (UTC)
Message
Could someone help me? I'm trying to figure out how to change skills into commands, such as Scan and Search. I'd like for my players to be able to use the abilities without having to practice/train them.
-Alexander

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
[Go to top] top

Posted by Neves   USA  (78 posts)  [Biography] bio
Date Reply #1 on Fri 24 May 2002 04:16 AM (UTC)
Message
I never actually saw how these skills work, but probably you would want to add something like void do_search, then in it make when a player types to search it does the same thing the skill would have done, then in tables.c add the appropriate entries for do_search.

-Jay
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Fri 24 May 2002 05:37 AM (UTC)
Message
Or, simply take the skills in question and give the player full ability to use it without having to train first.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Toy   (206 posts)  [Biography] bio
Date Reply #3 on Sat 25 May 2002 12:23 AM (UTC)
Message
void do_search( CHAR_DATA *ch, char *argument )
{
char arg [MAX_INPUT_LENGTH];
OBJ_DATA *obj;
OBJ_DATA *container;
OBJ_DATA *startobj;
int percent, door;

door = -1;
switch( ch->substate )
{
default:
if ( IS_NPC(ch) && IS_AFFECTED( ch, AFF_CHARM ) )
{
send_to_char( "You can't concentrate enough for that.\n\r", ch );
return;
}
if ( ch->mount )
{
send_to_char( "You can't do that while mounted.\n\r", ch );
return;
}
argument = one_argument( argument, arg );
if ( arg[0] != '\0' && (door = get_door( arg )) == -1 )
{
container = get_obj_here( ch, arg );
if ( !container )
{
send_to_char( "You can't find that here.\n\r", ch );
return;
}
if ( container->item_type != ITEM_CONTAINER )
{
send_to_char( "You can't search in that!\n\r", ch );
return;
}
if ( IS_SET(container->value[1], CONT_CLOSED) )
{
send_to_char( "It is closed.\n\r", ch );
return;
}
}
add_timer( ch, TIMER_DO_FUN, UMIN(skill_table[gsn_search]->beats / 10, 3),
do_search, 1 );
send_to_char( "You begin your search...\n\r", ch );
ch->alloc_ptr = str_dup( arg );
return;

case 1:
if ( !ch->alloc_ptr )
{
send_to_char( "Your search was interrupted!\n\r", ch );
bug( "do_search: alloc_ptr NULL", 0 );
return;
}
strcpy( arg, ch->alloc_ptr );
DISPOSE( ch->alloc_ptr );
break;
case SUB_TIMER_DO_ABORT:
DISPOSE( ch->alloc_ptr );
ch->substate = SUB_NONE;
send_to_char( "You stop your search...\n\r", ch );
return;
}
ch->substate = SUB_NONE;
if ( arg[0] == '\0' )
startobj = ch->in_room->first_content;
else
{
if ( (door = get_door( arg )) != -1 )
startobj = NULL;
else
{
container = get_obj_here( ch, arg );
if ( !container )
{
send_to_char( "You can't find that here.\n\r", ch );
return;
}
startobj = container->first_content;
}
}

if ( (!startobj && door == -1) || IS_NPC(ch) )
{
send_to_char( "You find nothing.\n\r", ch );
learn_from_failure( ch, gsn_search );
return;
}

percent = number_percent( ) + number_percent( ) - ( ch->level / 10 );

if ( door != -1 )
{
EXIT_DATA *pexit;

if ( (pexit = get_exit( ch->in_room, door )) != NULL
&& IS_SET( pexit->exit_info, EX_SECRET )
&& IS_SET( pexit->exit_info, EX_xSEARCHABLE )
&& can_use_skill( ch, percent, gsn_search ) )
{
act( AT_SKILL, "Your search reveals the $d!", ch, NULL, pexit->keyword, TO_CHAR );
act( AT_SKILL, "$n finds the $d!", ch, NULL, pexit->keyword, TO_ROOM );
REMOVE_BIT( pexit->exit_info, EX_SECRET );
learn_from_success( ch, gsn_search );
return;
}
}
else
for ( obj = startobj; obj; obj = obj->next_content )
{
if ( IS_OBJ_STAT( obj, ITEM_HIDDEN )
&& can_use_skill(ch, percent, gsn_search ) )
{
separate_obj(obj);
xREMOVE_BIT( obj->extra_flags, ITEM_HIDDEN );
act( AT_SKILL, "Your search reveals $p!", ch, obj, NULL, TO_CHAR );
act( AT_SKILL, "$n finds $p!", ch, obj, NULL, TO_ROOM );
learn_from_success( ch, gsn_search );
return;
}
}

send_to_char( "You find nothing.\n\r", ch );
learn_from_failure( ch, gsn_search );
return;
}
This is the "search" skill. What would I have to change in it give the player full ability to use it without trains? I know, you're saying to yourself "This guy has no idea what's he's doing." Well, you're right. I just need someone to point me in the right direction. :)
-Alexander

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
[Go to top] top

Posted by AlaricX   (23 posts)  [Biography] bio
Date Reply #4 on Sat 25 May 2002 01:17 AM (UTC)
Message
Ok, you might be able to get off bu using these commands in the game itself
cedit <skill> create
cedit savecmdtable
and somethign sset to delete the skill, you'd ahve to ask nick about that one.. heh heh heh... that should fix it all up.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Sat 25 May 2002 02:11 AM (UTC)
Message
It is not a case of fixing do_search, you need to make the skill learnt. I suggest taking this code from comm.c, which teaches each new player the "common" language, and adapt it to the skills in question.


        if ( (iLang = skill_lookup( "common" )) < 0 )
            bug( "Nanny: cannot find common language." );
        else
            ch->pcdata->learned[iLang] = 100;


Replace "common" with your skill and you should have it. If you put it in the nanny routine each new player will get the skill, and you can always "sset" existing players.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Toy   (206 posts)  [Biography] bio
Date Reply #6 on Sun 26 May 2002 03:31 AM (UTC)
Message
Well, I added the skills to nanny like such:
if ( (iLang = skill_lookup( "scan" )) < 0 )
bug( "Nanny: cannot find scan." );
else
ch->pcdata->learned[iLang] = 100
worked like a charm, with the exception that everytime I boot the mud, it gives me bug messages. But I can live with that. thanks for the help Nick.
-Alexander

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
[Go to top] top

Posted by Neves   USA  (78 posts)  [Biography] bio
Date Reply #7 on Wed 29 May 2002 01:38 AM (UTC)
Message
Can't he just edit commands.dat to have a search command for level 0? Although he would have to modify the timer part since that factors in skill level.

-Jay
[Go to top] top

Posted by Toy   (206 posts)  [Biography] bio
Date Reply #8 on Thu 30 May 2002 11:06 PM (UTC)
Message
OK... so it didn't work like I thought it would. New players that log on have the effect from Nanny, but if they save and quit, and reconnect, they lose all use of the skill. Any ideas?

Alexander the Frustrated.

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Fri 31 May 2002 01:42 AM (UTC)
Message
Sounds like it isn't saving for some reason. Don't know why.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


22,642 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]