Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Err automoving kind of

Err automoving kind of

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


Posted by Gtr   (38 posts)  Bio
Date Thu 22 Jul 2004 06:36 PM (UTC)
Message
Hey guys..well I got past for the most part my last project totaling...to over 2k lines of code..that may not be alot..but it's alot for me heh. Now I'm working on somthing else...hoping some of you might have some ideas on it. I want there to be a type of automated moving..like the player type dash n and they continue to run north till they hit a wall or somthing. I'm not sure how exactly to start this, and to have it so maby they move faster depending on dex? Any ideas would be much appreciated.
Top

Posted by Txzeenath   USA  (54 posts)  Bio
Date Reply #1 on Thu 22 Jul 2004 08:03 PM (UTC)
Message
To find things like going in all one direction, check the scan command.. it should have what you need, just need to adjust it a bit.

I was bored.. so I did most of it.. you need to create a skill called dash, with code do_dash.


void do_dash( CHAR_DATA *ch, char *argument )
{
ROOM_INDEX_DATA *was_in_room;
EXIT_DATA *pexit;
sh_int dir = -1;
sh_int dist;
sh_int max_dist = 100;

set_char_color( AT_ACTION, ch );

if ( IS_AFFECTED( ch, AFF_BLIND ) )
{
send_to_char( "Not very effective when you're blind...\n\r", ch );
return;
}
if ( ( dir = get_door( argument ) ) == -1 )
{
send_to_char( "dash in WHAT direction?\n\r", ch );
return;
}

was_in_room = ch->in_room;
act( AT_GREY, "Dashing $t...", ch, dir_name[dir], NULL, TO_CHAR );
act( AT_GREY, "$n dashs $t.", ch, dir_name[dir], NULL, TO_ROOM );

if ( !can_use_skill(ch, number_percent(), gsn_dash ) )
{
act( AT_GREY, "You stop dashing $t as your legs fall from under you.", ch,
dir_name[dir], NULL, TO_CHAR );
learn_from_failure( ch, gsn_dash );
return;
}

if ( IS_VAMPIRE( ch ) )
{
if ( time_info.hour < 21 && time_info.hour > 5 )
{
send_to_char( "You trip in fall, blinded by all the "
"light.\n\r", ch );
max_dist = 20;
}
}

if ( ( pexit = get_exit( ch->in_room, dir ) ) == NULL )
{
act( AT_GREY, "You can't dash $t.", ch, dir_name[dir], NULL, TO_CHAR );
return;
}

if ( ch->perm_dex < 20 ) --max_dist;
if ( ch->perm_dex < 15 ) --max_dist;
if ( ch->perm_dex < 10 ) --max_dist;

for ( dist = 1; dist <= max_dist; )
{
if ( IS_SET(pexit->exit_info, EX_CLOSED) )
{
if ( IS_SET(pexit->exit_info, EX_SECRET)
|| IS_SET(pexit->exit_info, EX_DIG) )
act( AT_GREY, "Your dash $t is blocked by a wall. **SMACK**", ch,
dir_name[dir], NULL, TO_CHAR );
else
act( AT_GREY, "Your dash $t is blocked by a door. **WHACK**", ch,
dir_name[dir], NULL, TO_CHAR );
break;
}
if ( room_is_private( pexit->to_room )
&& ch->level < LEVEL_GREATER )
{
act( AT_GREY, "Your dash $t is blocked by a private room.", ch,
dir_name[dir], NULL, TO_CHAR );
break;
}
char_from_room( ch );
char_to_room( ch, pexit->to_room );
set_char_color( AT_RMNAME, ch );
do_look(ch, "")
send_to_char( "\n\r", ch );

switch( ch->in_room->sector_type )
{
default: dist++; break;
case SECT_AIR:
if ( number_percent() < 80 ) dist++; break;
case SECT_INSIDE:
case SECT_FIELD:
case SECT_UNDERGROUND:
dist++; break;
case SECT_FOREST:
case SECT_CITY:
case SECT_DESERT:
case SECT_HILLS:
dist += 2; break;
case SECT_WATER_SWIM:
case SECT_WATER_NOSWIM:
dist += 3; break;
case SECT_MOUNTAIN:
case SECT_UNDERWATER:
case SECT_OCEANFLOOR:
dist += 4; break;
}

if ( dist >= max_dist )
{
act( AT_GREY, "Your legs grow weak as you can no longer run any "
"farther $t.", ch, dir_name[dir], NULL, TO_CHAR );
break;
}
if ( ( pexit = get_exit( ch->in_room, dir ) ) == NULL )
{
act( AT_GREY, "Your dash $t is blocked by a wall **WHAM**.", ch,
dir_name[dir], NULL, TO_CHAR );
break;
}
}

char_from_room( ch );
learn_from_success( ch, gsn_dash );

return;
}

Darkness comes along thy path, searching, wanting, calling wrath,
shadows awaken, release the light, one and only.. here to fight,
challenge the darkness, the shadows they call, hunting the living,
more and all. Roaring thunder, full of hate, a single bound, seals
your fate.

-Txzeenath

telnet://divineright.org:8088
Alumuble Arda -
*Player owned shops, clans, and housing
*Multiclass & Stat training
*Random mob name generation implemented and Overland mapping.
*Realistic equipment statistics
*Interactive enviroment(weather/sectors)
*Weapon sheaths(scabbards), Throwing weapons
*Automatic crash recovery, saving, and reporting without disconnecting
*Fully customizeable color, Automapper, "Smart" mobiles, Hiscore tables, and more!

Currently running AGE v1.9.6(Originated and modified from Smaug 1.4a)
Top

Posted by Gtr   (38 posts)  Bio
Date Reply #2 on Thu 22 Jul 2004 10:26 PM (UTC)
Message
Thanks! I was stuck on the actual moving part, I had in my mind kind of a forcing the player to actually move north, I didnt think about it like you put it.

Once more, thanks again.
Top

Posted by Txzeenath   USA  (54 posts)  Bio
Date Reply #3 on Thu 22 Jul 2004 10:42 PM (UTC)
Message
I didn't test it so lemme know if it works :)

Darkness comes along thy path, searching, wanting, calling wrath,
shadows awaken, release the light, one and only.. here to fight,
challenge the darkness, the shadows they call, hunting the living,
more and all. Roaring thunder, full of hate, a single bound, seals
your fate.

-Txzeenath

telnet://divineright.org:8088
Alumuble Arda -
*Player owned shops, clans, and housing
*Multiclass & Stat training
*Random mob name generation implemented and Overland mapping.
*Realistic equipment statistics
*Interactive enviroment(weather/sectors)
*Weapon sheaths(scabbards), Throwing weapons
*Automatic crash recovery, saving, and reporting without disconnecting
*Fully customizeable color, Automapper, "Smart" mobiles, Hiscore tables, and more!

Currently running AGE v1.9.6(Originated and modified from Smaug 1.4a)
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #4 on Fri 23 Jul 2004 11:30 PM (UTC)
Message
Samson has also made a "run" snippet that works fine.

www.afkmud.com

Should be the site.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
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.


15,998 views.

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

Go to topic:           Search the forum


[Go to top] top

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