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 ➜ ok.. got it all done for soulfeed except for this...

ok.. got it all done for soulfeed except for this...

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


Posted by Alyce   (43 posts)  Bio
Date Mon 05 Sep 2016 06:15 AM (UTC)
Message
ok.. I got the soulfeed in.


void do_soulfeed( CHAR_DATA* ch, const char* )
{
   OBJ_DATA *obj;

  if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL  )
   {
      send_to_char( "You must be holding the weapon you wish to feed.\r\n", ch );
      return;
   }
  if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) != NULL && ( obj->value[4] >= 4 ))
   {
      send_to_char( "You have fed this weapon as much as you can.\r\n", ch );
      return;
   }
  if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) != NULL && ( obj->value[4] <= 3 ))
   {

        if ( ch->pcdata->souls <= 1999)
        {
                send_to_char( "You do not have the souls\r\n", ch );
                return;
        }
        else
        obj->value[4] += 1;
        ch->pcdata->souls -= 2000;
      send_to_char( "The souls of the vanquished infuse into this weapon.\r\n", ch );
      return;
   }


}


it works. it increases the itemvalue 4 on the weapon as it should.

now.. I want to have that affect the total damage output... this is what I have...


//soul fed weapons bonus
 OBJ_DATA *obj;
   if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL || ( obj->value[4] == 0))
        dam = dam;
   if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) != NULL && ( obj->value[4] == 1))
        dam = (dam * 1.5);
   if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) != NULL && ( obj->value[4] == 2))
        dam = (dam * 2);
   if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) != NULL && ( obj->value[4] == 3))
        dam = (dam * 2.5);
   if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) != NULL && ( obj->value[4] == 4))
        dam = (dam * 3);


I stuck this in fight.c by the damage modifiers but when I soulfeed the weapon, it is not returning any extra damage. Should I stick this into another location in fight.c or is there something wrong with this code?

It compiles fine, no warnings and there is no crashing when fighting... it soulfeeds just fine and the weapon value[4] increases by incriments as it should.

What say you, oh grand masters of the code?
Top

Posted by Alyce   (43 posts)  Bio
Date Reply #1 on Mon 05 Sep 2016 06:35 AM (UTC)
Message
Actually.. I got it.. I just put it RIGHT after the backstab portion in fight.c

If anyone wants to use the above, be my guest :)
Top

Posted by Alyce   (43 posts)  Bio
Date Reply #2 on Mon 05 Sep 2016 06:54 AM (UTC)
Message
If anyone is interested, I can make a full snippet for this. I have the victim-> level * characters luck for the amount of souls acquired. (that formula can be changed)

I also have it show up on the Identify spell.


Object 'a finely honed sword' is a weapon, with wear location:  take wield
Special properties:  magic
Its weight is 2, value is 0.
Damage is 200 to 200 (average 200).
The soul level of this weapon is: 4
Affects hit roll by 2.
Affects damage roll by 1.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 05 Sep 2016 08:29 PM (UTC)
Message

 OBJ_DATA *obj;


It would be faster and clearer to call get_eq_char once. eg.


 OBJ_DATA *obj = get_eq_char( ch, WEAR_WIELD )

- Nick Gammon

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

Posted by Alyce   (43 posts)  Bio
Date Reply #4 on Tue 06 Sep 2016 12:49 AM (UTC)
Message
I updated the snippet per your recommendation
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.


14,075 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.