What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal
RebornBuddy Forums

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!

Object reference not set ... UGH

Exmortem

Community Developer
Joined
Mar 28, 2010
Messages
799
I can't figure out why i'm getting an object reference error here.

Code:
                new Decorator(ret =>
                {
                if (!Core.Player.HasTarget)
                    return false;


                if (!(Core.Player.CurrentTarget as BattleCharacter).IsCasting)
                    return false;


                if (!Actionmanager.CanCast("Blunt Arrow", Core.Player.CurrentTarget))
                    return false;


                return true;
                },
                new Action(ret =>
                {
                string[] interrupts = { "Cure", "Cure II", "Cure III", "Medica", "Medica II", "Raise", "Heartstopper", "Thunder", "Fortis" };


                var castingspell = (Core.Player.CurrentTarget as BattleCharacter).SpellCastInfo;        
                foreach (string s in interrupts)
                {
                    if (s != "")
                    {
                        if (castingspell.SpellData.Name.Contains(s))
                        {
                            Actionmanager.DoAction("Blunt Arrow", Core.Player.CurrentTarget);
                        }
                        return;
                    }


                }
                })),

I'm only beginning at this so I don't know if the code is even close to correct. I'm just trying to get it to interrupt whenever the string array matches to whatever my current target is casting. I'm stuck, I get an object reference error...

Code:
[15:46:04.280 D] System.NullReferenceException: Object reference not set to an instance of an object.
   at Kupo.Rotations.ArcherBard.<CreateCombat>b__b(Object ret)

It only happens whenever the current target is actually casting a spell and it doesn't crash the bot, just pauses it till the spell is done being cast and then continues with the rotation. If anyone can point my error out to me i'd appreciate it!
 
So i've tried this code ...

Code:
                new Decorator(ret => 
                {
                    if (!(Core.Player.CurrentTarget as BattleCharacter).IsCasting)
                        return false;


                    if ((Core.Player.CurrentTarget as BattleCharacter).SpellCastInfo != null)
                    {
                       return true;
                    }


                    return false;
                },
                new Action(ret => {
                    Cast("Blunt Arrow");
                })),

and it's never used Blunt Arrow on an enemy casting a spell, so obviously that means that SpellData is returning null. I don't know how to correct that.
 
Code:
string[] interrupts = { "Cure", "Cure II", "Cure III", "Medica", "Medica II", "Raise", "Heartstopper", "Thunder", "Fortis" };

move this outside the function definition then use

Code:
Cast("Blunt Arrow", r => (Core.Player.CurrentTarget as BattleCharacter) != null && interrupts.Contains((Core.Player.CurrentTarget as BattleCharacter).SpellCastInfo.Name)),

That should work fine, if not open up the rebornconsole and try something like

Code:
Log((Core.Player.CurrentTarget as BattleCharacter).SpellCastInfo.Name);
and see what it spits out while the target is casting.
 
I'll give that shot, thanks much! Totally forgot about the reborn console!
 
SpellData is returning null it seems.

Code:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at ff14bot.Objects.SpellCastInfo.get_Name()
   at Driver.Run() in c:\Users\David\Desktop\RB\Plugins\RebornConsole\Temp\yx3wf1hl.0.cs:line 29

That was run through the console.
 
Don't use spelldata, spellcast is not guaranteed to be a spell.
 
Don't use spelldata, spellcast is not guaranteed to be a spell.
My mistake, this is what I used.
Code:
[COLOR=#333333]Log((Core.Player.CurrentTarget as BattleCharacter).SpellCastInfo.Name);[/COLOR]

It's the code you provided for the console, it's SpellCastInfo, not SpellData, it's returning an object reference error when I run the code and the enemy is casting. I'm sorry if i'm misunderstanding what you meant.
 
I've tried it on multiple enemies out the Ceruleum Processing Plant area.

lvl49 Earth Sprite casting Stone.
lvl49 Cohort casting Fortis
lvl49 Cohort Signifier casting Thunder

All return object error.
 
Looks like the database got truncated a bit in the last release. I'll push a version out in a bit with a fix.
 
Back
Top