Jump to content

Recommended Posts

Posted

HI,

 

i have an prefab entity with an script attached.

so i want to load by lua code and set 2 "target" entity vars.

 

but the Script:start() is in the moment i load the prefab running and wants to access my 2 "target" vars which are nil then.

 

must i handle this by myself with some code or is there a way to prevent an Script in Prefab from running after loading it by code?

 

 

the script loading the cow.pfb


self.enemy=Prefab:[b]Load("Prefabs/cow.pfb")[/b]
self.enemy.script.spawnpoint1=self.entity
self.enemy.script.spawnpoint2=self.spawn2

 

the scrip in the cow.pfb

Script.spawnpoint1 = nil--Entity "SP1"
Script.spawnpoint2 = nil--Entity "SP2"

function Script:Start()
[b] self.xplus=self.spawnpoint2:GetPosition().x[/b]
self.first=true
....

 

 

cu

Volker

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...