script problem; type mismatch. How to solve

Post » Wed Jun 20, 2012 7:19 pm

The intention of the script is as follows:

If the object the script is on gets placed in a container an event triggers.
If the new container is dead and is wolfrace THEN some property gets enabled.

[size="1"][size=4]Scriptname TAxidermyeffectscript extends ObjectReference [/size][/size][size="1"][size=4]import actor[/size][/size][size="1"][size=4]actor property Containeractor auto [/size][/size][size="1"][size=4]Objectreference property stuffedwolf auto [/size][/size][size="1"][size=4]Race property wolfrace auto[/size][/size][size="1"][size=4]Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) [/size][/size][size="1"][size=4]			  debug.messagebox ("container changed") [/size][/size][size="1"][size=4]			  Containeractor = akNewContainer [/size][/size][size="1"][size=4]					    if ( Containeractor.IsDead() ) && ( wolfrace == Containeractor.GetRace() ) [/size][/size][size="1"][size=4]								   debug.messagebox ("dead is true")[/size][/size][size="1"][size=4]								  stuffedwolf.enable() [/size][/size][size="1"][size=4]					    else[/size][/size][size="1"][size=4]								  ;nothing[/size][/size][size="1"][size=4]					    endif[/size][/size][size="1"][size=4]				 debug.messagebox ("after if")[/size][/size][size="1"][size=4]endEvent[/size][/size][size="1"][size=3]
[/size] [/size]

this gives the error

Starting 1 compile threads for 1 files...
Compiling "Taxidermyeffectscript"...
c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Taxidermyeffectscript.psc(11,5): type mismatch while assigning to a actor (cast missing or types unrelated)
No output generated for Taxidermyeffectscript, compilation failed.
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on Taxidermyeffectscript



so I assume it is probably due to aknewcontainer being an objectreference and containeractor (the property) an actor.


If I make the property objectreference then I don't get this error (seems logical since I want to set one objectreference as another)
BUT since it then is an objectreference I CAN'T call the actor scripts .isdead() and .getrace on it anymore


How do I solve this problem?
User avatar
Lillian Cawfield
 
Posts: 3387
Joined: Thu Nov 30, 2006 6:22 pm

Post » Thu Jun 21, 2012 1:12 am

You need to fix the formatting on your post...

Anyway, just cast your Containeractor property as an ObjectReference.


Containeractor as ObjectReference = aknewcontainer
User avatar
Del Arte
 
Posts: 3543
Joined: Tue Aug 01, 2006 8:40 pm

Post » Thu Jun 21, 2012 6:47 am

ah but as I said: if I do that I can't use the .isdead and .getrace functions on it anymore.. which is essential

any workaround options?
User avatar
LittleMiss
 
Posts: 3412
Joined: Wed Nov 29, 2006 6:22 am

Post » Wed Jun 20, 2012 3:57 pm

ContainerActor = akNewContainer as Actor
User avatar
Jason Rice
 
Posts: 3445
Joined: Thu Aug 16, 2007 3:42 pm

Post » Wed Jun 20, 2012 5:37 pm

It compiles...

now to see if it's workin as intended
User avatar
Emma
 
Posts: 3287
Joined: Mon Aug 28, 2006 12:51 am

Post » Wed Jun 20, 2012 8:44 pm

ah but as I said: if I do that I can't use the .isdead and .getrace functions on it anymore.. which is essential

any workaround options?

Can't you import where those functions are?

Something like "import utility", or some-such
User avatar
JR Cash
 
Posts: 3441
Joined: Tue Oct 02, 2007 12:59 pm

Post » Wed Jun 20, 2012 3:02 pm

YES my stuffedwolves appear!!!!

I'll have my hall of stuffed animals functioning now

RANDOMNOOB = HERO

thanks all for fast help!
User avatar
BaNK.RoLL
 
Posts: 3451
Joined: Sun Nov 18, 2007 3:55 pm


Return to V - Skyrim