Jump to content

[LE] Force Quest Alias from Script


Recommended Posts

Hi all,

 

I'm having a problem getting my script to fill the empty quest aliases I've left.

 

Basically, the parent script extends ReferenceAlias and is attached to an alias in my handler quest. Properties not mentioned here are defined in the parent as ReferenceAlias or Global. For the 3 lines with ForceRefTo, where I am trying to Force the Aliases into new object references I get the error at the bottom of this post.

Scriptname PKY_AirshipFlagScript extends PKY_AirshipScript  
{Extends the Airship Script to set new destinations}

;;These properties are defined per activator instance.
ObjectReference Property NewDestinationShip Auto 
ObjectReference Property NewDestinationMarker Auto
ObjectReference Property NewDummyHelm Auto
Message Property HeadingMessage Auto
Int Property NewHeadingNumber Auto

Event OnActivate (ObjectReference akActionRef)
	if akActionRef == Game.GetPlayer() && DBM_Destination.Value == 0 ;Checks for 0 as this is default.
		int FormCheck = DBM_AirshipsFLST.Find(DestinationShip.GetReference())
		if FormCheck == -1 ;Checks if current ship is in formlist to disable.
			DBM_AirshipsFLST.AddForm(DestinationShip.GetReference()) ;Add current ship to Formlist
			debug.notification("Added current ship to FormList.")
		endif
		DBM_Destination.SetValue(NewHeadingNumber) ;Update destination value
		Debug.notification("DBM Destination set to"+DBM_Destination)
		DestinationShip.ForceRefTo(NewDestinationShip) ;Change defined ship to new one
		DestinationMarker.ForceRefTo(NewDestinationMarker) ;Update new teleport marker
		DummyHelm.ForceRefTo(NewDummyHelm) ;Updates helm movement location
		HeadingMessage.Show() ;Show confirmation message to player.
	elseif DBM_Destination.Value == NewHeadingNumber
		Debug.notification("This is already my current course.")
	endif
EndEvent 
%filepath%(20,2): type mismatch while assigning to a referencealias (cast missing or types unrelated)

Am I doing something really dumb?

 

Thanks

Edited by Pickysaurus
Link to comment
Share on other sites

Maybe the next helps you to find the culprit.

 

child script:

 

Scriptname PKY_AirshipFlagScript extends PKY_AirshipScript  
{child script, which extends to parent (the Airship Script) to set a new destinations}

; make sure, all four properties have been attached to parent script
 ;GlobalVariable Property DBM_Destination    auto
 ;ReferenceAlias Property DestinationShip     auto
 ;ReferenceAlias Property DestinationMarker auto
 ;ReferenceAlias Property DummyHelm          auto

; these both properties are child specific, do not use in parent script
  Message Property HeadingMessage      auto       ; make sure every child has different values
  Int     Property NewHeadingNumber = -1 auto     ; make sure ..

; these properties are defined per activator instance.
  ObjectReference Property NewDestinationShip   auto
  ObjectReference Property NewDestinationMarker auto
  ObjectReference Property NewDummyHelm         auto

; -- EVENT --

EVENT OnActivate (ObjectReference akActionRef)
if (akActionRef == Game.GetPlayer() as ObjectReference)
else
    RETURN  ; - STOP - not the player, do nothing
endif
;---------------------
if (DBM_Destination.GetValueInt() == -1)
    Debug.Notification("Missing property.. NewHeadingNumber is -1")
    RETURN  ; - STOP -
endif
;--------------------
if ( DBM_AirshipsFLST )
    Debug.Notification("Missing property.. Airship formlist")
    RETURN  ; - STOP -
endif
;--------------------
if (DBM_Destination.GetValueInt() == NewHeadingNumber)
    Debug.notification("This is already my current course.")
    RETURN  ; - STOP - see notify
endif
;--------------------- at here DBM_Destination.Value is different from NewHeadingNumber
    myF_Action()
ENDEVENT


; -- FUNCTION --

FUNCTION myF_Action()
;--------------------
    objectReference dRef = DestinationShip.GetReference()
    int i = DBM_AirshipsFLST.Find(dRef)

  IF (i == -1)
    DBM_AirshipsFLST.AddForm(dRef)
    Debug.notification("Added current ship to FormList.")
  ENDIF

