Login
User Name:

Password:



Register

Forgot your password?
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
SWRFUSS 1.4
Author: Various
Submitted by: Samson
Users Online
AhrefsBot, Bing

Members: 0
Guests: 20
Stats
Files
Topics
Posts
Members
Newest Member
488
3,788
19,631
595
Khonsu

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » SmaugFUSS » Bug in will_fall( )
Forum Rules | Mark all | Recent Posts

Bug in will_fall( )
< Newer Topic :: Older Topic > Flying mounts not working...

Pages:<< prev 1 next >>
Post is unread #1 Oct 23, 2017 3:35 am   Last edited Oct 23, 2017 3:36 am by GatewaySysop
Go to the top of the page
Go to the bottom of the page

GatewaySysop
Conjurer
GroupMembers
Posts413
JoinedMar 7, 2005

 
Really scratching my head on this one. Flying mounts do not work in stock code. Surprised nobody noticed this long ago, but I guess I haven't play tested it until now either, so ... :biggrin:

Anyway, if you look in act_move.c, function will_fall( ), you'll see this:

bool will_fall( CHAR_DATA * ch, int fall )
{
   if( xIS_SET( ch->in_room->room_flags, ROOM_NOFLOOR ) && CAN_GO( ch, DIR_DOWN )
       && ( !IS_AFFECTED( ch, AFF_FLYING ) || ( ch->mount && !IS_AFFECTED( ch->mount, AFF_FLYING ) ) ) )


Because of the way it is written, the check still works as expected with no mount, i.e. ch falls if not AFF_FLYING. The problem is that, presumably, ch will be most often using a flying mount when ch can't fly themselves. And therein lies the quandary. The way this is written, with the OR condition, the mere fact that ch isn't flying is sufficient to cause the check to return TRUE and subsequently drop ch into the room below.

What I believe they meant to do was this:

    if ( xIS_SET( ch->in_room->room_flags, ROOM_NOFLOOR ) && CAN_GO( ch, DIR_DOWN )
    && !( IS_AFFECTED( ch, AFF_FLYING ) || ( ch->mount && IS_AFFECTED( ch->mount, AFF_FLYING ) ) ) )


That is to say, make it so that ch will fall if not either AFF_FLYING or mounted on a mobile that is AFF_FLYING.

Hope that helps to get your flying mounts working as intended. :cyclops:


Post is unread #2 Sep 28, 2019 12:38 pm   
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts86
JoinedAug 25, 2003

 
Hi, my codebase is not default, but look also in move_char

if ( IS_NPC(ch) && xIS_SET(ch->act, ACT_MOUNTED) )

i think is better

if ( IS_NPC(ch) && xIS_SET(ch->act, ACT_MOUNTED) && !fall )


try: room nofloor, dir down open and ride (you fly) a horse without fly.
The horse can't fall down.

bye
mat

Post is unread #3 Oct 3, 2019 5:46 pm   Last edited Oct 3, 2019 6:15 pm by GatewaySysop
Go to the top of the page
Go to the bottom of the page

GatewaySysop
Conjurer
GroupMembers
Posts413
JoinedMar 7, 2005

 
Matteo2303 said:

Hi, my codebase is not default, but look also in move_char

if ( IS_NPC(ch) && xIS_SET(ch->act, ACT_MOUNTED) )

i think is better

if ( IS_NPC(ch) && xIS_SET(ch->act, ACT_MOUNTED) && !fall )


try: room nofloor, dir down open and ride (you fly) a horse without fly.
The horse can't fall down.

bye
mat


Kudos to Matteo, this is a good find.

In my code, it seems like will_fall( ) was forcing the PC rider to fall and moving the mount with him, but not necessarily injuring the mount in the fall as intended. Likewise, an NPC mounted on a flying NPC was not falling as expected. Making this change, I believe the mount should now fall and take the rider with, which is much better. :grinning:

Some testing in a room with nofloor and a flying horse. Let's see what happens if we clip his wings by making him 'land' which removes the flying flag:


In the Air
You are flying in the air high above Darkhaven.  You can see the whole
countryside from here:  It is truly a splendid sight to behold.  Gazing
upward, you see a bright rainbow.
Exits: up down.
A nightmare is here, kicking at you with its flaming hooves.
Thorin Oakenshield is here, upon A pitch-black nightmare.

<1979hp 900m 1542mv> (Invis 65) 
force nightmare land
A pitch-black nightmare lands.
A pitch-black nightmare falls down.
Thorin Oakenshield falls down upon A pitch-black nightmare.



And the aftermath below:



Darkhaven Square
You are standing within the expanse of the famous Darkhaven Square.  A
stone statue of occupies the square's center, surrounded by gardens of
shrubbery which enhance the air of serenity and peace here in the center
of the city.  The main road lead away in the cardinal directions, while
to the northeast and northwest are forested paths.  The spires of a
cathedral can be seen rising to the northwest.
Exits: north east south west up northeast northwest.
The corpse of Thorin Oakenshield lies here.
A pool of spilled blood lies here.
A pitch-black nightmare is sprawled out here.

<1979hp 900m 1540mv> (Invis 65) 
l nightmare
The nightmare is a wholly evil being, sent out by the rulers of the lower
planes to torment mortals.  It vaguely resembles a horse, with a hide blacker
than the darkest night, and hooves that burn with unholy fires.
A pitch-black nightmare is almost dead.

Much better!

Thanks for sharing a important tweak to this fix! :wink:

Post is unread #4 Oct 4, 2019 8:15 am   Last edited Oct 4, 2019 9:47 am by Matteo2303
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts86
JoinedAug 25, 2003

 
Hi, my english is so bad that I cant explain enoght what I mean in private message.

"!fall" fix it's part of fix, but not fix all the "bug"... I don't have enought time at this moment but I'll try to explain better than I can.

I compiled your codebase 1.9 and run for test and I linked two rooms in this way:

redit exit 5 1201
(and in room 1201)
redit exit 4 1200
(You can also add in room 1201 redit exit 0 1200 for go to north and test without use land command from room 1201. In room 1201 you can also remove private nomob flags if you want test also with mob only, but for now you need PC(rider) and NPC(horse) ).

ROOM 1200
       |
   (down)
    ( up )
       |
ROOM 1201 



then in room 1200:

minvo horse
mount horse
redit flags nofloor
<49hp 145m 110mv> <#1200> 
You're falling down...

Thoric's Den                                               -     -     -
-<---- Vnum:   1201 ----------------------------->-        -<-U-(*)--->-
                                                           -     -     -

[Exits: Up]
+-----------+ You find yourself in a cozy little room. This is the place 
|           | where Thoric comes to relax, and get inspired! Looking around 
|           | yourself, you find this to be quite a comfortable, medieval 
|           | room, which seems to be inside some sort of log cabin. There's 
|           | a very nice looking leather chair here in front of a huge 
|     @     | fireplace, with a good blaze going. On the mantle you see a 
|           | fine assortment of pipes, and a couple jars of high quality 
|           | pipeweed. On the floor you spot a full bear-skin rug in front 
|           | of the fireplace, and you suddenly get the urge to make 
|           | yourself comfortable in front of the fire with a mug of hot 
+-----------+ coffee, fill a pipe up with some pipeweed, relax and listen to 
tales of days long past. 
(Mount) A beautiful manor riding horse stands here.
OUCH! You hit the ground!
That really did HURT!

<29hp 145m 110mv> <#1201> mst horse

Mobile name: riding horse        
Vnum: 2455     Sex: neutral    Room: 1201     Count: 4   Killed: 0
Str: 13 )( Int: 13 )( Wis: 13 )( Dex: 13 )( Con: 13 )( Cha: 13 )( Lck: 13
Level   : 9               class  : 03/warrior      Race      : 86/horse     
Hps     : 127/127         Mana   : 100/100         Move      : 100/100     
Hitroll : 2               Align  : 200             Armorclass: 1
Damroll : 2               Wimpy  : 0               Position  : 12
Fighting: (none)          Master : (none)          Leader    : (none)
Hating  : (none)          Hunting: (none)          Fearing   : (none)
Mob hitdie : 9d3+100    Mob damdie : 3d3+  2    Index damdie : 3d3+  2
NumAttacks : 0
MentalState: 0     EmotionalState: 0     
Save versus: 0 0 0 0 0       Items: (0/5)  Weight (0/140)
Year: -1     Secs: 0  Timer: 0  Gold: 1000
Act Flags  : npc mountable mounted
Affected by: detect_invis detect_hidden
Speaks: 1   Speaking: 262145   Experience: 0
Languages  : common clan 
Shortdesc  : a riding horse
Longdesc   : A beautiful manor riding horse stands here.
Body Parts : head legs heart brains guts eye tail
Attacks    : 
Defenses   : 




the problem is that horse move from 1200 to 1201 don't using move_char but...

    /*
       * Mount bug fix test. -Orion
       */
      if( char_died( ch->mount ) )
         return global_retcode;

      if( ch->mount )
      {
         char_from_room( ch->mount );
         char_to_room( ch->mount, to_room );
      }


so all subroutine of move char are bypassed for horse.

Probably it's easy to fix.. I'm looking for this as soon as possible.


PS: try
    mount yourself the horse
, dont use a mob to mount a mob (thats work).

Bye
mat

Post is unread #5 Oct 8, 2019 3:15 pm   
Go to the top of the page
Go to the bottom of the page

GatewaySysop
Conjurer
GroupMembers
Posts413
JoinedMar 7, 2005

 
Ahh, good catch, it does behave different for PC rider vs. NPC.

I wonder - could it be as simple as having a check in the falling damage so that if a PC is being damaged, also damage their mount in the fall, if applicable? Or is that over simplifying it?

I'll check later today.

Post is unread #6 Oct 9, 2019 4:44 am   
Go to the top of the page
Go to the bottom of the page

GatewaySysop
Conjurer
GroupMembers
Posts413
JoinedMar 7, 2005

 
Thinking about it... couldn't you just do this?

      if( ch->mount && !fall )
      {
         char_from_room( ch->mount );
         char_to_room( ch->mount, to_room );
      }


If CH is falling, despite having a mount to ride, evidently his mount is not capable of flying and should be falling too. Since they will end up at the same place, there should be no need to drag the mount along here. After all, they will meet when they hit the ground. :biggrin:

Thoughts?

Post is unread #7 Oct 12, 2019 4:46 pm   Last edited Oct 12, 2019 4:47 pm by Matteo2303
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts86
JoinedAug 25, 2003

 
GatewaySysop said:

Thinking about it... couldn't you just do this?

      if( ch->mount && !fall )
      {
         char_from_room( ch->mount );
         char_to_room( ch->mount, to_room );
      }


If CH is falling, despite having a mount to ride, evidently his mount is not capable of flying and should be falling too. Since they will end up at the same place, there should be no need to drag the mount along here. After all, they will meet when they hit the ground. :biggrin:

Thoughts?



I think it's apparently a good solution.
I tested a little and seems work great, but I want look move_char routine one more time before apply this fix and test also with mudprog, mpdamage, char_died situations during fall between more than one room etc...
The only "strange" thing in this fix is that ch falling down before ch->mount (horse) but it's not so much important probably, only a little illogical.

Other solution that I'm also was thinking (like you said) it's damage horse with rider at the end.
Am I going to damage the rider? ----> I immediately damage the mount...

In my opinion if ( ch->mount && !fall ) is better idea but need to be tested in details.

Bye
mat

Post is unread #8 Nov 25, 2019 11:10 pm   
Go to the top of the page
Go to the bottom of the page

GatewaySysop
Conjurer
GroupMembers
Posts413
JoinedMar 7, 2005

 
For what it's worth, I did try to do some additional testing with the above fix, and so far no issues found. Anyone else spot anything yet?

Pages:<< prev 1 next >>