Jump to content

aldoz

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by aldoz

  1. There is some way to translate the MonsterAI.lua to get it's working with full physics too? I notice the navigation, in these scripts, are made for flat surfaces; you notice that monsters are not handled by physics; Maybe I want too much
  2. In first, thank you to all you guys for fast answers! I tried using no mass and mass >0 but nothing changes :\ Damn.. I think there is something I am missing.. I will read your links, I need to understand some logics about AI scripts and abut general lua programming mmm interesting.. . No! I am not using nav mesh! So I suppose I need to incorporate my enemy object inside a nav mesh.. right? Can you provide me some sort of examples?
  3. Hi guys, I am trying to get an entity that move in direction of the player! I am using MonsterAI.lua but I notice that the object where I activate MonsterAI.lua can't move! even I provide a target to follow. Some of you have a solution?
  4. Thank you so mutch mate!, finally it's working fine! I was getting mad about! Thanx to nick.ace too!
  5. Yeah exactly! I was trying to use script proprierties; Inside the ball script I add this command : Script.myEntity = entity --entity "Some entity" So I get the textfield called "Some entity" where I could put an object to let this object is available in ball script but.... I can't choose nothing in that texfield! Seems to be disabled... (remember I am using Leadwerks demo) So can I make a script on the cube where I set the cube proprierties as global.. cool.. but how I can do it?
  6. I try to explain better. I use interface to make a new object, a ball. Then I make a new object, a cube, Now I go to object ball script and I use the following code to calculate the distance to the cube: pos1 = self.entity:GetPosition() pos2 = cube:GetPosition() but pos2 get me a nil error.. like "cube" is not know by the ball script! So you can see I need to call the object cube from the ball script but in this script there is NOT the creation of the cube object! (the object cube is born from Leadwerks interface, not by script code!) I am a bit confused about.. :\
  7. Hi macklebee, sorry for my insistence; considering entity1 name is FPSPlayer under Entity scene folder and.. considering entity 2 name is SPHERE under Models scene folder.. so, in your code how I need to name these objects (entity1 and entity2)? and I need to set global variable distance?
  8. As in the title, I am trying to calcolate the distance between an object (sphere) in my scene and my FPSPlayer. I am using this code as script of sphere object : distance = GetDistance(Entity*FPSPlayer) It's basic, I know... but I get all time same error : Script Error Attempt to perform operation on an invalid operand... Help! I tried this code I find in steam forum but in this case too I can't use the right syntax when I must change "obj1" and "obj2" with the LUA command..: pos1 = GetPosition(Obj1) pos2 = GetPosition(Obj2) distance = length(pos2 - pos1)
  9. Yeah macklebee, demo is from 2014
  10. Yeah I tried a lot of similar programs in these days and I think I find my ideal solution. The demo should be Leadwerks 2 just cause there is not the vegetation tool.
  11. Ok I read now the demo is called "Leadwerks Indie edition" and it's just 14 days trial
  12. Ok, I tried many things and finally I solve this trouble. Just the terrain example born with some strange collision behaviour or maybe just me editing and changing too much the terrain example.. So I restart my project using the ball game example and I notice that the collision behaviour follow the previous mentioned collision rules : http://www.leadwerks.com/werkspace/page/api-reference/_/command-reference/collision-r778 So now If use the stones as debris and the wall as character I get my stones pass through wall but the player not. So solved Thank you guys
  13. Hi guys, I notice my demo version has not the vegetation tool in terrain page. What is the version of that Leadwerks demo? Leadwerks 2?
  14. Ok I am trying to set your collision code for single objects; so I selected a single stone object and I put this code in his script page: Collision.Custom = 10 Collision:SetResponse(Collision.Custom,Collision.Custom,Collision.Collide) Collision:SetResponse(Collision.Custom,Collision.Scene,Collision.Collide) self.entity:SetCollisionType(Collision.Custom) But I get : Script Error attempt to index global 'self' (a nil value).. I think I not yet catch the right logic behind Leadwerks..
  15. Damn I can't get working your code... I am inside in a custom "terrain example" project. Take the terrain example, add a wall in front of player and a little box (as stone) on the groud and you know my situation. I try to put your code in a blank project using the script editor but I get just a black screen.. anyway I suppose that I could to use some pieces of your code directly as script for the wall and the stones... Collisions start to be hard to handle for me :\ EDIT : ok I run your example adding your code in the player script.. (lol).. So I get 2 windows, one is the game and one is your example.. and yes I see you got the point! Now I hope to find some way to add to my code..
  16. I am using this rule : Wall = prop Stone = trigger and they continuing to collide! So I tried this too : Wall = character Stone = debris But again.. the collision between the wall and the stones continuing to be active! So what is wrong??
  17. Thank you macklebee I was in fear cause I was using the standard rules here : http://www.leadwerks.com/werkspace/page/api-reference/_/command-reference/collision-r778 But I got nothing! seems in my project these standard rules are off.. Now I check your links! for now again thank you!
  18. Hi again guys, I am trying to get this situation : You use a player on a terrain; in front of player there is a wall. Near the player there are some little stones ready to be throw to the wall!. Ok what I would is to obtain the player CAN'T go through the wall but the stones yes! Obviously if I turn off collision for the stones so I will get my stones sink inside the terrain. So I need something to choose for each of the objects , which are the other objects with which to have a collision.. In other words : Stone 1 ------> Can collide with Stone2 and Stone3 - Can't collide with Wall Stone 2 ------> Can collide with Stone 1 - Can't collide with Stone3 and Wall Can I obtain something like that?
  19. Ok with the following code I can put a text on the center of the screen! So, solved function Script:Start() self.font = Font:Load("Fonts/Ranchers-Regular.ttf",32) if self.font==nil then local context = Context:GetCurrent() self.font = context:GetFont() end end function Script:PostRender(context) context:SetBlendMode(Blend.Alpha) context:SetColor(1,0,0,1) local text local prevfont = context:GetFont() prevfont:AddRef() context:SetFont(self.font) local fh=self.font:GetHeight() local timestring text="Level Complete" context:DrawText(text,(context:GetWidth()-self.font:GetTextWidth(text))/2,(context:GetHeight()-fh)/2-fh*1.5) end
  20. Ok I get this working : function App:Start() self.window = Window:Create() self.context = Context:Create(self.window) local font = Font:Load("Fonts/Arial.ttf",36) self.context:SetFont(font) font:Release() return true end function App:Loop() if (self.window:Closed() or self.window:KeyDown(Key.Escape)) then return false end self.context:SetColor(0,0,0) self.context:Clear() --Draw some centered text on the screen local text = "Leadwerks" local font = self.context:GetFont() local x = self.window:GetWidth()/2 local y = self.window:GetHeight()/2 x = x - font:GetTextWidth(text)/2 y = y - font:GetHeight()/2 self.context:SetBlendMode(Blend.Alpha) self.context:SetColor(1,1,1) self.context:DrawText(text,x,y) self.context:SetBlendMode(Blend.Solid) self.context:Sync() return true end Using this code inside the ball script, when I push esc key so I read the write!
  21. mmm tried but nothing change. I notice that, when I get out from demo, using esc key, I get "Script Error attempt to index field 'window' (a nil value) If I delete the first script line so I get this error in the following code line : Script Error attempt to index field 'context' (a nil value) Damn me when I lost time using Dark Basic
  22. Hi again guys, I am trying to put some text on my screen but a basic thing such this seems impossible for me... I can't get text and the only thing I get is NO texts on screen. Tried a bunch of forum examples but nothing! So, I put a sphere on the "terrain demo" and I made a script to let to push it pressing a key. This work fine! But in the same script I add a function to draw some text using App:loop but I am not sure.... I getting nill value error too.. here my code : function Script:UpdatePhysics() if window:KeyDown(Key.F) then self.entity:AddForce(50,0,0,true) end end function App:Loop() if (self.window:Closed() or self.window:KeyDown(Key.Escape)) then return false end self.context:SetColor(0,0,0) self.context:Clear() --Draw some centered text on the screen local text = "Leadwerks" local font = self.context:GetFont() local x = self.window:GetWidth()/2 local y = self.window:GetHeight()/2 x = x - font:GetTextWidth(text)/2 y = y - font:GetHeight()/2 self.context:SetBlendMode(Blend.Alpha) self.context:SetColor(1,1,1) self.context:DrawText(text,x,y) self.context:SetBlendMode(Blend.Solid) self.context:Sync() return true end
  23. Hi all, I am searching for set position and set rotation commands.. but nothing? And over that, are there some command to push a physical object with some physical force? something like "add force vector XYZ" Thank you in advance
×
×
  • Create New...