RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Flying_AI Addon <RunUO 2.0>

Tiamat13

Sorceror
Gargouille;777753 said:
Hi, very good code, thanks.

In order to more easily add this on shard I work on, I do some little changes, making install a little bit more "plug&play", as there only need declaring the new AI's in BaseAi.cs/AIType enum and BaseCreature.cs/ChangeAIType method...
All other things are now in distro files.

So I :
  • Create a Flyingcreature class, inheriting from BaseCreature, and declaring all "flying-properties", serializing it also.
  • Make several casts from Mobile to FlyingCreature instead of BaseCreature.
  • Create a FlyingCleanup.cs
  • And radicaly change the way to vorbid meleeattacks: replacing BaseWeapon.cs/OnHit method's test by another method in FlyingCreature.cs :
    Code:
    public override void AlterMeleeDamageFrom( Mobile from, ref int damage )
    		{
    			if(from.Weapon != null && from.Weapon is BaseRanged)
    				return;
    			else
    			{
    				if((from.Z > this.Z+10)||(from.Z < this.Z-10))
    				{
    					from.SendMessage("You have to be closer to attack this!");
    					damage = 0;
    				}
    			}
    		}
    Not very accurate with the original, but a easy way I find to do... But no tested yet

Hope it could help.

Very nice, I really havn't had the time to work on this since I released it and am impressed at your upgrades, feel free to continue this project as you see fit. Contact me via PM if you wish to take on some other projects I have on the go and never 100% finished.
 

Gargouille

Sorceror
A little bit slower would be a good thing.

So here's a little change : FlyingTimer Delay is now a FlyingCreature virtual property, so you can override it in each FlyingCreature inheriting script you want.

Default is still 0.2 (value in seconds).

Next things I will do soon are, find a good method working with melee/ranged/magic attacks, give bats permission to fly in caves, and allow dragon to burn your head while continue flying ;)

Thank you again
 

Attachments

  • FlyingCreature.cs
    5.3 KB · Views: 55
  • FlyingAI.cs
    16.5 KB · Views: 56

Alari

Wanderer
This is a pretty cool script, I've been using it for a little while and haven't had any real problems, however I just noticed something today. I put some Flying birds near the docks in Cove, and a few weeks later (of not being killed or respawned) and they all ended up inside the buildings that make up Cove's walls.

Also a tester reported that you can attack flying birds with a melee weapon, and it will say "out of range" but the character will gain weapon skill.
 

Varchild

Wanderer
A little check for deep water:

Code:
        public static void CheckDeepWater( FlyingCreature fbc )
        {
            if( NullCheck( fbc ) )
                return;

            bool deepWater = SpecialFishingNet.FullValidation( fbc.Map, fbc.Location.X, fbc.Location.Y );

            fbc.DebugSay( "Checking deep water: my location is {0}deep.", deepWater ? "" : "not " );

            if( deepWater )
                ChangeDirection( fbc );
        }
 

Sythen

Sorceror
Deleting Mobiles???? Where Is The Fix? lol

I Fixed My Issue...LOL YAY ME....

I had corrupted saves that were the cause of my mobiles deleting... after I fixed the saves issue everything worked awesome... I am using SVN 310 with ML updates by Callandor2k
 

ArkAngel00

Wanderer
Hey this is my first post on this web site as i hate posting anything but i`ve been messing with this script for a few hours and like it alot but one thing i`ve noticed is that the flying mobs work great out side of dungeons but when you through them in a dungeon they don`t fly at all any help would be great as i`m new to scripts and haven`t seen anything that addresses this problem if there is one i`m sorry for this post thx
by the way great job on this script
 

Tiamat13

Sorceror
Been awhile since I've been here but was thinking on shaking the dust off these projects and give them another upgrade, who knows, we'll see. As for the flying in dungeons, I did not allow for that as they have ceilings, I could keep this in mind for the upgrade if I do one and have a setting to turn the flying on/off depending on the dungeon.


T.
 

Thilgon

Sorceror
better not have them fly in the dungeons, 'cause critters would end up into another dungeon if they are near, or find themselves stucked behind walls and similiar... it would be a mess... anyway i think i have solved the "strange place they fly in" issue, despawing the critters on server restart, and making them spawn again as it restarts, so the creatures around would always be in the right place (unless they act strange during the day lol)
 

