Krelle
-
Posts
9 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Posts posted by Krelle
-
-
Thats because 'self' in that function does not exist.
This totally makes sense, so what do i replace self with in order for the function to work as intended ?
-
'Script.Material1' is not a material. For 'entity:SetMaterial()' to work, you have to either load a material using 'Material:Load()' or create a material using Material:Create().
Thank you for replying to my problem. I tried out loading the material in the manner you suggested, however it still does not work. Leadwerks produce the following error message when I call the function from another script :
attempt to index global 'self' (a nil value)in the function :
function test123() mymaterial = Material:Load("/path/to/texture/texturename.mat") self.entity.SetMaterial(mymaterial) end
The script works, if I use it within the script attached to the object :
function Script:Collision(entity, position, normal, speed) if (entity:GetKeyValue("name") == "Player") then mymaterial = Material:Load("/path/to/texture/texturename.mat") self.entity:SetMaterial(mymaterial) end
-
Pivots are not collidable, use an invisible csg box instead.
Thank you for your help. This information was very useful to me, now I am getting error messages. However the original problem persists as I cant use self.entity to change an external object. What do i replace the self.entity with, in order to get the following function to work, when it is called from another script ?
Script.Material1 = "" --path function test123() self.entity:SetMaterial(self.Material1) end
to be a little more clear "self" must be referring to the object attached to the script or the script itself. But if you don't want to refer to the object itself but a different object, what do you use ? I Imagen it would be something like
box2.entity:SetMaterial(box2.Material1)
however this is not working
-
You are colliding with the entity that is pressumably the box? If so do the following:
entity.script:YourFunction()
Thank you for replying to my question. I am colliding with a pivot, not the box itself. Please excuse me for my badly formulated post, english is not my first language. I will do my best to try and formulate myself more clearly.
Below is a picture of my scene
Below is the (not working) code for the pivot right in front of the player
function Script:Collision(entity, position, normal, speed) if (entity:GetKeyValue("name") == "Player") then CallFunction("test123"); end end
below is the code for box1
Script.Material1 = "" --path function test123() self.entity:SetMaterial(self.Material1) end
I want the material on box1 to change when I collide with the pivot.
Please note that the code I posted, probably is wrong, and is only here to demonstrate what i wish to achieve
-
Firstly I am sorry if this question has been answered over 100 times before. I have searched the forum without finding an usable answer, on how to do this in Lua. I have tried out code, I thought might work or be related without getting the result i wanted.
I have a pivot.When the player collides with the pivot, I want to change the texture on a different object lets call it box1
the collision and change of texture is not a problem. The problem is how I change the box's texture from within the script of the pivot
below is an example of an failed attempt at calling a function within a diffrent script. This script would be attached to the pivot
function Script:Collision(entity, position, normal, speed) if (entity:GetKeyValue("name") == "Player") then // the function test123 is located inside the script attached to box1 CallFunction("test123"); end end
-
I really wish LETheora would work. Currently it's not. I know small game designers should not focus on cut scenes and movies. But I think this is diffrent. The ability to play video inside leadwerks would be great because it would allow stuff like talking pictures, old television sets, shock effects where texture suddenly change into some scary movie clip and a whole lot of other cool stuff.
-
Granted this only works now with the '2014-09 - Archive' or '2014-08 - Archive'... It appears Josh has changed something in the engine that causes a c++ runtime error now whenever this library is used.
Thank you for replying to my question, I greatly appreciate it.
I guess it wont work with the version I am running then. I disabled Lua sandboxing and in debug mode im getting
on line 221, as beforeinvalid ELF headertoo bad it can't run, it looked really cool in the video presented
-
Greetings
I am a newbie when it comes to the leadwerks engine and lua in general.
I am trying to get LETheora to play videos in my game
I assigned an ogg file to the script, but when i try to run it i get the following error message :
Script Errorattempt to index global 'package' (a nil value)
Line 221
The error occours in the following function
function TheoraVideo:Init() if self.initialized == 0 then assert(package.loadlib("LETheora.dll", "luaopen_theoravideo"))() theoravideo.init() self.initialized = 1 end
Please help
Video player
in Suggestion Box
Posted
this is a actually good solution for short animations. But it can never replace a real video player with audio