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!

Sinking Boats

joshw

Sorceror
Ok working on a new boat sinking system have one problem

Code:
RunUO - [https://github.com/runuo/] Version 2.5.0.24991
Core: Running on .NET Framework Version 4.0.30319
Core: Optimizing for 2 64-bit processors
Core: Server garbage collection mode enabled
RandomImpl: CSPRandom (Software)
Scripts: Compiling C# scripts...failed (1 errors, 72 warnings)
Errors:
+ Multis/Boats/High Seas/BaseGalleon.cs:
    CS1502: Line 184: The best overloaded method match for 'Server.Map.GetMobile
sInRange(Server.Point3D, int)' has some invalid arguments
    CS1503: Line 184: Argument 2: cannot convert from 'Server.Point3D' to 'int'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
Now here is the script not sure cant figure this one out

Code:
public void OnSink(bool secondPass)
        {
            IPooledEnumerable IPE = Map.GetMobilesInRange(Location,HoldOffset);
            ArrayList list = new ArrayList();
            foreach( Mobile m in IPE )
            {
                Console.WriteLine("Mobile = {0}", m);
                list.Add(m);
            }
            IPE.Free();
            foreach( Mobile m in list )
            {
                if( Contains(m.X,m.Y) )
                    Strandedness.EventSink_Login( new LoginEventArgs(m) );
            }
            list.Clear();
            list = null;
            IPE = null;
            if( secondPass )
                OnSink(false);
        }
 

_Epila_

Sorceror
CS1502: Line 184: The best overloaded method match for 'Server.Map.GetMobilesInRange(Server.Point3D, int)' has some invalid arguments
CS1503: Line 184: Argument 2: cannot convert from 'Server.Point3D' to 'int'
The error tells you what is going on, if you search for CS1502 and CS1503 on google you will find the MSDN site with the details on how to solve them

The error is here: Map.GetMobilesInRange(Location,HoldOffset);
HoldOffset is defined as 'Point3D' and not 'int' as Map.GetMobilesInRange is expecting
Map.GetMobilesInRange(Location,4);
You will also need to check if the player is inside the boat


Code:
public void OnSink(bool secondPass)
        {
            List<IEntity> entities = GetMovingEntities();
            ArrayList list = new ArrayList();
            foreach (IEntity e in entities)
            {
                if (e is PlayerMobile) //dont forget to add 'using Server.Mobiles' ///You may also use Mobiles instead of PlayerMobiles
                {
                    PlayerMobile m = ((PlayerMobile)e);
                    Console.WriteLine("Mobile = {0}", m);
                    list.Add(m);
                }
            }
 
            foreach (Mobile m in list)
            {
                if (Contains(m.X, m.Y))
                    Strandedness.EventSink_Login(new LoginEventArgs(m));
            }
            list.Clear();
            list = null;
            entities = null;
            if (secondPass)
                OnSink(false);
        }
 

joshw

Sorceror
Ok I somewhat understand that very rusty when comes to scripting lol. I tried what you suggested and gets two errors now not sure why the strandedness is giving me an error now im sure I can figure that one uot but here are the errors.

Code:
RunUO - [https://github.com/runuo/] Version 2.5.0.24991
Core: Running on .NET Framework Version 4.0.30319
Core: Optimizing for 2 64-bit processors
Core: Server garbage collection mode enabled
RandomImpl: CSPRandom (Software)
Scripts: Compiling C# scripts...failed (1 errors, 72 warnings)
Errors:
+ Multis/Boats/High Seas/BaseGalleon.cs:
    CS0103: Line 187: The name 'GetMovingEntities' does not exist in the current
context
    CS0103: Line 202: The name 'Strandedness' does not exist in the current cont
ext
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

Ok Fixed the error with the strandedness lol simple fix
 
Top