Jump to content

Recommended Posts

Posted

i have a script :

simpleMov.lua

 

 

this function

 

function Script:placeProjectile()
local targetpos = self.entity:GetPosition(false) 
   model:SetPosition(targetpos.x,targetpos.y,targetpos.z)

end

 

 

And i would want ot call it from updatePhysics method.

 

 

function Script:UpdatePhysics()
...

self.entity:SetInput(0,move,strafe)

if window:KeyDown(Key.Space) then 
  simplemov:placeProjectile(entity.goblinai)
end

end

 

 

But it don't work ?

Someone know how to call the function ?

Sadly on AI.lua, Player.lua, there is only callbacks, not direct calls as this one i want to do :(

Stop toying and make games

Posted

Found it, in fact the error was comming from parameters.

 

To call it , just use self (that means this script like Java where you can use the keyword "this")

 

   self:placeProjectile()

Stop toying and make games

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...