Tiamat13

Sorceror
NPC Flying Update/Upgrade

Got fiddling with this system, took in everything said in this thread and added fixes and changes to reflect what was said, the only things not added yet are the special attacks and such.


First let me say Thanks to Gargouille and Varchild for their suggestions and code!

Whats Fixed or Changed from Origonal :

Changed distro edits around to make this more plug n play, I included the origonals with edits included for those that havn't customized those files yet.

I've fixed the mountain and flying threw windows bug!

Added code to prevent flying over the deep ocean!

Added new speed control that adjusts shadow as well!

Added 30 mobiles with flying system, you can adjust their stats via their scripts or use them for base scripts for other creatures.

Future additions will include special attacks from the air and player flying mounts.

Enjoy!!!


GD13,
:)
 

JamzeMcC

Squire
Just thought I would add my two cents here. Greatly appreciate the new "Plug and Play" features on this. Makes it so much easier for people to install. Ofcourse, going from the old version to the new was a bit of a pain! lol So far, ive not seen any issues with the flying monsters going into any windows. Havent noticed any getting stuck on mountains, yet. Ill keep an eye on them and let you know. Most definently looking forward to the special abilities update!. Looks promising. Thanks you for sharing with us.
 

M_0_h

Page
This system looks really good, nice idea! I can imagine a dungeon full of flying bats or harpies :D the only problem is with creatures like dragons flying so high that players would have problems to target them, but that's the client's fault...

thx for submitting! :)
 

Tiamat13

Sorceror
Crowley62;833483 said:
I dont understand the dragons on my shard already fly, they always have with no edits

The flying on your shard is just the dragons flying animation, they don't actually fly in the sky. This system is designed to allow npc's to fly into the sky. Read first post for detail's!


GD13,
:)
 

kmekc

Wanderer
A little hint for a redesign:

Please don't inherit your FlyingAI's from BaseAI. Create one FlyingAI with all element functions for flee, backoff etcpp. Then inherit for example FlyingAnimalAI from AnimalAI and just add the differences from AnimalAI to FlyingAnimalAI. Would be much cleaner and don't interfere with AI changes on some shards.
 

Varkasal

Sorceror
I hate reviving an old post like this, but Im wondering if anyone is using this system modified for the latest svn or not ?
 

Dies Irae

Sorceror
It could be useful.
The next code id the flying_AI from UODemo (second age era) partially decompiled:

Code:
void Q45M(object me, integer Q4OS)
{
  here_Q4VS = getLocation(me);
  switch(Q4OS)
  {
  case 0x00:
    setY(here_Q4VS, getY(here_Q4VS) - 0x03)setZ(here_Q4VS, getZ(here_Q4VS) + 0x0C)break;
  case 0x01:
    setX(here_Q4VS, getX(here_Q4VS) + 0x02);
    setY(here_Q4VS, getY(here_Q4VS) - 0x01);
    setZ(here_Q4VS, getZ(here_Q4VS) + 0x14)break;
  case 0x02:
    setX(here_Q4VS, getX(here_Q4VS) + 0x03);
    setZ(here_Q4VS, getZ(here_Q4VS) + 0x17)break;
  case 0x03:
    break;
  case 0x04:
    setX(here_Q4VS, getX(here_Q4VS) - 0x01);
    setY(here_Q4VS, getY(here_Q4VS) + 0x02);
    setZ(here_Q4VS, getZ(here_Q4VS) + 0x08)break;
  case 0x05:
    setX(here_Q4VS, getX(here_Q4VS) - 0x02);
    setY(here_Q4VS, getY(here_Q4VS) + 0x01);
    setZ(here_Q4VS, getZ(here_Q4VS) + 0x07)break;
  case 0x06:
    setX(here_Q4VS, getX(here_Q4VS) - 0x02);
    setZ(here_Q4VS, getZ(here_Q4VS) + 0x0A)break;
  case 0x07:
    setZ(here_Q4VS, getZ(here_Q4VS) + 0x14)break;
  default:
    break;
  }
  return();
}
 
Top