-
Posts
7,936 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Rick
-
When I try to update a project it tells me I have no template folder for this project and to pick one. What folder should I be picking here? I tried a couple and nothing seemed to work.
-
OK, here is an example of something that happens to me but I wasn't able to get a good example before now. Load this project and open start.map. Inside is a Star and Heart model. I first created the Heart.lua script by right clicking in the Assets folder and doing new script. Later I wanted to add the star script. So I did the same thing. Right click in the same folder and select new script. I gave it the name Star.lua. This overwrote the existing script (the Heart.lua) to Star.lua and left a script named New script.lua. This of course is incorrect. The kicker is the reference that my heart model had to the Heart.lua script changed to Star.lua! Now no matter what I do that reference is still there. If you remove the script attached to the Heart entity and reassign the Heart.lua script, then click off the heart entity then back on you'll see it goes back to Star.lua. I can even delete the Heart entity, bring it back, attach Heart.lua and it still reverts back to Star.lua. Something is stuck in the map file to make it always revert back to Star.lua (which was the original Heart.lua I attached to it but because of the renaming that happened something got really screwed up). This happens to me all the time if I make scripts from the editor in the same folder. Generally I try to make scripts in the directory directly via windows explorer, but this needs to get fixed. https://dl.dropboxusercontent.com/u/1293842/AnimationTutorial.rar
-
LE does not convert .x files for you. There are other programs that can do this. I use Ultimate Unwrap 3D (don't let the name scare you, it has a ton of model format conversions). You can even export to an LE format. It's called GMF (old name) in UU3D but you can use it and rename the extension to .mdl and it'll work. Or you can export to fbx with it.
-
I'm waiting for the ability to release because right now I have bombs spawning and I'm able to shoot them and have them explode, but they stay in memory which means after about a minute of playing the game the physics starts getting out of hand.
-
@Shirk you can turn shadows off for the hands model.
-
LUA Editor, jump one word forward/backward using Ctrl. + Cursor
Rick replied to Mordred's topic in Suggestion Box
+1 This bothers me to no end because I use this all the time when programming. -
You have to do it in the model editor. Dbl click the model in the assets folder to open the material editor. Then you drag and drop your materials (also in the assets folder) onto the area of the model that should get that material. The save the model. I don't believe you can do this outside of the model editor and directly in the level editor.
-
(solved) Error when passing "context" from PostRender to another function
Rick replied to Mordred's topic in Programming
If I said that I might have said avoid touching App.lua at all costs, but with something like this, and saving data like in my tutorial, you sort of get stuck doing it. -
(solved) Error when passing "context" from PostRender to another function
Rick replied to Mordred's topic in Programming
This is where the App object (which is in App.lua) comes into play. App is a global object and anything defined in it you have access anywhere from your scripts. I wish there were a better way as I dislike globals, but right now that's what we have. So knowing that, and knowing that the only way you can close the application is by returning false in App:Loop(), a good method would be to create a function in App.lua that will set a variable to false and always return that variable from App:Loop(). ie. App.lua function App:Start() self.running = true end function App:ExitGame() self.running = false end function App:Loop() -- all the other stuff in here -- notice we are returning a variable here. it's set to true, but from our script we call the QuitGame function which sets this to false meaning when the world:Update() method that's in here returns back to this function it'll return false because self.running was changed to false by our script. Note all entity scripts are executed from world:Update() return self.running end Your script: function Script:Menu() -- if click exit button App:ExitGame() end -
(solved) Error when passing "context" from PostRender to another function
Rick replied to Mordred's topic in Programming
No problem. A couple notes which aren't major: You have menuopen defined before PostRender outside of any function. The good news with that is you used local so it's local to this script, and you can do it this way, but it's a little inconsistent. If this is a variable needed in this script then it's probably best to define it in Start() with self.menuopen. You already get the window in Start() and assign it to self.window but you do it again in your Menu() and assign it to a local window variable. No need to do it again. Inside Menu just use self.window. It refers to the same window. -
(solved) Error when passing "context" from PostRender to another function
Rick replied to Mordred's topic in Programming
Your script already has self.button (even before your edit), but yes. Just remember this: Inside an entity script 99% of the time you only want to use local if the variable only needs to be used in said function, and use self.variable if it needs to be accessed anywhere in the script. Also make your script function like: function Script:MyFunction() end And call them like: self:MyFunction() Don't make anything global or you could get some really hard to find bugs that you just can't figure out what is happening because 5 different scripts could be altering the same global variable at different times without you realizing it because it's just too hard to keep track of global variables. -
(solved) Error when passing "context" from PostRender to another function
Rick replied to Mordred's topic in Programming
In the script you have in your post, where are you passing context into menu? You aren't. Also note that your menu function is now global the way you set it up. To make a script level function (which is almost 100% what you want in this case) do the following: function Script:PostRender(context) self:Menu(context, lbl, 5, 6) -- note the colon and not period to call functions instead of access variables end function Script:Menu(context, label, x, y) -- now you can use context in here end This would be what I call the right way to do this. You can also access the global App to get the context via App.context. local context = Context:GetCurrent() You must think this is how you can use context in menu without passing it? The keyword local makes it only viewable inside the function it's created in. In your case the variable context is only available in the Start() function. Also note that your window variable is global the way you have it setup too. To make script level variables use self like: self.window = Window:GetCurrentWindow() Now you can use self.window in this entire script. -
The App object is global so you can do App.world anywhere and get the world.
-
What's the recommended way to release entities during gameplay?
Rick replied to Rick's topic in Programming
I believe releasing an entity should call it's scripts Delete() function, which then we can handle releasing other things the scripts created ourselves. -
Playing particle emitter issue (project example included)
Rick replied to Rick's topic in Leadwerks Engine Bug Reports
You are right that would be faster, but creation speed doesn't seem to be an issue so I'm not worried about it right now. Just want the basics working first. Optimizing something that isn't causing issues isn't something I'm interested in -
Playing particle emitter issue (project example included)
Rick replied to Rick's topic in Leadwerks Engine Bug Reports
That's why I made this post in Bug Reports I have the main character shooting (raycasting) and it plays a cartoon laser type sound. It does the raycasting out. When it hits the bomb I hide the model (because we can't Release() them yet without crashing the game), I play an explosion sound, and the last thing I need to do is to play the explosion emitter I have). I made the bomb character a prefab, which has an emitter prefab assign to it. I then have a spawner script spawning bomb prefabs. If in debug mode the game runs, but still no emitter showing. If in release mode it crashes when it creates a bomb prefab instance with the error: Object reference count error. If I comment out the loading of the explosion emitter prefab, then I don't get this error in release mode. -
@beo6 Added, thanks!
-
Playing particle emitter issue (project example included)
Rick replied to Rick's topic in Leadwerks Engine Bug Reports
I tried saving an emitter off as a prefab and I have the following script that loads the prefab and calls Play() on it in the collision. However I get an error saying Play is a nil value. Any ideas as to why that would be? The explosionEmitter is a valid entity, but Play() doesn't seem to be exposed for some reason. import "Scripts/AnimationManager.lua" Script.ExplosionEmitterPrefab = "" --path Script.Target = nil --entity Script.Speed = 5 --int Script.Accel = 15 --int Script.AnimSeq = {} Script.AnimSeq.Idle = 1 Script.AnimSeq.Walk = 0 function Script:Start() self.entity:SetKeyValue("type", "bomb") self.animMgr = AnimationManager:Create(self.entity) self.explosionEmitter = Prefab:Load(self.ExplosionEmitterPrefab) end function Script:UpdatePhysics() if self.Target ~= nil then self.entity:Follow(self.Target, self.Speed, self.Accel) self.animMgr:SetAnimationSequence(self.AnimSeq.Walk, 0.03, 200) end end function Script:Collision(entity, position, normal, speed) local type = entity:GetKeyValue("type", "") if type == "player" then self.entity:Hide() self.entity:SetMass(0) local pos = self.entity:GetPosition() pos.y = 1 self.explosionEmitter:SetPosition(pos) self.explosionEmitter:Play() end end function Script:Draw() self.animMgr:Update() end -
https://dl.dropboxusercontent.com/u/1293842/AnimationTutorial.rar Run this in release mode and you'll see it gives an error. In debug mode it runs, but the explosion emitter doesn't work. I have the main character shooting (raycasting) and it plays a cartoon laser type sound. It does the raycasting out. When it hits the bomb I hide the model (because we can't Release() them yet without crashing the game), I play an explosion sound, and the last thing I need to do is to play the explosion emitter I have). I made the bomb character a prefab, which has an emitter prefab assign to it. I then have a spawner script spawning bomb prefabs. If in debug mode the game runs, but still no emitter showing. If in release mode it crashes when it creates a bomb prefab instance with the error: Object reference count error. If I comment out the loading of the explosion emitter prefab, then I don't get this error in release mode.
-
What's the recommended way to release entities during gameplay?
Rick replied to Rick's topic in Programming
cool thanks! -
What's the recommended way to release entities during gameplay?
Rick replied to Rick's topic in Programming
It doesn't seem to matter what script does the releasing the game crashes. If I release in the bomb collision when it collides with the player with self.entity:Release() the game crashes. If I try releasing the bomb from inside the player collision with entity:Release() (entity being the parameter passed in by the collision) the game crashes. -
What's the recommended way to release entities during gameplay?
Rick replied to Rick's topic in Programming
I can't seem to call Release() on entities that have some kind of flag set to be released in App:Loop() while looking over the world entity list. In the below script, the x variable is 25 when it releases that entity, and when it's 42 it blows up because the entity is nil. There are 51 entities total in my scene. So not sure why it's blowing up on the 42nd entity. I could check for nil but clearly something gets screwed up when Release() is called in a loop like this. function App:ReleaseEntities() local count = App.world:CountEntities() - 1 for x = 0, count do local entity = App.world:GetEntity(x) local release = entity:GetKeyValue("release", "false") if release == "true" then entity:Release() end end end function App:Loop() self:ReleaseEntities() -- all the other stuff here end -
I have bombs and I want to remove/release them from the scene when they collide with the player. I can't do self.entity:Release() in the bomb script as it crashes the engine. I can't call entity:Release() in the player collision function because it crashes the engine. I suppose I could probably set a flag key for this entity and in the App:Loop() loop over all entities in the scene and release ones that have this flag set, but there really should be an easier way to handle this inside entity scripts. Maybe some kind of delayed release function that won't release the object right then and there but instead wait until after all the scripts are called and then release objects that should be released before returning from world:Update()? There has to be a better way that I'm missing. Hiding can't be the best option.
-
That model isn't exported correctly either. It's facing down the X axis. I'll change it on my end in UU3D
-
I like the new texture better.