Login
User Name:

Password:



Register

Forgot your password?
Hi - Clean SmaugFuss map/description issue..
Dec 15, 2024 7:29 pm
By Samson
AFKMud 2.2.4
Dec 10, 2024 4:09 pm
By Samson
I3 and IMC
Dec 8, 2024 6:35 pm
By Remcon
Ubuntu 22.04.5 LTS
Dec 5, 2024 5:10 pm
By Remcon
SmaugFUSS 1.8/1.9
Nov 29, 2024 11:46 am
By Remcon
SWFOTEFUSS 1.5.1
Author: Various
Submitted by: Samson
SWRFUSS 1.4.1
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.5
Author: Various
Submitted by: Samson
AFKMud 2.2.4
Author: AFKMud Team
Submitted by: Samson
LOP 1.5
Author: Remcon
Submitted by: Remcon
Users Online
AhrefsBot, Bing, DotBot

Members: 0
Guests: 51
Stats
Files
Topics
Posts
Members
Newest Member
494
3,808
19,707
588
Mortrex

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » SWFOTE FUSS » Bug with snipe and looting:
Forum Rules | Mark all | Recent Posts

Bug with snipe and looting:
< Newer Topic :: Older Topic > Its not Andril patch!!!

Pages:<< prev 1 next >>
Post is unread #1 Aug 16, 2012 4:50 pm   
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

 
Ok, so I mistakenly thought it was the patch for the build warnings of unset var's.

When you snipe something from another room, you can loot its corpse. Granted this may be a rare situation, as very rarely you out right kill the mob with snipe, but it is possible if you keep kiting.

I've not had any time to look at this code yet, so it may be a bit before I dig even deeper.

Just thought the community would like to know,
ayuri

Post is unread #2 Aug 16, 2012 7:16 pm   
Go to the top of the page
Go to the bottom of the page

6Dragons
Fledgling
GroupMembers
Posts48
JoinedNov 24, 2008

 
Mobs dying anyone could loot from a snipe right?

It's players your asking about then?

Post is unread #3 Aug 16, 2012 8:32 pm   Last edited Aug 16, 2012 8:33 pm by ayuri
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

 
Sorry I should have been more exact:
say you have config +autoloot on.
You're in room 1 target is east in room 2.
You 'snipe e ' Then target dies from your snipe.

With auto loot you can loot the target in room 2 with out ever leaving room 1.
Even with out auto loot config option, you automatically 'look inside the corpse of and see:" message still shows up.

No players yet in the game. This was something I was testing out when I applied the patch that Andril posted. I had to go do it by hand since I've made changes to the code and patch didn't know what to do with it :D

This may be present in SWR - I've yet to look there. Been really busy today at work.

ayuri

Post is unread #4 Aug 17, 2012 1:55 am   
Go to the top of the page
Go to the bottom of the page

Andril
Magician
GroupMembers
Posts147
JoinedJun 9, 2009

 
First off the disclaimer: It wasn't me! :)
Second: SWR has the same exact problem, with the same fix.
Third: We get to clean do_snipe up a bit...

Starting with do_snipe in swskills.c, both bases.
Find
   bool pfound = false;

Add below it
   int tempnum = 0; /* Used to hold ch->tempnum when out of room during sniping */

Find
   if( !pfound )
   {
      ch_printf( ch, "You don't see that person to the %s!\r\n", dir_name[dir] );
      char_from_room( ch );
      char_to_room( ch, was_in_room );
      return;
   }

Change to
   if( !pfound )
   {
      ch_printf( ch, "You don't see that person to the %s!\r\n", dir_name[dir] );
      return;
   }

