Jump to content

extends TopicInfo script problem


Guest

Recommended Posts

Posted

Hey all,

 

 

Just seeing if someone might be able to shed some light on this problem.

 

As fas as I can see this should be the easiest thing to do...

 

I want to unequip all the players items after a certain topic as been selected. To do this I've added a script to the topic in the creation kit. Code in the script is this...

 

Scriptname _SDSTestStripScript extends TopicInfo  
 
Actor Property thePlayer  Auto  
 
thePlayer.UnEquipAll()
 
 
I've set up thePlayer so it is correctly referenced in the script properties but when I compile the script it throws an error of 
 
no viable alternative at input '.'
 
I am somewhat confused as to why it is not working. The UnequipAll() function is part of the Actor script so it should work?
Posted

When you add a fragment in a TopicInfo (or a package, or a Scene), there are two parts of the script.

 

The header and the properties:

 

Scriptname _SDSTestStripScript extends TopicInfo  
Actor Property thePlayer  Auto  
And then the fragments.
 
The code cannot be placed anywhere. It has to be inside a specific function called fragment_XXX()
 
Remove the line "theplayer.unequipall()", and place it inside the "start" or "end" windows tat are on the left of the TopicInfo window.
After you exit the topicinfo (to compile it), and then open it again, you will see something like this when you open the full script:
 
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 1
Scriptname __SDSTestStripScript Extends TopicInfo Hidden

;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE

thePlayer.unequipall()
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

Actor Property thePlayer  Auto 
 
You can NOT create the Fragment_XXX functions on your own, you need the CK to create them, because the indexes are generated and stored inside the TopicInfo object.
 

 

Posted

Gah.....after all that it was super simple.

 

Thanks CPU that worked perfectly :)

Posted

You welcome.


Small advice:

 

If you call your property:

Actor Property PlayerRef Auto

then it will be autofilled with a single click.

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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