Jump to content

TEPA6ANT

Members
  • Posts

    19
  • Joined

  • Last visited

Everything posted by TEPA6ANT

  1. I think I earned the title of "bad programmer" ))) local index for index=1, 255 do if window:KeyHit(index) then System:Print(index) end end
  2. KeyDown and KeyHit is good. But they return boolean variable. Is it possible to find out the current button pressed?
  3. How to get all objects on map Everything. And hiddens, and triggers. The thing is that I need to game received all triggers (secret rooms) when map start. And then calculate which areas were the player. To know, in any trigger (secret room) was player, I will be able do. I just need to get it, to get the maximum amount. I tried using a GetEntityNeighbors(), but he can't see them.
  4. Problem is solved. Delete: Script.objects={} Add: self.objects={} in Script:Start() Now the game does not crash. But. I want to know. Are there any other options to find out that the object is a light, except what I wrote (terribly) in the code? if entity:GetKeyValue("name") ~= ("Point Light 2" or "Spot Light 2") then
  5. My game crashes after changing map. I found the problem, but I don't know how to solve it. I made special zones that hide all objects in it if there is no special object in the zone (e.g. player). And show again if there is a special object in the zone. room.lua import "Scripts/Functions/ROOM_AABB.lua" Script.uniq=false --bool "No typical" Script.Special="" --string "SPECIAL commands" --Disable,Pause,Enable Script.state="Disable" Script.hiden = false Script.objects={} function Script:UpdateRoom() local moi_raion, spec = OBJ_inroom(self.entity,scriptOnly) local index, entity for index,entity in pairs(moi_raion) do if entity:GetKeyValue("Camera")~="69" then if spec then local jndex,entity_obj for jndex,entity_obj in pairs(self.objects) do entity_obj:SetKeyValue("World_Status","") entity_obj:Show() end self.objects={} else entity:SetKeyValue("World_Status","DE") entity:Hide() table.insert(self.objects,entity) end end end end function Script:Start() self.entity:SetKeyValue("Room",self.Special) end function Script:UpdateWorld() end function Script:UpdatePhysics() self:UpdateRoom() end ROOM_AABB.lua RoomInAABBDoCallbackTable = nil GetEntityNeighborsScriptedOnly=false Special_OBJ=false function GetSosedR(entity,extra) --System:Print("See "..entity:GetKeyValue("Special")) if entity:GetKeyValue("name") ~= ("Point Light 2" or "Spot Light 2") then if entity:GetKeyValue("Special")~= ("" or nil) then Special_OBJ=true end table.insert(RoomInAABBDoCallbackTable,entity) end end function OBJ_inroom(entity,scriptOnly) Special_OBJ=false local result_table local special local position = entity:GetPosition(true) local localaabb = entity:GetAABB(Entity.LocalAABB) local aabb = entity:GetAABB(Entity.RecursiveAABB) local temp = GetEntityNeighborsScriptedOnly GetEntityNeighborsScriptedOnly=scriptOnly aabb:Update() local table = RoomInAABBDoCallbackTable RoomInAABBDoCallbackTable = {} if entity.world then entity.world:ForEachEntityInAABBDo(aabb,"GetSosedR",entity) result_table = RoomInAABBDoCallbackTable special = Special_OBJ RoomInAABBDoCallbackTable = table GetEntityNeighborsScriptedOnly = temp end return result_table, special end The game crashes only if there are these zones on the next and on the previous map. I think that after loading next map, it does not remove hidden objects. How to remove them?
  6. Not need to found. I found. Excuse me.
  7. I could not find information on how to get bone coordinates. Why ask the question. How? For example, need to put an object (stick, pistol or anything) in right hand (bone name "r_hand" (for example)) How this can be done?
  8. I don't need a sprite. I need to move the texture on brush. Just move, I can using shaders. But, using the script, get material, and then set shader for material, this fails. And to solve the second problem, I just need to learn how to get material from brush(Box,Wedge,Sphere etc.).
  9. No. I changed mass of objects, result is same. I need this to be independent of the mass. I'm honest. Didn't know. But I tried, the result is not what you need. Object with a Rigid Body, flew somewhere, and with Character Controller stands still. I just need the texture on the brush to move at the right speed. As in Half-Life for example. In entity script, set speed and direction of the texture for shader. But, as I understand it, the texture of the brush is not so easy to take. (self.entity:GetMaterial() == nil). P.S. My English is bad and i'm partly using Google Translate for writing post. (<- Этот текст я написал без использования переводчика)
  10. However, not everything works so well. The speed of objects with different Physical Mode on conveyor are always different (Rigid Body goes faster than the Character Controller). How can they be equated? And another question. How to load a brush entity shader? (just... local mat = self.entity:GetMaterial() mat:SetShader(self.shader) --attempt to index local 'mat' (a nil value) ) This is necessary to make the texture move.
  11. It turned out the problem in speed. Replaced self.speed=Vec3(5,0,0) on self.speed=Vec3(3(or below),0,0). And somehow the problem disappeared. How to delete a post?
  12. I'm trying to make a conveyor. But faced a problem. function Script:Collision(entity, position, normal, speed) if self.active then entity:SetVelocity(self.speed) --self.speed=Vec3(5,0,0) end end It seems to work. But when the object goes in the opposite direction, its speed is the same as if it did not go on conveyor. I tried using AddForce. But it is too fast (values below 0.04 (self.speed=Vec3(0.04,0,0)) do not move the object, and above is very fast).
  13. Yes. It works. I thought it wouldn't work. Thanks.
  14. Okay. I think I understand. But what if the light point will be outside the AABB, but light radius will reach the player?
  15. Is it possible to get information from the lighting? I need the enemy to know if the player is sitting in the dark. Without creating a script for each "light" on map. Example in the picture below
  16. I just need to output some textures in the Widget:Panel. And also on them to use special shaders.
  17. How painting texture in GUI without the use of widgets or painting texture[Texture:Load()] (not image[gui:LoadImage()]) in Widget:Panel?
  18. -=END=- AABB not see entity I copied code in: It turned out somehow so : function Script:Call(entity,extra) self.see=true System:Print("see") end function Script:UpdatePhysics() local position = self.entity:GetPosition(true) local aabb = AABB() aabb.min.x=position.x-30 aabb.min.y=position.y-30 aabb.min.z=position.z-30 aabb.max.x=position.x+30 aabb.max.y=position.y+30 aabb.max.z=position.z+30 aabb:Update() self.entity.world:ForEachEntityInAABBDo(aabb,"Call", self.entity) end But at the approach of any other object(e.g. the player) to this object, nothing happens. -=RUS=- AABB не видит объекты. Я взял код из Получилось как-то так : function Script:Call(entity,extra) self.see=true System:Print("see") end function Script:UpdatePhysics() local position = self.entity:GetPosition(true) local aabb = AABB() aabb.min.x=position.x-30 aabb.min.y=position.y-30 aabb.min.z=position.z-30 aabb.max.x=position.x+30 aabb.max.y=position.y+30 aabb.max.z=position.z+30 aabb:Update() self.entity.world:ForEachEntityInAABBDo(aabb,"Call", self.entity) end Но при подходе любого другого объекта(например, игрок) к этому объекту, ничего не происходит.
×
×
  • Create New...