Find
   if( number_percent(  ) < schance )
   {
      char_from_room( ch );
      char_to_room( ch, was_in_room );
      sprintf( buf, "$n fires a blaster shot to the %s.", dir_name[get_door(arg)] );
      act( AT_ACTION, buf, ch, NULL, NULL, TO_ROOM );

      char_from_room( ch );
      char_to_room( ch, victim->in_room );

      sprintf( buf, "A blaster shot fires at you from the %s.", dir_name[dir] );
      act( AT_ACTION, buf, victim, NULL, ch, TO_CHAR );
      act( AT_ACTION, "You fire at $N.", ch, NULL, victim, TO_CHAR );
      sprintf( buf, "A blaster shot fires at $N from the %s.", dir_name[dir] );
      act( AT_ACTION, buf, ch, NULL, victim, TO_NOTVICT );

      one_hit( ch, victim, TYPE_UNDEFINED );

      if( char_died( ch ) )
         return;

      stop_fighting( ch, true );

      learn_from_success( ch, gsn_snipe );
   }
   else
   {
      char_from_room( ch );
      char_to_room( ch, was_in_room );

Change to
   if( number_percent(  ) < schance )
   {
      sprintf( buf, "$n fires a blaster shot to the %s.", dir_name[get_door(arg)] );
      act( AT_ACTION, buf, ch, NULL, NULL, TO_ROOM );

      char_from_room( ch );
      char_to_room( ch, victim->in_room );

      sprintf( buf, "A blaster shot fires at you from the %s.", dir_name[dir] );
      act( AT_ACTION, buf, victim, NULL, ch, TO_CHAR );
      act( AT_ACTION, "You fire at $N.", ch, NULL, victim, TO_CHAR );
      sprintf( buf, "A blaster shot fires at $N from the %s.", dir_name[dir] );
      act( AT_ACTION, buf, ch, NULL, victim, TO_NOTVICT );

      /* Fix to prevent automatic looting of corpses with snipe */
      tempnum = ch->tempnum;
      ch->tempnum = INT_MIN;
      one_hit( ch, victim, TYPE_UNDEFINED );
      ch->tempnum = tempnum;

      if( char_died( ch ) )
         return;

      stop_fighting( ch, true );

      learn_from_success( ch, gsn_snipe );
   }
   else
   {


That's do_snipe taken care of. Also, all those char_from_room/char_to_room lines removed were simply removing ch from their current room and sending them right back to it. Pointless.

Now, the damage function in fight.c
Find this. Probably be easiest to do a search on that comment which is why I'm including it.
      if( !IS_NPC( ch ) && loot && new_corpse && new_corpse->item_type == ITEM_CORPSE_NPC
         && new_corpse->in_room == ch->in_room && can_see_obj( ch, new_corpse ) && ch->position > POS_SLEEPING )
      {
         /*
         * Autogold by Scryn 8/12 
         */

Change that nasty conditional block to
      if( ch->tempnum != INT_MIN && !IS_NPC( ch ) && loot && new_corpse && new_corpse->item_type == ITEM_CORPSE_NPC
         && new_corpse->in_room == ch->in_room && can_see_obj( ch, new_corpse ) && ch->position > POS_SLEEPING )
      {
         /*
         * Autogold by Scryn 8/12 
         */


And done!

Post is unread #5 Aug 17, 2012 4:49 am   
Go to the top of the page
Go to the bottom of the page

6Dragons
Fledgling
GroupMembers
Posts48
JoinedNov 24, 2008

 
Hah, that is neat and makes sense now. I am adding early styled guns to my new project. I may take a peek at SWR and see how they handle guns. I was planning of just adjusting the way missile_weapon works for guns.

4liberty mud.
4liberty.us port 4000

Post is unread #6 Aug 17, 2012 8:24 am   
Go to the top of the page
Go to the bottom of the page

Andril
Magician
GroupMembers
Posts147
JoinedJun 9, 2009

 
For the most part when talking about attacks that damage targets in rooms other than your own, such as snipe here, it's a case of move attacker from current room to target room, do a local attack to start combat between the two, then send the attacker back to the starting room, printing appropriate messages based on which room the attack is in. There really isn't any great support for combat crossing room boundaries. Almost all combat with blasters, excluding snipe, is done in melee mode with different messages.

Pages:<< prev 1 next >>