SWR Problems
< Newer Topic
:: Older Topic >
#21 Feb 19, 2010 9:51 pm
Magician
GroupMembers
Posts147
JoinedJun 9, 2009
Well if I'm right, hitprcnt_prog 100 will only fire when the mob has 100% hp. So all the if checks in there will never be true. Maybe try a fight prog with 100 and put if hitprcnt($i) == 90, and so on, in that?
#22 Feb 19, 2010 9:57 pm
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
Actually as far as I can tell that one is always fired because it uses a hitpercent (of mobile) < <#> so while the mobile is at 100 it won't fire. After that the 100 will always fire till they get back up to 100. (Looking at the code for it all) So if you did those programs in reverse order it should work fine. like do the hitprcnt 10 then hitprcnt 20 then hitprcnt 30 etc.... Leave 100 for last.
#23 Feb 19, 2010 10:00 pm
Fledgling
GroupMembers
Posts44
JoinedFeb 12, 2010
Ahhhh.... Thanks exactly why. I remember having issues with that in the past, that sure brings back some memories.
And Yes, Andril, if you set it for hitprcnt_prog 100, it fires off 100% of the time, dunno why, but it does.
And Yes, Andril, if you set it for hitprcnt_prog 100, it fires off 100% of the time, dunno why, but it does.
#24 Feb 19, 2010 10:16 pm
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
Well its not exactly 100% of the time since it checks for < not <= so if they have 100% of their hp it won't fire.
Aside from that though it will lol. There is also going to be a possible issue one day for you with that check if you are able to set up to like massive amounts of hp for mobiles etc... just based on the checks itself. Like if you take a mobile with like 100mil hp or something it will end up wrapping the number to the -s and make it less then what the check is also. Just thought I'd go ahead and point that out also.
Aside from that though it will lol. There is also going to be a possible issue one day for you with that check if you are able to set up to like massive amounts of hp for mobiles etc... just based on the checks itself. Like if you take a mobile with like 100mil hp or something it will end up wrapping the number to the -s and make it less then what the check is also. Just thought I'd go ahead and point that out also.
#25 Feb 19, 2010 10:52 pm
Last edited Feb 19, 2010 10:59 pm by MagisterXero
Fledgling
GroupMembers
Posts44
JoinedFeb 12, 2010
The mob does have over 100 mil hp. So, I just tested that and it didn't work. hm
Any way to fix that?
Any way to fix that?
#26 Feb 19, 2010 11:13 pm
Last edited Feb 19, 2010 11:16 pm by Remcon
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
in mud_prog.c
change
to
Haven't tested it but give that a try and see if it does what you want it to.
Also went ahead and changed the < to <= since if you say 100% then 100% should fire for it also IMHO.
change
void mprog_hitprcnt_trigger( CHAR_DATA * mob, CHAR_DATA * ch ) { MPROG_DATA *mprg; if( IS_NPC( mob ) && ( mob->pIndexData->progtypes & HITPRCNT_PROG ) ) for( mprg = mob->pIndexData->mudprogs; mprg; mprg = mprg->next ) if( ( mprg->type & HITPRCNT_PROG ) && ( ( 100 * mob->hit / mob->max_hit ) < atoi( mprg->arglist ) ) ) { mprog_driver( mprg->comlist, mob, ch, NULL, NULL, FALSE ); break; } return; }
to
int get_percent( int fnum, int snum ) { double percent = 0.0; if( fnum == snum ) return 100; if( fnum <= 0 ) return fnum; percent += ( 100 * fnum ); percent /= ( snum ); return (int)percent; } void mprog_hitprcnt_trigger( CHAR_DATA * mob, CHAR_DATA * ch ) { MPROG_DATA *mprg; if( IS_NPC( mob ) && ( mob->pIndexData->progtypes & HITPRCNT_PROG ) ) for( mprg = mob->pIndexData->mudprogs; mprg; mprg = mprg->next ) if( ( mprg->type & HITPRCNT_PROG ) && ( get_percent( mob->hit, mob->max_hit ) <= atoi( mprg->arglist ) ) ) { mprog_driver( mprg->comlist, mob, ch, NULL, NULL, FALSE ); break; } return; }
Haven't tested it but give that a try and see if it does what you want it to.
Also went ahead and changed the < to <= since if you say 100% then 100% should fire for it also IMHO.
#27 Feb 19, 2010 11:14 pm
Fledgling
GroupMembers
Posts44
JoinedFeb 12, 2010
Will do! I'll test it out once I'm done making codebase updates
#28 Feb 20, 2010 2:58 am
Fledgling
GroupMembers
Posts44
JoinedFeb 12, 2010
Having a bit of trouble with some a line of code, which I'll post below.
Not sure what the problem is... The function has two arguments...
/* In mud.h */ const char *PERS args( ( CHAR_DATA * ch, CHAR_DATA * looker ) ); /* in comm.c */ const char *PERS( CHAR_DATA * ch, CHAR_DATA * looker ) / * The error */ Compiling o/comm.o.... comm.c:3590:59: error: macro "PERS" requires 2 arguments, but only 1 given comm.c:3590: error: function definition does not declare parameters make[1]: *** [o/comm.o] Error 1
Not sure what the problem is... The function has two arguments...
#29 Feb 20, 2010 3:12 am
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006
Search for
It sounds like you have a function called PERS, and a lingering macro definition for it as well.
#define PERS
It sounds like you have a function called PERS, and a lingering macro definition for it as well.
#30 Feb 20, 2010 9:52 pm
Fledgling
GroupMembers
Posts44
JoinedFeb 12, 2010
I seem to be struck with misfortunes constantly...
So now I've tried to upgrade the codebase of the mud to swfote, by using wincompare and implementing lines that were different while still retaining what I'd already done.
I got the mud working and booted up with no problems for EXISTING characters, save for a few bugs with skills not listing right, but now there's automatic crash when a
new character is about to be created. It happens just as they are about to enter the game.
last line being called is nanny( d, cmdline ); -- in comm.c, line 556 and it's exiting with code 1
So now I've tried to upgrade the codebase of the mud to swfote, by using wincompare and implementing lines that were different while still retaining what I'd already done.
I got the mud working and booted up with no problems for EXISTING characters, save for a few bugs with skills not listing right, but now there's automatic crash when a
new character is about to be created. It happens just as they are about to enter the game.
last line being called is nanny( d, cmdline ); -- in comm.c, line 556 and it's exiting with code 1
#31 Feb 20, 2010 10:01 pm
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006
You'd probably be better off getting the changes you made to SWRFUSS using a diff against the stock SWRFUSS, and then applying those same changes to SWFotEFUSS.
#32 Feb 20, 2010 10:02 pm
Fledgling
GroupMembers
Posts44
JoinedFeb 12, 2010
This code was originally swrfuss, though.
#33 Feb 20, 2010 10:07 pm
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006
And then you tried to convert it to SWFotEFUSS to preserve your changes.
What I'm saying is to go back to your backup from before you tried to change it into a FotEFUSS and diff the changes you had made out and apply them to FotEFUSS. I guarantee it'll be a lot less of a headache then trying to figure out what was changed between SWR and SWFotE that wasn't caught by wincompare. Or where you placed something in wrong or the like. Because that's what it sounds like is happening. It sounds like either something wasn't caught, or something was pasted in out of place.
What I'm saying is to go back to your backup from before you tried to change it into a FotEFUSS and diff the changes you had made out and apply them to FotEFUSS. I guarantee it'll be a lot less of a headache then trying to figure out what was changed between SWR and SWFotE that wasn't caught by wincompare. Or where you placed something in wrong or the like. Because that's what it sounds like is happening. It sounds like either something wasn't caught, or something was pasted in out of place.
#34 Feb 25, 2010 8:32 am
Fledgling
GroupMembers
Posts20
JoinedJan 29, 2008
I actually encountered the posters original problem a couple weeks ago.
Just to clarify, there are two different settings for max_buf_lines in edit_buffer in build.c.
There is the initial setting ( 24 in stock SWR ). Then the setting for progs and help files ( 48 in stock ).
In mud.h, struct editor_data is defined. The variable line is a two dimensional char array... the first dimension must be 1 greater than whatever the higher of your two maxes are above. So if you increase max_buf_lines, you will need to increase this array as well.
DV
The fastest and probably the best way to stop this issue is to change max_buf_lines in build.c to 49 instead of 60.
Just to clarify, there are two different settings for max_buf_lines in edit_buffer in build.c.
There is the initial setting ( 24 in stock SWR ). Then the setting for progs and help files ( 48 in stock ).
In mud.h, struct editor_data is defined. The variable line is a two dimensional char array... the first dimension must be 1 greater than whatever the higher of your two maxes are above. So if you increase max_buf_lines, you will need to increase this array as well.
DV