Author Topic: Object Reference not set to an instance of an object?  (Read 3981 times)

Imagamer

  • Guest
Object Reference not set to an instance of an object?
« on: May 16, 2010, 02:14:29 PM »
I'm making a level, but when I try to test it, I get an error saying "Object reference not set to an instance of an object."

Here's the code.

Code: [Select]
function LevelSetup()

SetBackdropColour(255,255,255)

Globals.Agents.MaxSpeed=(800)
Globals.Agents.MinSpeed=(310)

Globals.Asteroids.MinSendDistance=(9500)
        Globals.Asteroids.MaxSendDistance=(10000)
Globals.Asteroids.MinRadius=(700)
Globals.Asteroids.MaxRadius=(1200)

-- I included the AI variables to save time with
-- anyone who wanted to change the difficulty.

--But instead of modifying the difficulty of each level
--one by one, you can always modify Default.xml

--Globals.AI.MinScoutTime=
--Globals.AI.MaxScoutTime=
--Globals.AI.MinScoutableArmy=
--Globals.AI.MinBattleAnalysisTime=
--Globals.AI.MaxBattleAnalysisTime=
--Globals.AI.Cowardice=
--Globals.AI.BattleSavvy=
--Globals.AI.RecognisableThreatProportion=
--Globals.AI.ReinforcementGreed=
--Globals.AI.AidEnthusiasm=
--Globals.AI.MinExpansionTime=
--Globals.AI.MaxExpansionTime=
--Globals.AI.MinExpansionForce=
--Globals.AI.ExpandToValuableAsteroidChance=
--Globals.AI.Globals.AI.=
--Globals.AI.ExpandBlind=
--Globals.AI.MinAttackTime=
--Globals.AI.MaxAttackTime=
--Globals.AI.MinPlantTime=
--Globals.AI.MaxPlantTime=
--Globals.AI.MinFlowerTime=
--Globals.AI.MaxFlowerTime=
--Globals.AI.MinGatherTime=
--Globals.AI.MaxGatherTime=
--Globals.AI.MinTotalSeedlings=
--Globals.AI.MinTotalAddPerAsteroid=

Globals.G.EnemyFactionsMin=(5)
Globals.G.EnemyFactionsMax=(7)
Globals.G.MinAsteroidSeparation=(9000)
Globals.G.MaxAsteroidNeighbourDist=(9500)
Globals.G.StartingSeedlings=(75)
Globals.G.GreysProbability=(50)
Globals.G.GreysMin=(20)
Globals.G.GreysMax=(30)
Globals.G.BeltRadius=(6000)
Globals.G.BeltWidth=(8000)
Globals.G.Asteroids=(30)

end

function LevelLogic()

end

Can someone tell me what went wrong?

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Object Reference not set to an instance of an object?
« Reply #1 on: May 16, 2010, 09:33:33 PM »
That error occurs if LevelSetup was not able to connect up all the asteroids.

This lines here are the likely culprit:

Code: [Select]
Globals.G.MinAsteroidSeparation=(9000)
Globals.G.MaxAsteroidNeighbourDist=(9500)
Globals.Asteroids.MinSendDistance=(9500)
Globals.Asteroids.MaxSendDistance=(10000)

Try decreasing the value of G.MinAsteroidSeperation to something like 1000.  Increase all the other values to like 30000 and then test if the level now loads correctly.  :>

Imagamer

  • Guest
Re: Object Reference not set to an instance of an object?
« Reply #2 on: May 18, 2010, 04:58:19 AM »
Fixed the problem by changing the Min and Max send distances (+2000 each). Thanks for the help annik.exe.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Object Reference not set to an instance of an object?
« Reply #3 on: May 18, 2010, 05:19:28 PM »
No worries :>  How is your level coming along?  Give us a shout if you need any more help!  :>

AWS

  • Achiever
  • Arboreal Being
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 275
Re: Object Reference not set to an instance of an object?
« Reply #4 on: June 22, 2010, 05:24:34 AM »
has this been released yet? ???