Jump to content

Angelwolf

Members
  • Posts

    262
  • Joined

  • Last visited

Posts posted by Angelwolf

  1. 9 hours ago, Tindrone said:

    Thanks! I looked over your code and modified mine, my question now is how do I click on specific objects, Unity has the function

    
    OnMouseDown()

    which detects when a specific object (IE a key or other item) is clicked, I was wondering how to do this in Leadwerks.

    Could be wrong here (haven't used it myself) but I believe for a left mouse button click it is:

    window:MouseDown(Key.LButton)

    There are more details on the mouse down syntax here

  2. 6 hours ago, Rick said:

    Very useful stuff I don't want to quote in a massive post

    Thanks Rick. I did see your LUA library (I understand this is a paid item - no problem). If I were to utilise this, would you be happy to walk me through any troubles I have if I cannot work it out after watching the videos?

    I think having isolated states would be hugely beneficial and would be the perfect solution for my problem.

    Something I need to consider is that my game will have a heavy emphasis over dialogue and choices. Will your library be suitable for dialogue on a large scale?

    Presently I'm using images for dialogue and choices because I find it easier to work with. I could move to text (which might prove better) but I wasn't sure about word wrapping and adjustment for if the player runs at different resolutions. If you would be happy to include a specific dialogue module to your library, or even make one for me personally, I wouldn't object to pay you (or someone) for such a commission, depending on a quote.

  3. Script.enabled=true--bool "Enabled"
    Script.npcname=NPC--string "NPC Name"
    Script.hudFont = nil -- REMOVE IF BROKEN
    Script.indialogue=false--bool
    Script.rude=false--bool
    Script.askname=false--bool
    Script.asklocation=false--bool
    Script.introdone=false--bool
    
    Script.intro = Texture:Load("Dialogue/Downtown/Paradise Apartments/paradise apartments security guard - Intro.tex") --texture for the dialogue box (initial intro)
    Script.introdonerude = Texture:Load("Dialogue/Downtown/Paradise Apartments/paradise apartments security guard - introrude.tex") --texture for the dialogue box (if they player was rude, show this intro next time they interact)
    Script.introdone = Texture:Load("Dialogue/Downtown/Paradise Apartments/paradise apartments security guard - introdone.tex") --texture for the dialogue box (intro once the player has already spoken to the NPC once before)
    Script.askedname = Texture:Load("Dialogue/Downtown/Paradise Apartments/paradise apartments security guard - name.tex") --texture for the dialogue box (NPC tells player their name)
    Script.askedlocation = Texture:Load("Dialogue/Downtown/Paradise Apartments/paradise apartments security guard - location.tex") --texture for the dialogue box (NPC tells player where they are)
    
    diagboxcolor = Vec4(1,1,1,0.8)
    diagboxLength = context:GetWidth() --set dialogue box length to the same length as the game window
    diagboxHeight = context:GetHeight()/3 --set dialogue box height to one third of the height of the game window
    xback = 0 --set the back (left side) (x) of the dialoge box to the left of the game window
    yback = context:GetHeight() -diagboxHeight --set the back (bottom) (y) of the dialogue box to the bottom of the game window
    
    
    function Script:Start()
    self.hudFont = Font:Load("Fonts/hudfont.ttf",12) --REMOVE IF BROKEN, IT IS FOR THE HUD
    self.introdone = false
    self.rude = false
    self.askname = false
    self.asklocation = false
    end
    
    function Script:Use()
    	if self.indialogue == false
    		then self.indialogue = true
    			else
    		if self.indialogue == true
    			then self.indialogue = false
    		end
    	end
    --self:Toggle()
    end
    
    function Script:Toggle()--in
    
    end
    
    function Script:PostRender(context)
    	context:SetBlendMode(Blend.Alpha)
    
    
    	-- THE BELOW IS FOR THE INITIAL INTRODUCTION DIALOGUE
    	if self.indialogue == true and self.introdone == false and self.rude == false and self.askname == false and self.asklocation == false then
    		context:SetColor(diagboxcolor) --colour parameters for hudbox, and for alpha
    		context:DrawImage(self.intro,xback,yback,diagboxLength,diagboxHeight) --draw the dialogue box in the screen (within the Script:PostRender(context) function					
    		playerCanMove = false
    			if self.indialogue == true and self.introdone == false and self.rude == false and self.askname == false and self.asklocation == false and window:KeyDown(Key.F1) then
    				self.indialogue = true
    				self.introdone = true
    				self.rude = false
    				self.askname = true
    				self.asklocation = false
    				else 
    					if self.indialogue == true and self.introdone == false and self.rude == false and self.askname == false and self.asklocation == false and window:KeyDown(Key.F2) then
    						self.indialogue = true
    						self.introdone = true
    						self.rude = false
    						self.askname = false
    						self.asklocation = true
    						else
    							if self.indialogue == true and self.introdone == false and self.rude == false and self.askname == false and self.asklocation == false and window:KeyDown(Key.F3) then
    							self.indialogue = false
    							self.introdone = true
    							self.rude = true
    							self.askname = false
    							self.asklocation = false
    							end
    					end
    			end
    	else if	-- THE BELOW IS FOR IF THE PLAYER PRESSES F3 (rude) IN THE INITIAL INTRODUCTION DIALOGUE
    		self.indialogue == true and self.introdone == true and self.rude == true and self.askname == false and self.asklocation == false then
    		context:SetColor(diagboxcolor) --colour parameters for hudbox, and for alpha
    		context:DrawImage(self.introdonerude,xback,yback,diagboxLength,diagboxHeight) --draw the dialogue box in the screen (within the Script:PostRender(context) function					
    		playerCanMove = false
    			if self.indialogue == true and self.introdone == true and self.rude == true and self.askname == false and self.asklocation == false and window:KeyDown(Key.F1) then
    				self.indialogue = true
    				self.introdone = true
    				self.rude = false
    				self.askname = true
    				self.asklocation = false
    				else 
    					if self.indialogue == true and self.introdone == true and self.rude == true and self.askname == false and self.asklocation == false and window:KeyDown(Key.F2) then
    						self.indialogue = true
    						self.introdone = true
    						self.rude = false
    						self.askname = false
    						self.asklocation = true
    						else
    							if self.indialogue == true and self.introdone == true and self.rude == true and self.askname == false and self.asklocation == false and window:KeyDown(Key.F3) then
    							self.indialogue = false
    							self.introdone = true
    							self.rude = true
    							self.askname = false
    							self.asklocation = false
    							end
    					end
    			end
    	else if	--THE BELOW IS FOR IF THE PLAYER PRESSES F1 (name) IN THE INITIAL INTRODUCTION DIALOGUE
    	    self.indialogue == true and self.introdone == true and self.rude == false and self.askname == true and self.asklocation == false then
    		context:SetColor(diagboxcolor) --colour parameters for hudbox, and for alpha
    		context:DrawImage(self.askedname,xback,yback,diagboxLength,diagboxHeight) --draw the dialogue box in the screen (within the Script:PostRender(context) function					
    		playerCanMove = false
    			if self.indialogue == true and self.introdone == true and self.rude == false and self.askname == true and self.asklocation == false and window:KeyDown(Key.F1) then
    				self.indialogue = true
    				self.introdone = true
    				self.rude = false
    				self.askname = false
    				self.asklocation = true
    				else 
    					if self.indialogue == true and self.introdone == true and self.rude == false and self.askname == true and self.asklocation == false and window:KeyDown(Key.F2) then
    						self.indialogue = false
    						self.introdone = true
    						self.rude = false
    						self.askname = false
    						self.asklocation = false
    						else
    					end
    			end
    	end		
    	end 
    	end --end of else ifs
    
    	if self.indialogue == false then
    		playerCanMove = true
    	end
    
    end

    Here's my trainwreck of code. Hope it helps to understand what I'm going for.

    I'm sure there must be a better and more simple way to do this, and I'm willing to re-write this entire thing if need be.

  4. 3 hours ago, Thirsty Panther said:

    Hard to tell without seeing your code but I'm guessing you are not resetting your variable for the key press for the first question.

    ie Question one: Answer = "F3"

    Question two: Answer = still equals "F3" from question one.

    Hope this helps.

    Good to have you back.

    This is exactly right, and what I'm having trouble working out how to fix (because suppose I change the response key to F10, the issue goes away because the initial requirements are still met, but with a different 'fire' button). I'll see if I can get my code online very soon so you can at least see what I mean and also marvel at its lack of elegance.

    Thanks for the welcoming reply; It's been a busy year or two. Now married with a beautiful daughter! 

  5. Hi all,

    I'm looking to implement dialogue options into my current game, but I'm wondering what the best way to do this would be?

    I'm not great with Lua as some of you older posters may remember, however I often manage to work my way though things using methods that make sense to me but are not necessarily viable or efficient.

    So far, I have been using a system with 'flags' whereby depending on the answer the player gives (in the way of pressing F1, F2, F3 etc), a flag is set as true or false which then branches the conversation depending on the answers given. Presently, however, I have hit a snag where my code does not allow me to branch past the second question I need to re-use keys in order to progress the discussion.

    For example:

    Question 1: How are you feeling today?
    (answer) F1: I'm great!
    (answer) F2: I'm okay
    (answer) F3: I feel sad

    Supposing the player presses F3...

    Question 2: Why do you feel sad?
    (answer) F1: The weather is bad
    (answer) F2: My cat ran away
    (answer) F3: I don't like my salary

    The problem here is that because the player pressed F3 in question 1, the next question given is question 2 (which is correct) but it immediately answers as F3 again.

    Can anyone shed some advice on this?

  6. Crashed on start - changed res to 1280x720 and disabled vsync and it all worked fine.

    Interesting, short little game. Lots of atmosphere. Lots of potential if you wanted to extend the game further in the future!

  7. You could also try releasing after hiding either immediately or after a few seconds.  I've had some funky issues in the past when trying to release an entity but it's still performing actions, so my solution was to hide it then release after a few seconds - worked well in my projects. 

    Just remember, you're hiding that item, not destroying it. Not much of an issue on a small scale but on a larger project you'll probably want to scrap the band-aid solution for a proper one. 

    • Like 1
  8. Okay, Map03 is finished, some bugs have been fixed, and the standalone has been re-uploaded. Link in original post.

    Enjoy!

    And here's a video featuring all maps if you're sitting on the fence:

     

  9. I'd love to see the FPS player script finished. Eg, crouch command and immunity to own gunshots fired. 

    Also the soldier and monster scripts call no pain sounds, and the soldier script has no check on the fire sound so if you haven't set one, it'll error out on fire.

    We can add them in manually, sure, but they'd be nice by default. Having said that, fixing these issues on my own has helped me learn to code better! Especially since everything you need is already (near enough) included within these scripts. 

  10. 10 hours ago, Art_C0de said:

    Thanks a lot for the tips and for your time :) I'll try my best using this engine!
    Have a nice day!

    I mostly learned Leadwerks by playing about with things. There a load of bundled scripts that come with it (eg, an fps player script, door scripts, trigger scripts etc). There are also shaders to give a nice visual effect and a few materials to get you sorted.

    After fiddling about with things, adding some brushes etc you'll get by just fine. There are also tutorial maps you can use to see how things work (they're added to each project automatically - just open the maps). Have a poke around with those and see how the different items interact. You'll also probably want to check out the Flowgraph Editor - a very, very useful (and dead simple) tool especially when starting out.

  11. I managed to log in just fine and I can see my previous orders (checked, just to ensure it was working). Must be an issue at their end but I guess the only thing you could do is wait for their reply.

  12. Thank you! Map03 doesn't exist yet so it'll crash out when you finish Map02. 

    I'm working on Map03 though (next upload also has a couple of bug fixes, such as health packs and ammo packs giving the correct quantities, they're rather generous right now due to some bad code). After that, hopefully more maps. 

    I should really include some kind of melee weapon or very weak gun with unlimited ammo at some point. 

  13. Looking good, I commented on a couple of your WIP vids you put on YouTube a few weeks ago - glad to see you're posting here too. 

    Don't worry too much, my game also does not launch from the Leadwerks Game Launcher so I've had to upload Nightmare Prism as standalone too. 

  14. 7 hours ago, Angelwolf said:

    I started it only a week or so ago but I have automatic updates turned off. I'll try updating tonight, hopefully it won't give too much work for me to update. 

    Then I'm hoping you can all play! 

    Okay, so it turns out Leadwerks WAS already updated and my project IS up to date. What's causing this?

    Josh, are there many scripts I need to update for this? Could I just copy over the GUI file (panel.lua) from the Leadwerks Launcher install over to my project, into the respective directory?

    Update: Standalone is available for download here

  15. 2 hours ago, Josh said:

    I think your game is using an old EXE that was a beta.  The problem is your GUI scripts should be replaced with the latest.  I bet you have not updated your project in a long time?

    I started it only a week or so ago but I have automatic updates turned off. I'll try updating tonight, hopefully it won't give too much work for me to update. 

    Then I'm hoping you can all play! 

  16. 15 hours ago, Josh said:

    If I remember correctly, the GUI style is something I dropped right before the final release.  You might have old GUI scripts that were designed during the beta.  It should work if you just replace those with the current ones I think.

    For clarification, is this an issue with the launcher or my game? Ie, is this something I need to resolve or those using the launcher? 

    Publishing the game standalone seems to work just fine. 

  17. 2 hours ago, burgelkat said:

    Lua Error: [string "D:/games/Steam/steamapps/common/Leadwerks Game Launcher/Game/Scripts/GUI/Panel.lua"]:52: attempt to call method 'GetStyle' (a nil value)
    Process complete.


     i get this error after press lunch in the "LW Game Launcher"

     

    That's odd. Are other games working for you in the Game Launcher?

    Not sure why the launcher is bugging for you before it even tries to start the game

×
×
  • Create New...