--- [EMAIL PROTECTED] wrote:
> I have written up an assassination function.. and
> looking for ways to improve it. I hacked slay, and
> backstab to pieces making it, and i would appreciate
> if someone can help the newbie coder here by
> commenting what the lines of code do (i know what
> send_to_char is ;) ) Any help is appreciated, and
> hope someone finds some use of this. It is my first
> code i've written (even if its hacking two to make
> one) I do not wish for any credit, because the
> credit deserves to go to the makers of rom.
>
> Maybe someone can help me improve it?
> /*snip here*/
>
>
> void do_assassinate( CHAR_DATA *ch, char *argument )
> { //main
> char arg[MAX_INPUT_LENGTH];
> CHAR_DATA *victim;
> OBJ_DATA *obj;
>
> one_argument( argument, arg );
>
> if (arg[0] == '\0')
> {
> send_to_char("Assassinate Whom?\n\r",ch);
> return;
> }
>
> if (ch->fighting != NULL)
> {
> send_to_char("You cant sneak up on
> them.\n\r",ch);
> return;
> }
> if ((victim = get_char_room(ch,arg)) == NULL)
> {
> send_to_char("They aren't here.\n\r",ch);
> return;
> }
> if ( victim == ch )
> {
> send_to_char( "How can you assassinate yourself,
> Wouldn't that just be suicide?\n\r", ch );
> return;
> }
> if ( is_safe( ch, victim ) )
> {
> send_to_char("Not in here.\n\r",ch);
> return;
> }
> if (IS_NPC(victim) &&
> victim->fighting != NULL &&
> !is_same_group(ch,victim->fighting))
> {
> send_to_char("Kill stealing is not
> permitted.\n\r",ch);
> return;
> }
>
> if ( ( obj = get_eq_char( ch, WEAR_WIELD ) ) ==
> NULL)
> {
> send_to_char( "You need to wield a weapon to
> assassinate.\n\r", ch );
> return;
> }
>
> if ( victim->hit != victim->max_hit)
> {
> act( "$N is too alert for you to assassinate
> them.",
> ch, NULL, victim, TO_CHAR );
> return;
> }
**
Should change this check to if (victim->hit <
victim->max_hit), simply because as it is now you
can't assassinate someone with more than max hp. I'd
imagine they wouldn't be very alert if they're at more
than full health. ;)
**
>
> check_killer( ch, victim );
> WAIT_STATE( ch, skill_table[gsn_assassinate].beats
> );
> if (( number_percent( ) < 40)
> || ( get_skill(ch,gsn_backstab) >= 2 &&
> !IS_AWAKE(victim) ) )
**
You should also change two things here. First,
get_skill calls gsn_backstab... this is the
assassinate skill ;) Second, the success formula is a
bit too successful. 40% of the time it's going to
work, and it'll always work if they're sleeping (and
the backstab/assassinate skill is above 2%). Seems
kind of a high rate of success? I realize no
experience is being gained, but still... the ability
to instantly kill something 40% of the times you try
seems high.
**
> {
> check_improve(ch,gsn_assassinate,TRUE,1);
> act( "You {R=++||{Gassassinate{R||++={x
> $N!",ch,NULL,victim,TO_CHAR);
> act( "$n {R=++||{Gassassinates{R||++={x
> you!",ch,NULL,victim,TO_VICT);
> act( "$n {R=++||{Gassassinates{R||++={x
> $N!",ch,NULL,victim,TO_NOTVICT);
> raw_kill( victim );
> }
> else
> {
> check_improve(ch,gsn_assassinate,FALSE,1);
> damage( ch, victim, 0,
> gsn_assassinate,DAM_NONE,TRUE);
> }
>
> return;
> }//end of funct.
> /*End of Snip*/
> Charlie <--- the completly newbie coder, with a
> will, and a vision!
> aka Atm.
>
>
__________________________________________________________________
> The NEW Netscape 7.0 browser is now available.
> Upgrade now!
>
http://channels.netscape.com/ns/browsers/download.jsp
>
>
> Get your own FREE, personal Netscape Mail account
> today at http://webmail.netscape.com/
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
Other than that I don't see anything you did wrong.
=====
-Matt Foltz
[Neoterra MUD] telnet://24.56.211.234:4000
[Car Audio Resources homepage] http://www.car-audio.net
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com