; Update destination value
  DBM_Destination.SetValue(NewHeadingNumber)
  Debug.notification("DBM Destination set to"+DBM_Destination)

  DestinationShip.ForceRefTo(NewDestinationShip)       ; Change defined ship to new one
  DestinationMarker.ForceRefTo(NewDestinationMarker)   ; Update new teleport marker
  DummyHelm.ForceRefTo(NewDummyHelm)                   ; Updates helm movement location

; Show confirmation message to player.
  HeadingMessage.Show()
ENDFUNCTION

 

 

 

parent script was not posted by you:

 

Scriptname PKY_AirshipScript extends ObjectReference

; four properties attached to parent script
  GlobalVariable Property DBM_Destination   auto
  ReferenceAlias Property DestinationShip   auto
  ReferenceAlias Property DestinationMarker auto
  ReferenceAlias Property DummyHelm         auto

 

 

Link to comment
Share on other sites

Maybe the next helps you to find the culprit.

 

child script:

 

Scriptname PKY_AirshipFlagScript extends PKY_AirshipScript  
{child script, which extends to parent (the Airship Script) to set a new destinations}

; make sure, all four properties have been attached to parent script
 ;GlobalVariable Property DBM_Destination    auto
 ;ReferenceAlias Property DestinationShip     auto
 ;ReferenceAlias Property DestinationMarker auto
 ;ReferenceAlias Property DummyHelm          auto

; these both properties are child specific, do not use in parent script
  Message Property HeadingMessage      auto       ; make sure every child has different values
  Int     Property NewHeadingNumber = -1 auto     ; make sure ..

; these properties are defined per activator instance.
  ObjectReference Property NewDestinationShip   auto
  ObjectReference Property NewDestinationMarker auto
  ObjectReference Property NewDummyHelm         auto

; -- EVENT --

EVENT OnActivate (ObjectReference akActionRef)
if (akActionRef == Game.GetPlayer() as ObjectReference)
else
    RETURN  ; - STOP - not the player, do nothing
endif
;---------------------
if (DBM_Destination.GetValueInt() == -1)
    Debug.Notification("Missing property.. NewHeadingNumber is -1")
    RETURN  ; - STOP -
endif
;--------------------
if ( DBM_AirshipsFLST )
    Debug.Notification("Missing property.. Airship formlist")
    RETURN  ; - STOP -
endif
;--------------------
if (DBM_Destination.GetValueInt() == NewHeadingNumber)
    Debug.notification("This is already my current course.")
    RETURN  ; - STOP - see notify
endif
;--------------------- at here DBM_Destination.Value is different from NewHeadingNumber
    myF_Action()
ENDEVENT


; -- FUNCTION --

FUNCTION myF_Action()
;--------------------
    objectReference dRef = DestinationShip.GetReference()
    int i = DBM_AirshipsFLST.Find(dRef)

  IF (i == -1)
    DBM_AirshipsFLST.AddForm(dRef)
    Debug.notification("Added current ship to FormList.")
  ENDIF

; Update destination value
  DBM_Destination.SetValue(NewHeadingNumber)
  Debug.notification("DBM Destination set to"+DBM_Destination)

  DestinationShip.ForceRefTo(NewDestinationShip)       ; Change defined ship to new one
  DestinationMarker.ForceRefTo(NewDestinationMarker)   ; Update new teleport marker
  DummyHelm.ForceRefTo(NewDummyHelm)                   ; Updates helm movement location

; Show confirmation message to player.
  HeadingMessage.Show()
ENDFUNCTION

 

 

 

parent script was not posted by you:

 

Scriptname PKY_AirshipScript extends ObjectReference

; four properties attached to parent script
  GlobalVariable Property DBM_Destination   auto
  ReferenceAlias Property DestinationShip   auto
  ReferenceAlias Property DestinationMarker auto
  ReferenceAlias Property DummyHelm         auto

 

 

 

Thanks for the reply, it seems the complier craps out if using CK through ModOrganiser... ran CK normally and it compiled just fine...

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...