Jump to content

Core

Members
  • Posts

    139
  • Joined

  • Last visited

Everything posted by Core

  1. Is it possible to type word in game, and store it in a variable? Like old school text games etc. Ironic, I never was very good at C64 basic, but even I was able to do that Now it is not so easy.
  2. Hmm... Try to bake and export simple color texture using Blender Render to see if the problem is Cycles, or some of it's baking settings. I'm pretty sure it's a setting issue or something in Blender, not Leadwerks that causes problems.
  3. Do you see the baked texture in Blender UV image editor? Have you saved it? Are you using Cycles renderer? I had similar problems, but now that I think of it, I can't remember the exact reason or fix. But what I remember, you need to bake material to texture and attach that texture to material in node editor. Multiple materials are not a problem, You see and can change them in Leadwerks model editor. Also try exporting .fbx file allthough you might want to scale it down.
  4. I downloaded XBOCT's Monitor from workshop. I got it working, but I wonder why it shows my HUD elements in the upper left corner of the "virtual" screen? What am I missing? Edit. Added code from the monitor --------------------------------------------------------------------------- -- Film Grain (Monitor) by Igor Katrich 28/02/20015 -- Email: igorbgz@outlook.com --------------------------------------------------------------------------- Script.camera=""--entity "Camera" Script.border_radius=2.0--float "Border Radius" Script.inflate_rect=50.0--float "Inflate Rect" function Script:Start() --Material self.material = Material:Load("Materials/Monitor/monitor.mat") self.entity:SetMaterial(self.material) --Context self.context = Context:GetCurrent() --Media self.defaultfont = self.context:GetFont() self.recellipse = Texture:Load("Materials/Monitor/Media/ellipse.tex") self.recblend = 0.0 self.digitalfont = Font:Load("Materials/Monitor/Media/digital.ttf",30) self.context:SetFont(self.digitalfont) self.digitalfont:Release() --Buffer self.buffer = Buffer:Create(128,128,1,0); local color = Texture:Create(context:GetWidth(),context:GetHeight()) self.buffer:SetColorTexture(color) self.buffer:Disable(); end function Script:UpdateWorld() self.buffer:Enable() self.camera:Show() --world:Render() self.camera:Hide() self.buffer:Disable() self.context:SetBlendMode(Blend.Alpha) --Border self.context:SetColor(1,1,1,0.2) self.context:DrawRect(self.inflate_rect,self.inflate_rect,self.border_radius,self.context:GetHeight()-self.inflate_rect*2.0) self.context:DrawRect(self.context:GetWidth()-self.inflate_rect-self.border_radius,self.inflate_rect,self.border_radius,self.context:GetHeight()-self.inflate_rect*2.0) self.context:DrawRect(self.inflate_rect+self.border_radius,self.inflate_rect,self.context:GetWidth()-(self.inflate_rect*2.0)-self.border_radius*2.0,self.border_radius) self.context:DrawRect(self.inflate_rect+self.border_radius,self.context:GetHeight()-self.inflate_rect-self.border_radius,self.context:GetWidth()-(self.inflate_rect*2.0)-self.border_radius*2.0,self.border_radius) --Rec self.recblend = Math:Sin(Time:GetCurrent()*.4)-0.2 self.context:SetColor(1,1,1,self.recblend) self.context:DrawImage(self.recellipse,self.context:GetWidth()-26-48-self.inflate_rect-self.border_radius-10,self.inflate_rect+self.border_radius+10,26,26) self.context:SetColor(1,1,1,0.5) --Text self.context:DrawText("REC",self.context:GetWidth()-45-self.inflate_rect-self.border_radius-10,self.inflate_rect+self.border_radius+10+1) self.context:DrawText(self.camera:GetKeyValue("name"),self.inflate_rect+self.border_radius+10,self.context:GetHeight()-self.inflate_rect-self.border_radius-10-25) self.context:SetBlendMode(Blend.Solid) Context:SetCurrent(context) local color = self.buffer:GetColorTexture() self.material:SetTexture(color,0) end function Script:Cleanup() self.digitalfont:Release() self.defaultfont:Release() end I also have another question. If I want to show text, graphics etc on the wall, I just remove world:render() from the monitor script and use it to draw text etc.? What I mean to ask, is this the "right" way, or is there a better way to show text and graphics on wall, like a screen or maybe even a poster, sign etc.
  5. Finally had time to get back to this one. I tried macklebees example and it worked like a charm, but I had actually no idea how it worked... So I got back to Ricks copying suggestion. And decided to create parent for my switch with copying script, copy manager if you will, to prevent it duplicating it self forever. It actually worked, but it lost all the flowgraph attachments, naturally, because it was not the same entity anymore. Here is the code I came up to create unique entity with unique materials. Script.createCopy = false Script.originalModel = nil Script.finalModel = nil function Script:Start() if self.createCopy == false then self.originalModel = self.entity:FindChild("SwitchPanel1_5") self.finalModel = tolua.cast(self.originalModel:Copy(), "Entity") self.originalModel:Hide() self.createCopy = true end end So next step was to move all my switch code to parent, and create new script for 3d model, with functions including material changing code. And call those functions from parent entitys script when I needed materials to change. And so finally, it does what it supposed to do! Thank you all for your help!
  6. Thanks, got the editor working with Radeon and that is enough.
  7. I bought a laptop to be able to work with Leadwerks when I'm not able to use my desk PC. It runs and works, but I noticed it uses laptops integrated intel HD graphics instead of more powerful Radeon R5 GPU. I tested some games from my Steam library and they utilize Radeon, how I make Leadwerks to do that too?
  8. Hi! I can't open script editor for some reason. Or flowgraph for that matter. Anyone else had this problem? I've been away for some time, but last time I used Leadwerks, it worked just fine.
  9. Oh, ok. Is there any estimate when vehicles will be available again?
  10. Hi! I was wondering if someone can point me a basic tutorial or example on how to create simple vehicle with 4.4? I haven't loaded workshop cars because, if I understood correctly, they were made for 3.x and vehicle physics have changed since. I also read that they were disabled at some point, is that still the case? I guess not when watching this cool video I would appreciate any tips, thanks!
  11. I think we just need to wait for fix. I noticed same problem and smoothing helped a lot, but it still is not as good it was before.
  12. Cool looking landscape! Mars, I presume?
  13. Thanks for the help and discussion and @macklebee for the shader example! Awesome. I'm away from computer for the next few days, I'll continue after that.
  14. Nothing, just crash. The usual windows error "Program is not responding and yada yada..."
  15. It crashes the very first line. Even if I comment out other two lines. But I realized one thing... I'm using Flowgraph editor. If I copy entity, I guess flow graph editor does not work anymore with the copy? Here is the full script: --UseTimer variables Script.NullVar = nil --choice "Use Timer" "Version: 3, By: Einlander" Script.enabled = true -- bool "Enabled" Script.HoldTime = 7 -- Float "Hold Time" -- How long the use key needs to be held Script.CumulativeTime = false -- bool "Cumulative Time" -- The timer does not reset when the use key is let go Script.ShowGraphics = true -- bool "Show Graphics" -- Draws the completion bar on screen Script.DisableOnComplete= false -- bool "Stop when Done" -- Disables script on completion --Technical variables Script.enabled=true--bool "Enabled" Script.soundfile=""--path "Sound" "Wav Files (*.wav):wav" Script.working = false --bool "Working" Script.repairing = false Script.power = false --bool "Power" Script.activationSurface = nil Script.poweredSurface = nil Script.activateMaterialPath = nil --path "Activate Material" "Material Files (*.mat):mat" Script.activateMaterial = nil Script.poweredMaterialPath = nil --path "Powered Material" "Material Files (*.mat):mat" Script.poweredMaterial = nil Script.offMaterialPath = nil --path "Off Material" "Material Files (*.mat):mat" Script.offMaterial = nil Script.activateLight = false Script.playerInventory = nil --Notifications Script.messagetimecount = 0 Script.text1 = "Replacing Circuitboard" --string "Repair Message" Script.text2 = "Bad Circuitboard" --string "Broken Message" Script.text4 = "Out of Power" --string "No Power Message" Script.text5 = "Switch" --string "Content Msg." Script.messagetime = 1000 --int "Message Time" Script.messageshow = false Script.message2show = true Script.messageoffset = 70 Script.messageoffset2 = 150 Script.smoke = "" --entity "Smoke" --Notifications function Script:Powered(power) --in self.power = true end function Script:Start() --local switchPanel = self.entity:Copy() --switchPanel:SetPosition(0,0,0) --switchPanel:SetRotation(0,0,0) --self.entity:Release() self.totaltime = 0 if self.soundfile then self.sound = Sound:Load(self.soundfile) end self.activationSurface = self.entity:GetSurface(1) self.poweredSurface = self.entity:GetSurface(2) self.offMaterial = Material:Load(self.offMaterialPath) self.poweredMaterial = Material:Load(self.poweredMaterialPath) self.activateMaterial = Material:Load(self.activateMaterialPath) self.activationSurface:SetMaterial(self.offMaterial) self.poweredSurface:SetMaterial(self.offMaterial) end function Script:Use(player) if self.enabled == false then return end--UseTimer code self.playerInventory = player.script:GetInventory() self.messagetimecount = Time:GetCurrent() + self.messagetime if self.working == false then if self.playerInventory.playerItems[1] ~= nil then if self.playerInventory.playerItems[1].name == "Circuitboard" then --System:Print("Using Circuitboard") self:Begin() --UseTimer code end end end if self.power == true then if self.working == true then if self.sound then self.entity:EmitSound(self.sound) end self.component:CallOutputs("Use") self.activateLight = true end end end --UseTimer code function Script:Begin() if self.enabled == false then return end self.started = true self.complete = false self.repairing = true --if (self.totaltime >= (self.HoldTime - 1)*1000) then --self.totaltime = 0 --end if (self.CumulativeTime == false) then self.totaltime = 0 end self.component:CallOutputs("started") end function Script:Complete() if self.enabled == false then return end self.complete = true self.working = true self.repairing = false self.totaltime = 0 self.smoke:SetLoopMode(false, false); self.playerInventory.playerItems[1] = nil if self.sound then self.entity:EmitSound(self.sound) end if (self.DisableOnComplete == true) then self:Disable() end self.component:CallOutputs("complete") --System:Print("complete") end function Script:Enable()--in if self.enabled==false then self.enabled=true self.component:CallOutputs("Enable") self.health=1 end end function Script:Disable()--in if self.enabled then self.enabled=false self.component:CallOutputs("Disable") self.health=0 end end function Script:Release() if self.sound then self.sound:Release() end end function Script:UpdatePhysics() if self.enabled == false then return end if self.complete == true then return end if ((self.started == true) or (self.held == true) or (self.released == true)) == true then if self.totaltime >= ((self.HoldTime-1) * 1000) then self:Complete() end end if self.started == true then if (window:KeyDown(Key.E) == true) then self.started = false self.held = true self.timestart = Time:GetCurrent() return end end if self.held == true then if (window:KeyDown(Key.E) == true) then self.held = true self.timeend = Time:GetCurrent() self.totaltime = self.totaltime + (self.timeend - self.timestart) self.timestart = Time:GetCurrent() self.component:CallOutputs("running") self.timeend = Time:GetCurrent() else self.held=false self.released = true self.timeend = Time:GetCurrent() self.totaltime = self.totaltime + (self.timeend - self.timestart) self.timestart = Time:GetCurrent() end return end if self.released == true then self.timeend = Time:GetCurrent() self.totaltime = self.totaltime + (self.timeend - self.timestart) self.released = false return end if self.activateLight == true then self.messageshow = true if self.messageshow == true and self.messagetimecount > Time:GetCurrent() then --Activation light self.activationSurface:SetMaterial(self.activateMaterial) else self.messageshow = false self.activateLight = false self.activationSurface:SetMaterial(self.offMaterial) end end if self.power == true and self.working == true then self.poweredSurface:SetMaterial(self.poweredMaterial) else self.poweredSurface:SetMaterial(self.offMaterial) end end function Script:WritePercentage(number) --in System:Print(tostring(number)) end --[[ Description: Calculates Percent Complete Parameters: none Notes: Has a flowgraph ARGUMENT that sends out the percentage completed ]] function Script:Percentage() --arg return math.floor((self.totaltime / ((self.HoldTime-1)*1000))*100) end function Script:PostRender(context) context:SetBlendMode(Blend.Alpha) context:SetFont(font2) context:SetColor(hudColorSolid) if self.working == false then if self.repairing == true and self.held == true then --show notification at center of the screen local X = math.floor((context:GetWidth() - font2:GetTextWidth(self.text1)))/2 local Y = math.floor((context:GetHeight() - (font2:GetHeight()-self.messageoffset)))/2 context:DrawText(self.text1, X, Y) else self.messageshow = true if self.messageshow == true and self.messagetimecount > Time:GetCurrent() then --show notification at center of the screen local X = math.floor((context:GetWidth() - font2:GetTextWidth(self.text2)))/2 local Y = math.floor((context:GetHeight() - (font2:GetHeight()-self.messageoffset)))/2 context:SetColor(hudErrorColor) context:DrawText(self.text2, X, Y) else self.messageshow = false end end end if self.power == false and self.repairing == false then self.messageshow = true if self.messageshow == true and self.messagetimecount > Time:GetCurrent() then --show notification at center of the screen local X = math.floor((context:GetWidth() - font2:GetTextWidth(self.text4)))/2 local Y = math.floor((context:GetHeight() - (font2:GetHeight()-self.messageoffset2)))/2 context:SetColor(hudErrorColor) context:DrawText(self.text4, X, Y) end self.messageshow = false end if self.enabled == false then return end if self.complete == true then return end if ((self.started == true) or (self.held == true) or (self.released == true)) == false then return end context:SetBlendMode(Blend.Alpha) window = Window:GetCurrent() local segment = Vec2(window:GetWidth() *.45,window:GetHeight() *.49) context:SetColor(hudBackColor) context:DrawRect(segment.x-8, segment.y+55 , window:GetWidth() - (segment.x*2),window:GetHeight() - (segment.y*2)) context:SetColor(hudColorSolid) context:DrawRect(segment.x-4, segment.y+4+55 , (window:GetWidth() - ((segment.x+4)*2))*(self:Percentage()*.01) , window:GetHeight() - ((segment.y+4)*2)) end
  16. Tried @Rick's suggestion with this simple code (at this point I'm just trying to copy switch panel object), but it crashes the map. What am I missing? local switchPanel = self.entity:Copy() switchPanel:SetPosition(0,0,0) switchPanel:SetRotation(0,0,0)
  17. Oh, it makes sense And works like you said. Thank you!
  18. I noticed that suddenly I could not see shadows on 3d-models. After some hairpulling, I noticed that shadows disappear if you group stuff under pivot. Again pivot makes problems that seems NOT to be related at all. This is really annoying. Don't get me wrong, I love so many aspects in Leadwerks, but these times it feels that I'm fighting against the editor more than trying to solve problems with my game or code... But, is this a known problem? Or am I using pivots wrong? Here, same scene with everything grouped under pivot and without.
  19. Ah, I see. Then I need to figure out another way. Your suggestion seems plausible, but lot of work a.d extra code, especially if I want to use lots of interactive emissive lights... What about decals, if I show/hide them instead of switching material? Never used decals before.
  20. I have a switch that opens a door. When it is used, it also lights up a light in switch panel. It works by changing material to emissive and back to black. This is the script in my door switch: Don't mind variable names "messageshow", I use the same timer for text messages and keeping light lit for certain time. if self.activateLight == true then self.messageshow = true if self.messageshow == true and self.messagetimecount > Time:GetCurrent() then --Activation light on self.activationSurface:SetMaterial(self.activateMaterial) else self.messageshow = false self.activateLight = false self.activationSurface:SetMaterial(self.offMaterial) end end Problem is, that it lights up ALL switch panels I have in the scene. Why?
  21. Ok, I figured it out. If you have grouped multiple brushes with a pivot and use "ignore groups" to select just one brush, it does this rotation thingy when trying to copy that brush. Annoying, for sure, but I'm happy that there is a work around! I was pretty upset last night to be honest, when you expect something to happen when you do certain things and then suddenly same procedure does something different, it can be really disheartening.
  22. Is there a workaround for this or is this a common problem? I'm trying to pick up a pace with level design, but this copy/paste problem is driving me nuts. If I copy and then paste csg object, it rotates and messes up texture placement. Video below to demonstrate the problem.
×
×
  • Create New...