Jump to content

havenphillip

Members
  • Posts

    550
  • Joined

  • Last visited

Everything posted by havenphillip

  1. . For some reason I can't start my Leadwerks. I tried uninstalling and re-installing. I click it and this little window appears but then it disappears and nothing. Says it's running, then syncing then nothing. The window closes like it shut itself down.
  2. Aw man it's saying video unavailable on YouTube as well. This seems cool but I'm still a noob I need those baby steps.
  3. Ah ok. I worked that out. Was not aware of the "stage" aspect of shaders. I had no vertex information.
  4. That's what I was afraid of. I'm looking through a tutorial on shaders right now from the Leadwerks wiki. I want to learn it. Where do I start? Is there a shader that comes to mind that is close to what you're describing that I can start messing with? Also what does "surface drawn with no active shader" mean?
  5. Yeah I thought about that. I tried a quick version but it was tacky I didn't see much potential. Maybe if I worked on it more I could make that work. The planet material and the cloud material are turning at slightly different speeds, which is kinda cool. And I can adjust the alpha on the clouds right in the code rather than going back and forth in GIMP. But I may end up doing that. I was hoping there is some little trick somewhere I might not be aware of.
  6. Is there any way to get a Z-sort material to pick up shadow? I made this cool planet with clouds that are layered over the top. It looks cool with it set to Alpha but I have to use Z-sort to do it and the lack of shadow on the bottom left is bothering me. I tried it the other way by using the "Diffuse + Alphamask" but I can't fine tune the alpha channel because it vanishes from the center where it's transparent outwards and the lower I go the more cloud I lose, plus the edges are too sharp that way. Or is there a way to use the "Diffuse + Alphamask" and set an alpha channel adjustment that makes it evenly transparent?
  7. Yeah I'm using the FPSPlayerStatusBar from the workshop and if you zoom out the minimap (down arrow) the health bar and stamina and ammo and the minimap itself can be seen in the minimap. I noticed the health, stamina, and ammo shown in the minimap don't change which leads me to conclude that it takes a snapshot of the first frame of the player cam, which I presume is what you mean about saving in a buffer.
  8. Ok I did this but it didn't work. I'm still trying to understand but it looks like the minimap takes a snapshot of the screen right at the start and renders it from the top view? So wouldn't I have to delay the healthbar, etc. within that code? Seems like delaying the minimap wouldn't work. in Minimap: function Script:UpdateWorld() if self.toggle==0 then self:DisableUI() world:Render() self:EnableUI() end function Script:DisableUI() self.player:Hide() end function Script:EnableUI() self.player:Show() end
  9. Oh ok. It's no problem but you may have to explain to me how to do that. I'll look it up and see if I can figure out .zip files. But the code should work in any project so long as you put "GetKeyValue("type","enemy") in your enemy scripts (you can use crawlers) and have the code attached to a pivot and childed to a player, and have the shader at the bottom of the code named right and in the right folder..But whatever you want, man. I appreciate your help with this. I'm totally stoked on it! I'm going to go see if I can figure it out...
  10. Also here's the Radar Effect standalone: Radar Effect.lua
  11. Actually this is working pretty good. It's close to perfect. Maybe you can explain why. Instead of x and y I used dotX and dotY which I made in order to get the zoom to work right. Originally the dots were sort of "slipping" over the terrain and that's fixed: --set enemy entities dot color and position local miniMapEnemySize = Vec2(self.miniMapSize.x/25,self.miniMapSize.y/25) --local radarHalf = self.miniMapSize.y/2 * (self.miniMapSize.x), self.miniMapSize.y/2 * (self.miniMapSize.y) local radarHalf = Vec2((self.radar / 2 / self.radar) * (self.miniMapSize.x), (self.radar / 2 / self.radar) * (self.miniMapSize.y)) local dotX = (self.miniMapSize.x / self.cameraRng / self.zoom) local dotY = (self.miniMapSize.y / self.cameraRng / self.zoom) for k, v in pairs(self.enemyEntities) do if self.enemyEntities[k].script.enabled == true then if self.enemyEntities[k].script.mode ~= "dying" and self.enemyEntities[k].script.mode ~= "dead" then enemy = self.enemyEntities[k]:GetPosition() enemyDrawX = dotX * (enemy.x - pos.x) + radarHalf.x enemyDrawY = dotY * (pos.z - enemy.z) + radarHalf.y if enemyDrawX > dotX and enemyDrawX <= self.miniMapSize.x and enemyDrawY <= self.miniMapSize.y and enemyDrawY > dotY then context:SetColor(1,0,0,1) context:DrawRect(x + enemyDrawX, y + enemyDrawY, miniMapEnemySize.x, miniMapEnemySize.y, 0, 1) end end end end Yeah, man. You can check out whatever I got. I don't have a game, per se, but I'll send you my whole project. I'm mostly just learning Leadwerks and getting the basics of making a game. But whatever I got you can check out, but you'll have to explain to me how to send a project through pm. I don't even know where the pm button is lol. One last thing is that the minimap shows my other HUD elements inside the minimap. I don't know of any way to get rid of that but I would love to get rid of it. It's workable as is but it's one of those little annoyances in the back of my mind. Here's the most recent version: Mini Map.lua
  12. if enemyDrawX >= x and enemyDrawX <= self.miniMapSize.x and enemyDrawY <= self.miniMapSize.y and enemyDrawY >= y then I'm trying to get this to work but it's eliminating all the dots. Maybe something in my script that I did somewhere that negates it? Or maybe is there a way to say "not greater than"? Like a ~>? I tried but figured probably not. Mini Map.lua
  13. Like this? I think I understand. You're saying keep as much info out of the loop so it doesn't have to re-read it all everytime. local miniMapEnemySize = Vec2(self.miniMapSize.x/25,self.miniMapSize.y/25) local radarHalf = Vec2((self.radar / 2 / self.radar) * (self.miniMapSize.x), (self.radar / 2 / self.radar) * (self.miniMapSize.y)) local dotX = (self.miniMapSize.x / self.cameraRng / self.zoom) local dotY = (self.miniMapSize.y / self.cameraRng / self.zoom) for k, v in pairs(self.enemyEntities) do if self.enemyEntities[k].script.enabled == true then if self.enemyEntities[k].script.mode ~= "dying" and self.enemyEntities[k].script.mode ~= "dead" then enemy = self.enemyEntities[k]:GetPosition() enemyDrawX = dotX * (enemy.x - pos.x) + radarHalf.x enemyDrawY = dotY * (pos.z - enemy.z) + radarHalf.y if enemyDrawX < self.miniMapSize.x and enemyDrawY < self.miniMapSize.y then context:SetColor(1,0,0,1) context:DrawRect(x + enemyDrawX, y + enemyDrawY, miniMapEnemySize.x, miniMapEnemySize.y, 0, 1) end end end end The way I have it set up is almost exactly what I want. 60 is too small for the bounding sphere and the map is a little quirky. I'm trying to get the dots to disappear when they are outside of the miniMapSize.x and .y but this only works on the right border and the bottom border. Why is it not doing the same on the top and left? Need to learn Vec4?
  14. Actually, this works: for k, v in pairs(self.enemyEntities) do --calculate the position to drawcolor local enemy = self.enemyEntities[k]:GetPosition() --local pos = self.player:GetPosition(true) local enemyDrawX = (enemy.x - pos.x) + (self.radar / 2 / self.radar * self.miniMapSize.x) local enemyDrawY = (pos.z - enemy.z) + (self.radar / 2 / self.radar * self.miniMapSize.y) context:SetColor(1,0,0,1) context:DrawRect(x + enemyDrawX, y + enemyDrawY, self.miniMapSize.x/25, self.miniMapSize.y/25, 0, 1) end I still need to work on trying to adjust the spacing on enemy dots to fit with the adjustable zoom so that they seem more spread out when zoom in and more clustered when zoomed out. Here's the latest with this updated in it. It works! Mini Map.lua
  15. Something like this? Script.radar = 60 -- int "Radar Range" Script.miniMapSize = Vec2(200,200) --Vec2 "Minimap Size" for k, v in pairs(self.enemyEntities) do --calculate the position to drawcolor local enemy = self.enemyEntities[k]:GetPosition() local pos = self.player:GetPosition(true) local enemyDrawX = (enemy.x - (pos.x - self.radar/2) /self.radar * self.miniMapSize.x) local enemyDrawY = (enemy.z - (pos.z - self.radar/2) /self.radar * self.miniMapSize.y) context:SetColor(1,0,0,1) context:DrawRect(x + enemyDrawX, y + enemyDrawY, self.miniMapSize.x/25, self.miniMapSize.y/25, 0, 1) end
  16. Ah ok, I figured some of it was arbitrary. Nice, art, too, haha. As long as it does the job, right? Here it is currently. I haven't really attempted to establish the relative coordinates, which is what I presume you are trying to explain. I'm slow at math but by all means explain it if you feel up to it.. I'm trying to think of ways to do it. One thing I was thinking was maybe making another box fron the script that is the size of the level and relating the enemies to it that way? Another thing I was trying to work out is this equation : local X2= (x + miniMapSize/2 + (enemy.x * player.z - enemy.z * player.x) /self.zoom...and do the same for Y2, but this gives me a slope, and my math sucks so I don't know how to get past that. Idk if I need some kind of quadratic equation or something. If you already have it figured out I'd be happy to learn it. Seems like I'd have to get the enemyEntity positions at some point. Right now I'm getting a rectangle on the screen for each entity in range but they all show on screen at the same spot, and they don't move yet. Changing the 3d position to 2d position is something I'm trying to get a handle on. But I"m stoked that it''s even this far! Mini Map.lua
  17. Ah yes! I got a rectangle on the screen when in range. For some reason when I deleted "self.enemyEntities = {}" from under PostRender() and put it under Start() all of a sudden now I get a rectangle. -150 is way off the map so clearly that's wrong. outerTopY must be 50-30=20, then? I guess the question now is to find an equation that will relate the enemyEntities to the player
  18. Ha! Dang! Man, you're so far beyond me, this is embarrassing. I'm still trying to figure out why I'm not getting a rectangle anywhere on the screen at all! I'm starting to feel bad dragging you into this like I should have just gave up and left it to the veterans. I'll give it a shot: Half of 60 is 30 so 50-30 = 20 and 50+30 = 80. If the same law applies then the outerTopY would be 80, and the outerBottomY would be 20. EnemyX is at 35. So 35-80=-45, then - 45/60 = -0.75. 200 * -0.75 = - 150? Or did I get the top and bottom backwards? enemyDrawX = 40 enemyDrawY = -150 context:DrawRect(x + enemyDrawX, y + enemyDrawY, self.miniMapSize.x/25, self.miniMapSize.y/25, 0, 1)
  19. Yeah it was telling me "bad argument #1 to 'insert' (table expected, got nil)", but that seems to have resolved it. I think you were right about having to change that "1" to a "2" in the line "local AABB = self.miniMapSphere:GetAABB(1)". I added entity:SetColor(1,0,0) in the callback as a check and they turn red in range with that number set to "2". With "1" I get nothing. Still no PostRender() information showing up anywhere, though. This is what I have in the PostRender function. It seems to me there is a disconnect between the callback and the PostRender? self.enemyEntities = {} for key, value in pairs(self.enemyEntities) do --calculate the position to drawcolor local pos = self.enemyEntities:GetPosition() context:SetColor(1,1,1,1) context:DrawRect(200+pos.x,200+pos.z,20,20,0,1) end
  20. Ok that's what I didn't understand. The callback function is not something I'm at all familiar with I didn't know if I had to plug in a list of enemies there or somewhere else or at all. No need to do it by hand if you're telling me that's not necessary. I'm learning but total noob so a lot of the information won't get in my brain and stay there. I'm pretty much hanging on your every word here for now. I watched your vids on tables and I'll watch them again to reduce my obnoxious noob questions to a minimum. Tables, bounding boxes and raycasting definitely seem like invaluable principles to understand and would be cool to learn how to wield them. Right now it's telling me bad argument #1 to 'pairs' (table expected, got nil) but I'll fiddle with it and see if I can get it to work.
  21. I'm pretty much at a loss at this point. How do I reference my enemy list so that I can post render a dot to their position? Is it correct as is?
  22. OK. So far so good. No errors. I was trying to use GetAABB(1) on the enemies themselves. What does that "1" mean there? I had to resize the sphere for some reason but it isn't giving errors. Here's the current state. I have a bunch of zombies(that I"m probably not supposed to have). I'm not sure that I fully understand arrays and tables yet but I plugged them in at the top. The "tables" documentation is showing something else. Mini Map.lua
  23. Ahh ok! I have it working up to that point now. I didn't realize I could just pivot the whole box to the player. Enemies turn red at the distance when they enter the box, which follows the sphere, which is pivoted to the player, so it follows the player. Makes a lot of sense. Now I can also reference them with the GetKeyValue and that's something I've been stuck on for days. I'm not sure what you mean by updating the ForEachEntityInAABBDo. Do you just put it under UpdateWorld()? The next thing is drawing the dots. I've been scratching my head for several days since once I call the loop(is that the right terminology?) for some reason I can't use anything I previously have, like anything that uses "self..." What do I need to do next to get to where I can draw the positions of the enemies? Feels trapped in that "Callback" function. Here's where I'm at: local v = Vec3(1,0,0) sphere = Model:Sphere(8,self.player) sphere:SetScale(50,50,50) sphere:Hide() sphere:SetPosition(self.player:GetPosition()) position = sphere:GetPosition() aabb = AABB(position.x+50,position.y+50,position.z+50,position.x-50,position.y-50,position.z-50) world:ForEachEntityInAABBDo(aabb,"Callback",v) end function Callback(entity,extra) if entity:GetKeyValue("type") == "enemy" then local v = Vec3(0,0,0) v = extra entity:SetColor(v.r,v.g,v.b) end end
  24. I tried the right-click on the windows bar but it's weird the option to minimize/maximize window is there but I can't select it.
×
×
  • Create New...