-
Posts
517 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Genebris
-
-
I'm gettings a material from csg without script or mass. Do you get the surface?
tolua.cast(pickinfo.entity, "Model"):GetSurface(0):GetMaterial()
- 1
-
You didn't include textures with a map, but I'll download something else anyway.
-
Yes, it works now.
This should be mentioned here: http://www.leadwerks.com/werkspace/page/api-reference/_/prefab/prefabload-r622
-
You need two scripts for one object? Add a child pivot and use second script on it.
- 1
-
This returns mousewheel position
http://www.leadwerks.com/werkspace/page/api-reference/_/window/windowgetmouseposition-r455
- 1
-
You can remove main.system to make the function global by itself.
function CallFunction(entity, func, a,b,c)
This fragment simply calls needed function with optional parameters. You don't have to use any parameters, or you can use only two of them because it's Lua.
...
func = "Hurt"
a = 5 --damage
b = "Magic" --damage type
--C not used
entity.script[func](entity.script,a,b,c)
...
You need to pass entity.script as a first parameter because you are calling function via "." instead of ":"
I think I wasn't able to call it with ":" this way, so I passed script manually.
When you have global function created all you need to do is this:
local e = Prefab:Load("prefabs/myprefab.pfb")
CallFunction (e, "Start")
-
I made this function so I can call something on all child objects at any time from any script.
function main.system:BroadcastMessage(entity, func, a,b,c)
if entity.script and type(entity.script[func])=="function" then entity.script[func](entity.script,a,b,c) end
for i=0, entity:CountChildren()-1 do
local child = entity:GetChild(i)
if child:CountChildren()~=0 then self:BroadcastMessage(child, func, a,b,c) end
if child.script and type(child.script[func])=="function" then child.script[func](child.script,a,b,c) end
end
end
- 1
-
http://www.leadwerks.com/werkspace/page/api-reference/_/math/mathcurve-r602
Use this to slide camera to the second position. When it's almost reached start sliding to the base position. Repeat after 2 seconds.
-
Why don't you move camera down or to the side for a moment every one or two seconds?
-
-
Maybe you want to use SetVelocity? Or you could reduce friction to allow smaller forces.
-
Remember last map you loaded into a variable or have a script on the map that tells you which one it is then this into UpdateWorld:
if window:KeyHit(Key.R) then
World:GetCurrent():Clear()
Map:Load("maps/"..self.map..".map")
end
-
Prefab:Load("prefabs/projectiles/arrow.pfb")
Prefab:Load("prefabs/projectiles/arrow.pfb",Map.LoadScripts,Prefab.NoStartCall)
First function will load prefab correctly, second one will fail to load it. This will be in the log:
Loading prefab "C:/Users/Genebris/Desktop/SotKaal/prefabs/projectiles/arrow.pfb"...
..
Loading prefab "prefabs/projectiles/arrow.pfb" [32]...
Error: Failed to read file "prefabs/projectiles/arrow.pfb".
Error: Failed to load prefab "prefabs/projectiles/arrow.pfb".
You can see that second call didn't get a correct file path. This happens ONLY in published game (standalone or launcher). Does NOT matter if you included only used files or not.
It doesn't happen in the editor or if you launch exe in your project folder.
I'm not sure if this is the correct use of loading flags, but if it's not, it should at least give the same error in the editor because I spent 40 minutes thinking that my prefab doesn't get included into the build.
-
Why do you need shader? Why don't you use particle emitter?
- 1
-
You need blend mode set to alpha, z sort enabled and change diffuse color to half transparent. There is also default glass material in Materials/Effects in FPS template. But all half transparent materials really don't work well in Leadwerks, they won't receive shadows.
- 1
-
Has this been added? I need it for tournament
-
Or don't use character controller at all, depends on how important it is for your game.
- 1
-
Friction won't work, I had to use rigid body for skiing.
- 1
-
Context and Window are different classes, SetColor is a method of Context class:
http://www.leadwerks.com/werkspace/page/api-reference/_/context/
KeyHit is in Window class:
http://www.leadwerks.com/werkspace/page/api-reference/_/window/
That's why you can't use KeyHit on context and SetColor on window.
-
Nav mesh won't work, that's right. Default AI script obviously won't work. Other than that you could use character controller, but what are benefits over rigid body then?
-
If I create a prefab of decal with "Paint models" option disabled and load this prefab in code, this decal will still be visible on models and GetRenderMode(Object.ModelClass) will return true.
Though, loading this prefab in editor will work correctly, Paint models will be off.
-
We constantly get new updates. What exactly do you want? What kind of character creation? Leadwerks isn't a tool for modeling.
Josh has shared some of his plans here http://www.leadwerks.com/werkspace/blog/1/entry-1763-preparing-leadwerks-for-the-future/
I also would like improved visuals, mainly full official PBR support, but it's not planned atm.
-
Not enough to care about it.
-
Yes, exactly what I need!
Monthly Script Challenge
in Programming
Posted
I have also used material names to determine sound type, for example, material named "my dark_wood 76" will play "wood" sounds. But my script uses footsteps manager like old animation manager. This way you can use it both for player and NPCs and any other objects.
Supports several sounds per material type, 3D sound, can be played from many characters at the same time, only need 3 lines of code to add to your script (import, create, update).
Main script: https://gitlab.com/Genebris/MSC-Footsteps/blob/master/Scripts/Footsteps.lua
Download project (120 MB): https://gitlab.com/Genebris/MSC-Footsteps/repository/archive.zip?ref=master