Jump to content

Assign script file in lua


Skrakle
 Share

Recommended Posts

I've created a pivot, attached script CollisionTriggers.lua and i loaded it. Now i'm trying to attach it to the entity. I've tried this:

 

 

App.lua

   entity[0]={};
   entity[0]=LoadEntity("Models/Characters/Dwarf/dwarfmale_run.mdl",10,0,-20,0.05,1,Collision.Character,Entity.CharacterPhysics);

   local parent=entity[0]:GetParent();
   if (parent~=nil) then
  	 Prefab:Load("Prefabs/collisions_generic.pfb")
   end

 

 

CollisionTriggers.lua

function Script:Start()
   self.enabled=true
end

function Script:Collision(entity, position, normal, speed)
   if self.enabled then
       self.component:CallOutputs("Collision")
   end
end

function Script:Enable()--in
   if self.enabled==false then
       self.enabled=true
       self:CallOutputs("Enable")
   end
end

function Script:Disable()--in
   if self.enabled then
       self.enabled=false
       self:CallOutputs("Disable")
   end
end

 

parent returns nil... How do i attach it to the entity?

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...