reference i.d. error in Script

Post » Sun Jan 24, 2010 7:26 am

I have wrote various scripts for "creatures or npcs" and I always get the error that the object reference can't be found. Most notably on this script:
begin mc_drathisvondeliquireComshort equallevelshort levelmaxshort swordcheckshort swordcheckerfloat myx float myy float myz float timerif ( GetCurrentAIPackage == 3 ) 	if ( Player->GetEffect sEffectLevitate == 1 ) 		AIWander 0 0 0 0 	endif 	if ( GetWeaponDrawn == 1 ) 		return 	elseif ( GetDistance Player > 800 ) 		set timer to timer + GetSecondsPassed 			if ( timer > 8 ) 				set timer to 0 				set myx to ( Player->GetPos x ) 				set myy to ( Player->GetPos y ) 				set myz to ( Player->GetPos z ) 				SetPos x myx 				SetPos y myy 				SetPos z myz 			endif 	endif endif if ( levelmax == 1 )	"player"->getlevel	set equallevel to getlevel		if ( equallevel <= 5 )			"01mc_drathisvduire"->setmediumarmor, 40			"01mc_drathisvduire"->setlongblade, 40			"01mc_drathisvduire"->setunarmored, 40			"01mc_drathisvduire"->setspeed, 100		elseif ( equallevel >= 6 )			if ( equallevel <= 10 )				"01mc_drathisvduire"->setmediumarmor, 50				"01mc_drathisvduire"->setlongblade, 50				"01mc_drathisvduire"->setunarmored, 50			elseif ( equallevel <= 15 )				"01mc_drathisvduire"->setmediumarmor, 60				"01mc_drathisvduire"->setlongblade, 60				"01mc_drathisvduire"->setunarmored, 60			elseif ( equallevel <= 20 )				"01mc_drathisvduire"->setmediumarmor, 70				"01mc_drathisvduire"->setlongblade, 70				"01mc_drathisvduire"->setunarmored, 70			elseif ( equallevel <= 25 )				"01mc_drathisvduire"->setmediumarmor, 80				"01mc_drathisvduire"->setlongblade, 80				"01mc_drathisvduire"->setunarmored, 80			elseif ( equallevel <= 30 )				"01mc_drathisvduire"->setmediumarmor, 90				"01mc_drathisvduire"->setlongblade, 90				"01mc_drathisvduire"->setunarmored, 90			elseif ( equallevel >= 31 )				"01mc_drathisvduire"->setmediumarmor, 100				"01mc_drathisvduire"->setlongblade, 100				"01mc_drathisvduire"->setunarmored, 100			endif		endifendifif ( swordcheck == 0 )	set swordchecker to GetItemCount, "1DLScimitar"		if ( swordchecker == 0 )			"01mc_drathisvduire"->additem "1DLScimitar" 1			"01mc_drathisvduire"->equip "1DLScimitar"		elseif ( swordchecker == 1 )			set swordcheck to 1		endifendifif ( swordcheck == 1 )	set swordchecker to GetItemCount, "1DLScimitar"				if ( swordchecker == 0 )			set swordcheck to 0		endifendif	end


It says that everytime "01mc_drathisvduire" is there it's not found.
Would this work instead though? It's going to be attatched to the npc.
begin mc_drathisvondeliquireComshort equallevelshort levelmaxshort swordcheckshort swordcheckerfloat myx float myy float myz float timerif ( GetCurrentAIPackage == 3 ) 	if ( Player->GetEffect sEffectLevitate == 1 ) 		AIWander 0 0 0 0 	endif 	if ( GetWeaponDrawn == 1 ) 		return 	elseif ( GetDistance Player > 800 ) 		set timer to timer + GetSecondsPassed 			if ( timer > 8 ) 				set timer to 0 				set myx to ( Player->GetPos x ) 				set myy to ( Player->GetPos y ) 				set myz to ( Player->GetPos z ) 				SetPos x myx 				SetPos y myy 				SetPos z myz 			endif 	endif endif if ( levelmax == 1 )	"player"->getlevel	set equallevel to getlevel		if ( equallevel <= 5 )			setmediumarmor, 40		  	setlongblade, 40			setunarmored, 40			setspeed, 100		elseif ( equallevel >= 6 )			if ( equallevel <= 10 )				setmediumarmor, 50				setlongblade, 50				setunarmored, 50			elseif ( equallevel <= 15 )				setmediumarmor, 60				setlongblade, 60				setunarmored, 60			elseif ( equallevel <= 20 )				setmediumarmor, 70				setlongblade, 70				setunarmored, 70			elseif ( equallevel <= 25 )				setmediumarmor, 80				setlongblade, 80				setunarmored, 80			elseif ( equallevel <= 30 )				setmediumarmor, 90				setlongblade, 90				setunarmored, 90			elseif ( equallevel >= 31 )				setmediumarmor, 100				setlongblade, 100				setunarmored, 100			endif		endifendifif ( swordcheck == 0 )	set swordchecker to GetItemCount, "1DLScimitar"		if ( swordchecker == 0 )			additem "1DLScimitar" 1                        equip "1DLScimitar"		elseif ( swordchecker == 1 )			set swordcheck to 1		endifendifif ( swordcheck == 1 )	set swordchecker to GetItemCount, "1DLScimitar"				if ( swordchecker == 0 )			set swordcheck to 0		endifendif	end

It doesn't specify who get's the stat updates and all, but that's okay since it's attatched to the npc right?
User avatar
Loane
 
Posts: 3411
Joined: Wed Apr 04, 2007 6:35 am

Post » Sun Jan 24, 2010 2:38 pm

Im sure youve been told this before, but putting numbers at the start of ID's is not the best idea.. I assume youve really checked closely and made sure the id is copied correctly ;)
User avatar
Vicki Blondie
 
Posts: 3408
Joined: Fri Jun 16, 2006 5:33 am

Post » Sun Jan 24, 2010 10:10 pm

It says that everytime "01mc_drathisvduire" is there it's not found.
You can reference from scripts already placed ( in TESCS render window ) references.
It doesn't specify who get's the stat updates and all, but that's okay since it's attatched to the npc right?
Yes, whenever possible (for instance, from local scripts), using the implicit reference is simpler/faster.

P.S. I think you forgot a assignment
        "player"->getlevel        set equallevel to getlevel

                set equallevel to ( "player"->getlevel ) 

User avatar
rae.x
 
Posts: 3326
Joined: Wed Jun 14, 2006 2:13 pm

Post » Sun Jan 24, 2010 10:48 am

Im sure youve been told this before, but putting numbers at the start of ID's is not the best idea.. I assume youve really checked closely and made sure the id is copied correctly ;)



You can reference from scripts already placed ( in TESCS render window ) references.
Yes, whenever possible (for instance, from local scripts), using the implicit reference is simpler/faster.

P.S. I think you forgot a assignment
        "player"->getlevel        set equallevel to getlevel

                set equallevel to ( "player"->getlevel ) 


Haha yes, i made sure that it was the same i.d., to no avail. And abot, thank you for pointing that out. I was unsure of house to go about it, thanks for showing me :D
User avatar
vanuza
 
Posts: 3522
Joined: Fri Sep 22, 2006 11:14 pm


Return to III - Morrowind