Hello to all, I was wondering if anyone out there on the this wide world of 8 billion people could lend me just a moment of there time and help me out with some scripting problems I’ve being having.
Know you see the I’ve being trying to make a simply script (call it SwitchScript)that once working will be attached to (lets call it) a zombie, this script would enable/disable two other scripts (Waypoint and Player Follow) depending on whatever the player enters the zombies collider.
So far I’m writing out a basic script which I think in theory should work (more then likely won’t though), however no matter what I do I keep getting the following error…
NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.SetProperty (System.Object target, System.String name, System.Object value)
SwitchScript.OnTriggerEnter (UnityEngine.Collider other) (at Assets/AIProject-UnderWork/SwitchScript.js:21)
Know I’ve tried Google what it means and what I’ve being able to gather is that the script is trying to call on something that has not being defined and is therefore unable to found said thing. If that’s not right can you tell me, that way I’ll get better at scripting.
Anyway as you can see I’ve attached (below) the script that I’ve writing up, if anyone can look over it for me and point out whats wrong/not working and give some tips I would be gratefully.
var switchScript = false;
function OnTriggerEnter(other : Collider) {
if(switchScript)
{
GetComponent("Path Follow").enabled = false;
GetComponent("Move To Object").enabled = false;
GetComponent("Enemgy Follow").enabled = true;
}
else
{
GetComponent("Path Follow").enabled = true;
GetComponent("Move To Object").enabled = true;
GetComponent("Follow").enabled = false;
}
}
Just encase anyone asks, the “Path Follow”,“Move To Object” and “Follow” are the scripts that I’m trying to get working.
Go dtí an chéad uair eile, slán leat