Exmortem
Community Developer
- Joined
- Mar 28, 2010
- Messages
- 799
I can't figure out why i'm getting an object reference error here.
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...
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!
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!