Jump to content

Core

Members
  • Posts

    139
  • Joined

  • Last visited

Posts posted by Core

  1. 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.

     

  2. I'm not sure what has happened, but I noticed that text, that used to bee nice to look at and clear, is now somehow bugged. Here is example pic attached. You notice that in "Switch" (at the center of the screen) letters are not in line and spaces between them are not even. It looks generally bad. It was not like this before. What did I do?

     

     

    20170713191156_1.jpg

  3. Ok, I got it :D Thank you again @GorzenDev , @Josh and others for your help!

    One question remains and sorry if I'm pushing it, I really tried to solve this on my own... But where should I change font of the menu items? I allready tried to load font in main.lua World:Render, and again it almost works, but it only shows new font AFTER mouseover or mouse klick. I also tried adding Redraw() right after creating menu objects, but it strangely worked only with first menu object (Resume Game).

     

    Edit. Ok, I got it working, needed to add SetFont to World:Create() too.

    20170709200437_1.jpg

    • Like 2
    • Upvote 4
  4. On 8.7.2017 at 2:32 AM, GorzenDev said:

    for that you dont need to edit Panel.lua at all
    just add a button or panel as you would normaly.

    look at Menu.lua for example we could change the options panel if we like.

    
    33	optionspanel = Widget:Panel(gui:GetBase():GetClientSize().x/2-250,gui:GetBase():GetClientSize().y/2-300,500,600,gui:GetBase())
    34	optionspanel:SetAlignment(0,0,0,0)
    	--load and set out image here
    	local image = gui:LoadImage("path/to/texture.tex")
    	optionspanel:SetImage(image)
    	--
    35	GameMenu.optionspanel=optionspanel


     

    Ah, ok. But how would you add button or panel normally, never done that and I didn't find tutorials. Adding Pivot to the scene and script to that pivot? Do I have to add pivot for every button/panel I want to add to the menu? Like I said, I'm noob... I would love to get away with just editing current menu to my needs to keep everything menu-related as simple as possible.

     

    Edit. Yup, will post screenshot when I get this figured out! It is somewhat important step for me mentally. And thank you so much for the help so far!

  5. 27 minutes ago, GorzenDev said:
    
    local image = gui:LoadImage("Path/To/Texture.tex")
    --
    local imageButton = Widget:Button("", 0, 0, 1024, 768, gui:GetBase())
    imageButton:SetString("style","Push")
    imageButton:SetImage(image)
    --
    local imagePanel = Widget:Panel(0,0,1024,768, gui:GetBase())
    imagePanel:SetImage(image)

     

    this works for me, you might have to play around with the placement of the image.

    undocumented though

    Thanks, but both of those crashed the map right from the start! I tried them in Panel.lua inside function Script:Draw().

  6. I'm just trying to show my game name, one image on the background of the game menu. Simple as that. Since I'm still noob with lua or any coding, I might and do lack some very basic concepts, so this might be very simple, but for me it is not. Yet. :)

    So, I have not touched on panel.lua. This also puzzles me, Panel.lua, Main.lua or Menu.lua do not have function Script:PostRender(context). I learned that all images, text etc. are drawn on to screen inside that.

  7. Ok, I added this to the main.lua, before context.Sync:

    if gamemenu:Hidden() ~= true then
            context:SetBlendMode(Blend.Solid)
            context:DrawImage(Texture:Load("Materials/Screens/TitleScreen1b.tex"),0,0,gfxmode.x, gfxmode.y)

    end

    IT somewhat works, I have my background, but it has yellowish tint and when mouse cursor enters over a menu item, image flashes, like I can see true colors for a tenth of a second. I tried to mess with menu.lua's backgroundcolor, but no luck. Am I even at the ball park?

    • Thanks 1
  8. Regarding this and your other questions, I recommend you go through the official tutorials if you haven't allready. Then, look from youtube some tutorial videos about lua scripting. I recommend for example Aggrors Project Saturn video series, I learned a ton from them, how scripting works, and I have good foundation to learn more. I was complete lua noob and new to modern game design until earlier this year.

    So best advice, start going through some tutorials and soon you have an idea how to apply thinhgs you've learned in your own project.

  9. I'm actually planning very similar thing in my scifi game and decided skip this visually, because of the amount of work it needs. Basically you need to have a model and maybe some animations for your arms and model for every tool you are planning to have. Then create a script that moves your arms out of the view and switch model when you change tool etc.

    I decided to leave arms out, maybe even 3d models of the tools and have them only inventory items, so when you have a tool in your hand, on hud you can see icon of that tool and maybe its name, but no hands or even a model. Pretty old school way, but it is much, much easier to handle this way. But I'm pretty new with game making and just on the beginning of my learning journey, so I choose targets that are easy enough for me to accomplish.

  10. And moving on to another task. I've tried to find info about this but still have no clue.

     

    So, where to start if I would like to display animations/interactive text on the surface of 3d object? And it should be almost instant, like "type text from keyboard and display it in real time" instant. Is it possible?

  11. On 6/14/2017 at 9:57 AM, AggrorJorn said:

    It is good to see that you are making progress. You can shorten this line

    
    if (self.entity.world:Pick(Vec3(self.position.x,self.position.y,self.position.z),Vec3(self.position.x,self.position.y-1,self.position.z),pickInfo,0,true)) 

    to

    
    if (self.entity.world:Pick(self.position, Vec3(self.position.x,self.position.y-1,self.position.z),pickInfo,0,true)) 

     

    Thanks, did that.

     

    On 6/20/2017 at 6:29 AM, Josh said:

    If you do want to use physics, there's now a kinematic joint that lets you easily control and object's motion.  It's in the docs.

    Thanks, going to check them out.

     

    But currently I'm actually quite happy, the following script does almost exactly what I hoped! It works and hovering looks cool. I need to add some wall proximity checks etc, but basically it is complete... But is there something I should know about writting a good code? This is actually my first script I started from scratch, before I have only customized allready working scripts to suit my needs.

    Still very new with this stuff, so I would appreciate if bad habits or other bad stuff in this script would be pointed out! Especially the part in the code with Entitys rotation. I use Point function, but also SetInput, where I need to set angle also. So basically I set entitys angle (rotation) twice, but it was the only way to get this working like I wanted.

    --Setup variables
    Script.enabled = true--bool "Enabled"
    Script.target = nil--entity "Target"
    Script.accurateFollowRange = 6
    Script.stopRange = 3
    Script.targetDistance = nil
    Script.position = nil
    Script.maxaccel=0.5
    Script.speed = 0 
    Script.realSpeed = nil
    Script.rotSpeed = 0.05
    Script.angle = nil
    Script.text5 = "CART" --string "Content Msg."
    Script.started = false
    
    --Thruster Control --
    Script.altitudeLow = nil
    Script.altitudeHigh = nil
    Script.altitudeOptimal = nil
    Script.thrustForce = Vec3(0,0,0)
    Script.coldStart = true
    --Thruster Control --
    
    --Message Timer-- not in use atm
    Script.messagetimecount = 0
    Script.messagetime = 1000 --int "Message Time"
    
    	
    function Script:Start()
    self.speed = 0
    self.entity:FindChild("Jet1"):Hide()
    self.entity:FindChild("Jet2"):Hide()
    self.entity:FindChild("Radiator1"):Hide()
    self.entity:FindChild("Radiator2"):Hide()
    self.entity:FindChild("HeadLight"):Hide()
    self.entity:FindChild("Heathaze1"):Hide()
    self.entity:FindChild("Heathaze2"):Hide()
    
    end
    
    
    function Script:UpdatePhysics()
    
    	--Update entity data
    	self.realSpeed = self.entity:GetVelocity(true)
    	self.targetDistance = self.entity:GetDistance(self.target)
    	self.position = self.entity:GetPosition()
    	self.angle = self.entity:GetRotation()
    
    	--Ground proximity picks
    	local pickInfo = PickInfo()
    	self.altitudeLow = self.entity.world:Pick(self.position, Vec3(self.position.x,self.position.y-0.5,self.position.z),pickInfo)
    	self.altitudeHigh = self.entity.world:Pick(self.position, Vec3(self.position.x,self.position.y-0.55,self.position.z),pickInfo)
    	self.altitudeOptimal = self.entity.world:Pick(self.position, Vec3(self.position.x,self.position.y-0.6,self.position.z),pickInfo)
    	
    	--Main movement and hover control
    	if self.started == true then
    		self.entity:Stop()
    		self.entity:AddForce(self.thrustForce)
    		self.entity:SetInput(self.angle.y,self.speed,0,0,false, 0.5, 0.5, true, self.rotSpeed)
    		
    		--Follow close, more accurate
    		if self.targetDistance > self.stopRange and self.targetDistance < self.accurateFollowRange then
    			self.entity:Stop()
    			self.speed = 1
    			self.entity:Point(self.target, 2, Time:GetSpeed() * self.rotSpeed)	
    		end	
    
    		--Follow far
    		if self.targetDistance > self.accurateFollowRange then
    			self.entity:Follow(self.target,self.speed,self.maxaccel)
    		end
    		
    		--Stop when near player
    		if self.targetDistance < self.stopRange then
    			self.entity:Stop()
    			self.speed = 0
    		end
    
    		-- Altitude control
    		if self.altitudeLow == true and self.coldStart == false and self.realSpeed.y < 0.3 then
    			self.thrustForce.y = 0.43
    		else
    			self.thrustForce.y = 0.42
    		end
    
    		if self.altitudeHigh == false then
    			self.thrustForce.y = 0.41
    			self.coldStart = false
    		else
    			self.thrustForce.y = self.thrustForce.y + 0
    		end
    	end
    end
    
    
    --Start/Stop
    function Script:Use(player)
    	if self.started == true then
    		self.started = false
    		self.thrustForce.y = 0
    		self.speed = 0
    		self.entity:FindChild("Jet1"):Hide()
    		self.entity:FindChild("Jet2"):Hide()
    		self.entity:FindChild("Radiator1"):Hide()
    		self.entity:FindChild("Radiator2"):Hide()
    		self.entity:FindChild("HeadLight"):Hide()
    		self.entity:FindChild("Heathaze1"):Hide()
    		self.entity:FindChild("Heathaze2"):Hide()
    	else
    		self.started = true
    		self.coldStart = true
    		self.entity:FindChild("Jet1"):Show()
    		self.entity:FindChild("Jet2"):Show()
    		self.entity:FindChild("Radiator1"):Show()
    		self.entity:FindChild("Radiator2"):Show()
    		self.entity:FindChild("HeadLight"):Show()
    		self.entity:FindChild("Heathaze1"):Show()
    		self.entity:FindChild("Heathaze2"):Show()
    	end
    end

    Now, I'm off to continue to learn csg and level design, fun stuff! Might pick up one of those scifi texture packs... Allready bought Scifi Interior Construction Kit.

    And here is a shot of the "CART" inventory carrier. This is a great mile stone in my game making "career", I have built a small test scene with csg, learned the basics of 3d modeling and imported my own, self painted and textured model inside a game engine and scripted it to work! Nothing can stop me now :)

     

    20170623022420_1.jpg

    • Upvote 1
×
×
  • Create New...