Jump to content

Russell

Members
  • Posts

    187
  • Joined

  • Last visited

Everything posted by Russell

  1. With your help and the line code for SHOWING/HIDING entities (and many timers), i have finished my own "Galaxy Teleport System" or with Copyright name "Stargate" system. ? This is the result of 2 days work: Many thanks again havenphillip!!
  2. It works!!! It works!! Many thanks!! I was trying other commands like "self.hide()" or "self.isVisible="false" etc, etc..., but they don't work!! Thanks a lot!!!
  3. Hi there team!! I'm working very hard on my first Leadwerks game. I don't have much idea about LUA and I'm learning as I work and read how the Scripts work in ENGINE. In my first TUTORIAL map ingame, I have created a portal very similar to a Stargate to move from a map to a different one. And I have put 2 animated cilinder object/brushes for the event horizon ... Here you can see: Crossing Stargate Now that I have the gate created. I want to simulate that we can ACTIVATE and DEACTIVATE it. Do you know what command I should use to SHOW or HIDE the brushes? I have tried to search for something on Google, but the LUA commands and sentences that I have found not worked for me. Thank you very much team!!!
  4. Thank you very much Josh!!! Your code has been very useful to get exactly what I intended to do. Many thanks.
  5. Thank a lot Josh for your answer. I understand what are you saying, but i don't know how write code in LUA... I have a model (a switch) with 3 functions Script (ImageSwitch.lua). When we hit it, an image show centered on screen as i wanted. But I can walk and move away from the area with the image showed on screen. This is my code for show the image: --------ImageSwitch.lua---------- Script.HudTexture=""--string "Name Texture" local ShowedImage="No" function Script:Start() texture = Texture:Load("Materials/MyMaterials/"..self.HudTexture..".tex") textureEmpty = Texture:Load("Materials/MyMaterials/EmptyTexture.tex") end function Script:Use() if ShowedImage=="Yes" then ShowedImage="No" else ShowedImage="Yes" end end function Script:PostRender(context) if ShowedImage=="Yes" then context:SetBlendMode(Blend.Alpha) context:DrawImage(texture,context:GetWidth()/2-texture:GetWidth()/2,context:GetHeight()/2-texture:GetHeight()/2,texture:GetWidth(),texture:GetHeight()) end if ShowedImage=="No" then context:SetBlendMode(Blend.Alpha) context:DrawImage(textureEmpty,context:GetWidth()/2-textureEmpty:GetWidth()/2,context:GetHeight()/2-textureEmpty:GetHeight()/2,textureEmpty:GetWidth(),textureEmpty:GetHeight()) end end ------------------------ If I want our player to not be able to walk from place until the switch is turned off again, I have thought about putting a global variable to control it. But I don't know how to write the code to be able to change the "moveSpeed" of the FPSPlayer.lua when "ShowedImage" is YES in my ImageSwitch.lua Thanks a lot for your answer.
  6. I'm thinking about create a Global variable like "ReadingSomething" and a function on FPSPlayer.lua for change movementspeed when we are reading or not. But i don't know how develop this with code, i'm looking over the net for examples, and not able to find anything. Anyway i'm looking the code of the rest *.LUA on Leadwerks to learn the syntax to do this...
  7. I've got an object on my game with a little tutorial showed when we interact with it. But as player, we can move around when the tutorial is active. Is there any way to disable Player movement and Enable when i wan? Thanks a lot!!
  8. Ok, now with this code the problem is... If i put 2 or more images on the level with this code, when i active one of them and activate another one with the same code, 2 images stay together on screen. Is there any way to clear the activated image before show a second one??? If i use context.clear() my screen becomes white.
  9. Thank you very much for the answer... I've putted "LOAD Texture" commands in the Start Function. Anyway, after hours of battle with LUA, finally i've solved my problem loading an empty-small texture of 32x32 on Start Function too... Now my code works fine for me like this: --------------------- Script.HudTexture="" local ScriptActivo="Yes" local ShowedImagen="No" function Script:Start() self.enabled=true texture = Texture:Load("Materials/MyTextures/"..self.HudTexture..".tex") textureEmpty = Texture:Load("Materials/MyTextures/Empty.tex") end function Script:Use() if ShowedImagen=="Yes" then ShowedImagen="No" else ShowedImagen="Yes" end end function Script:PostRender(context) if ShowedImagen=="Yes" then context:SetBlendMode(Blend.Alpha) context:DrawImage(texture,context:GetWidth()/2-texture:GetWidth()/2,context:GetHeight()/2-texture:GetHeight()/2,texture:GetWidth(),texture:GetHeight()) end if ShowedImagen=="No" then context:SetBlendMode(Blend.Alpha) context:DrawImage(textureEmpty,context:GetWidth()/2-textureEmpty:GetWidth()/2,context:GetHeight()/2-textureEmpty:GetHeight()/2,textureEmpty:GetWidth(),textureEmpty:GetHeight()) end end --------------------- I don't know if this solution is the best, but It works fine for me. With my little knowledge in LUA, I am quite satisfied with the result. Thank you very much!! ?
  10. Hi there... I'm new using LUA creating my own scripts from scratch. And this is a question that is driving me crazy. I want SHOW/HIDE a image centered on screen after USE an object ingame. With this code I have managed to show the image without problems: ----------- Script.HudTextura="" local ScriptActivo="Yes" local ShowImage="No" function Script:Use() if self.enabled then ShowImage="Yes" else ShowImage="No" end end function Script:PostRender(context) if ShowImage=="Yes" then context:SetBlendMode(Blend.Alpha) texture = Texture:Load("Materials/MisTexturas/"..self.HudTextura..".tex") context:DrawImage(texture,context:GetWidth()/2-texture:GetWidth()/2,context:GetHeight()/2-texture:GetHeight()/2,texture:GetWidth(),texture:GetHeight()) end end ----------- But I don't know how hide or erase it after that. I have searched forum and Google, but the answers i've found have not helped me. I'm not able to find any command to hide or delete the image after displaying it. Can anybody help me? I'm not using FlowGUI or FlipHook because i want learn LUA from beginning creating my own simple scripts. Thank you very much!!
×
×
  • Create New...