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 ➜ Combat System Overhaul

Combat System Overhaul

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


Posted by Maleficusu   (4 posts)  Bio
Date Fri 15 Feb 2013 04:37 AM (UTC)
Message
Hello everyone,

I'm pretty new to the smaug codebase and coding in general. I have been working for a couple weeks with a group of dedicated builders on my mud to get it both operation-able and presentable to new audiences. The biggest issue now however would be reworking the combat system. I am trying to figure out exactly how to stop the autonomous combat system so that I can rework it into becoming a Manual, give & take sort of system where if i were to type 1 and enter, I would swing at a target for instance. If anyone could help me with that it'd be much appreciated. We are working on Smaug 1.9. Any snippets or info on actually stopping autonomous combat would also be appreciate if you do not know how to recode it personally.
Top

Posted by Nick Gammon   Australia  (23,162 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 15 Feb 2013 06:28 AM (UTC)
Message
It's been a while since I looked at the code, but I'm pretty sure that a combat round is initiated on a "tick" based on a timer.

Look at violence_update in fight.c, called by update_handler in update.c.

If you commented out these lines:


  if( --pulse_violence <= 0 )
   {
      pulse_violence = PULSE_VIOLENCE;
      violence_update(  );
   }



Then some or all of the automatic fighting would be removed, and then you could do it manually.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Kharosias   (1 post)  Bio
Date Reply #2 on Fri 15 Feb 2013 08:15 AM (UTC)
Message
I'm having a problem understanding how to make changes when I'm running the mud locally... the smaug.exe file should make any changes I make in the code, in the mud no? Like, I can delete fight.c and run the smaug.exe again and nothing happens.......
Top

Posted by Maleficusu   (4 posts)  Bio
Date Reply #3 on Fri 15 Feb 2013 08:15 AM (UTC)
Message
Im not really sure if this is done correctly, but these are the code snippets commented out from 1976 to 2015. However Ive tested it offline on a test character and mobiles and autokill is still active.


}/*
if( --pulse_mobile <= 0 )
{
pulse_mobile = PULSE_MOBILE;
mobile_update( );
}

if( --pulse_violence <= 0 )
{
pulse_violence = PULSE_VIOLENCE;
violence_update( );
}
*/

if( --pulse_time <= 0 )
{
pulse_time = sysdata.pulsecalendar;
char_calendar_update( );
}

if( --pulse_point <= 0 )
{
pulse_point = number_range( ( int )( PULSE_TICK * 0.75 ), ( int )( PULSE_TICK * 1.25 ) );

auth_update( ); /* Gorog */
time_update( ); /* If looking for slower passing time, move this to just above char_calendar_update( ); */
UpdateWeather( ); /* New Weather Updater -Kayle */
hint_update( );
char_update( );
obj_update( );
clear_vrooms( ); /* remove virtual rooms */
}
/*
if( --pulse_second <= 0 )
{
pulse_second = PULSE_PER_SECOND;
char_check( );
check_dns( );
reboot_check( 0 );
}*/
Top

Posted by Nick Gammon   Australia  (23,162 posts)  Bio   Forum Administrator
Date Reply #4 on Fri 15 Feb 2013 10:34 AM (UTC)
Message
Perhaps read this:

http://www.gammon.com.au/smaug/howtocompile.htm

You can't just delete a .c file and hope things will change.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Maleficusu   (4 posts)  Bio
Date Reply #5 on Fri 15 Feb 2013 06:06 PM (UTC)
Message
Hmm, I'm really not sure I'm understanding this.


So, these lines were commented out in update.c as you suggested.

/*if( --pulse_violence <= 0 )
{
pulse_violence = PULSE_VIOLENCE;
violence_update( );
}*/

However on booting, the fighting is still completely automated; tested on other npcs and on pcs. I feel that I am doing something wrong or simply not grasping the concept. Is there a number I'm supposed to be changing, something I'm supposed to be deleting perhaps? Or would I have to somehow redefine pulse_violence to mean something completely different?
Top

Posted by Maleficusu   (4 posts)  Bio
Date Reply #6 on Fri 15 Feb 2013 06:16 PM (UTC)
Message
Also I want to note that this is all being tested on an Offline server that runs the Smaug.exe locally from smaugFuss/area if that helps at all
Top

Posted by Nick Gammon   Australia  (23,162 posts)  Bio   Forum Administrator
Date Reply #7 on Fri 15 Feb 2013 11:11 PM (UTC)
Message
Did you recompile smaug.exe? The date/time stamp of smaug.exe has to be later than the one of update.c (where you made the changes) or you didn't do that.

The server does not run source code, it runs compiled object code.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


25,055 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.