lxFirebal69xl Posted February 6, 2015 Share Posted February 6, 2015 Just wondering if any of you guys would like to help me do this one script, where the player interacts with an object, and a screen like the one below pops up. It either plays a sound or not, and it has a button to interrupt it, it also should dissapear after it's been used, but I already did that part 3 Quote Link to comment Share on other sites More sharing options...
Josh Posted February 6, 2015 Share Posted February 6, 2015 This would be really cool as a general-purpose game mechanic. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted February 6, 2015 Author Share Posted February 6, 2015 This would be really cool as a general-purpose game mechanic. Exactly, it could be used for a lot of other things besides notes, for example, a PDA screen in a sci-fi game. 1 Quote Link to comment Share on other sites More sharing options...
Imchasinyou Posted February 7, 2015 Share Posted February 7, 2015 Something like that would be a really nice addition. I can see alot of possibilities especially at the start of a game, entering a new level and those sorts of things. Id probably set up it on collision if it were something I could manage to create. maybe DrawRect: for the shaded box to cover the screen and DrawImage: for the background image and then DrawText for the text? Just throwing ideas out there for thoughts or ideas. I liek the idea none the less. Im digging the new hat there Josh. Quote Asus sabertooth 990FX, AMD FX 9590 , Windows 7 Home Premium 64 Bit, 4 HDD's Western Digital Caviar Black set in Raid 0, 16 GB Crucial Ballistix Elite, Asus Radeon R9 270 X 4GB, Corsair CM750M, Link to comment Share on other sites More sharing options...
beo6 Posted February 7, 2015 Share Posted February 7, 2015 i just hacked together a script like that. it works together with the default FPSPlayer.lua script. You also need to disable Sandbox LUA mode in the editor to read the text-files. (i might look at it if i can use lua files for the text instead) Tools -> Options -> Sandbox LUA = disabled Notes.zip - got the texture from here: http://www.wildtextures.com/free-textures/old-grunge-paper-texture/ Quote Link to comment Share on other sites More sharing options...
Imchasinyou Posted February 7, 2015 Share Posted February 7, 2015 What a nice contribution. Works great and looks very nice. Im trying to change the font on the text but it dont seem to work if you just edit the text file. Edit: Got the new font to load. Stupid fingers dont understand when i push the Shift keya nd then a letter, its supposed to be CAPITALIZED! A new Keyboard that isnt crusty would be nice Poor lil G510 has seen some hours, alot of liquor and even more cigarettes than i would care to share. Again, awesome contribution! 1 Quote Asus sabertooth 990FX, AMD FX 9590 , Windows 7 Home Premium 64 Bit, 4 HDD's Western Digital Caviar Black set in Raid 0, 16 GB Crucial Ballistix Elite, Asus Radeon R9 270 X 4GB, Corsair CM750M, Link to comment Share on other sites More sharing options...
beo6 Posted February 7, 2015 Share Posted February 7, 2015 no problem. was fun to code. I needed something else and i thought this is a good way to keep scripting. some small things i didn't got to work like changing the text color. it was every color but not the one i had set. also i tried to bakup the original font so i can revert back to it after drawing but that didn't seemed to work. will need to look into that further to see if that are bugs or i did something wrong. Quote Link to comment Share on other sites More sharing options...
Imchasinyou Posted February 7, 2015 Share Posted February 7, 2015 If I might ask, what did you try to set the color? Im sure its the same as what i would think of trying. Something like the context:SetColor(1,1,1,1) command? Quote Asus sabertooth 990FX, AMD FX 9590 , Windows 7 Home Premium 64 Bit, 4 HDD's Western Digital Caviar Black set in Raid 0, 16 GB Crucial Ballistix Elite, Asus Radeon R9 270 X 4GB, Corsair CM750M, Link to comment Share on other sites More sharing options...
beo6 Posted February 7, 2015 Share Posted February 7, 2015 Ah. Now that you write it i know what I did wrong. the colours are between 0 and 1 and not 0 and 256. Will fix that later. Quote Link to comment Share on other sites More sharing options...
Imchasinyou Posted February 7, 2015 Share Posted February 7, 2015 I know there is a way to use the 255 scale but I cant find an example at the moment. Quote Asus sabertooth 990FX, AMD FX 9590 , Windows 7 Home Premium 64 Bit, 4 HDD's Western Digital Caviar Black set in Raid 0, 16 GB Crucial Ballistix Elite, Asus Radeon R9 270 X 4GB, Corsair CM750M, Link to comment Share on other sites More sharing options...
macklebee Posted February 7, 2015 Share Posted February 7, 2015 just divide each component by 255 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Thirsty Panther Posted February 7, 2015 Share Posted February 7, 2015 I know there is a way to use the 255 scale but I cant find an example at the moment. Aggrors healthbar script ( from his videos ) has a script that does the conversion for you. Quote Link to comment Share on other sites More sharing options...
beo6 Posted February 7, 2015 Share Posted February 7, 2015 thanks. i know how to convert. it was just late and i didn't looked up the documentation. i changed it. Now you can select the color. Also the note can be closed either with pressing E again now or just by walking away and looking away. Note.lua Quote Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted February 7, 2015 Author Share Posted February 7, 2015 I'm having a little problem, I can't get the texture to show up, it stays a transparent black box behind the text. And the text goes off the texture as well, any way I could fix that? Quote Link to comment Share on other sites More sharing options...
beo6 Posted February 7, 2015 Share Posted February 7, 2015 don't know about the texture. Maybe some wrong setting in the Texture Editor? The text does currently not know when to break to a new line on its own. So you need to have the lines short enough to fit on the texture. But i agree that it would be nice. But then there is also the issue about different display resolutions that could limit the available space or text-size. another nice feature would be to have multiple pages to read Quote Link to comment Share on other sites More sharing options...
Imchasinyou Posted February 7, 2015 Share Posted February 7, 2015 You can make the text lines shorter so that they dont run off the screen. Try using wordpad instead of notepad to edit the text, use the centered justification. Look at the screen when you "use" the object to make the screen come up and find a line that fits and make the other lines similar in size by just pressing "enter". Change the font by changing the font line in the script. I didnt have any issues with the texture not showing up but I did use the one that was with the DL as it fits my theme already. multiple pages would be cool as well to tell a story or set up a scene for the player. I am going to try and have a character that is just standing there running its idle animations as the object to use. Ive done this before and it worked but as of recent, there seems to be something wrong with my process of setting it up :/ Quote Asus sabertooth 990FX, AMD FX 9590 , Windows 7 Home Premium 64 Bit, 4 HDD's Western Digital Caviar Black set in Raid 0, 16 GB Crucial Ballistix Elite, Asus Radeon R9 270 X 4GB, Corsair CM750M, Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted February 7, 2015 Author Share Posted February 7, 2015 I just tried using some default textures on the script and they don't work either, I got the text issue sorted (Thanks Imchasinyou). But I don't understand why the texture doesn't show up, i tried all of the default textures that come with leadwerks and none of them worked. Quote Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted February 7, 2015 Author Share Posted February 7, 2015 I also tried it with the texture that beo6 used, again, dind't work. I can see the texture, but without colour. Quote Link to comment Share on other sites More sharing options...
beo6 Posted February 7, 2015 Share Posted February 7, 2015 (edited) looks like you call context:SetColor() somewhere in your script. As a quick workaround you can call context:SetColor(1,1,1,1) right before context:DrawImage() in the Note.lua file in the PostRender function. //Edit: I just added the setcolor for the texture drawing and also added some more text settings like text alignment, size and line spacing. I just uploaded it to the steam workshop (first item i uploaded to the workshop) http://steamcommunity.com/sharedfiles/filedetails/?id=388493460 Edited February 7, 2015 by beo6 Quote Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted February 7, 2015 Author Share Posted February 7, 2015 looks like you call context:SetColor() somewhere in your script. As a quick workaround you can call context:SetColor(1,1,1,1) right before context:DrawImage() in the Note.lua file in the PostRender function. //Edit: I just added the setcolor for the texture drawing and also added some more text settings like text alignment, size and line spacing. I just uploaded it to the steam workshop (first item i uploaded to the workshop) http://steamcommunity.com/sharedfiles/filedetails/?id=388493460 Thank you that fixed it! And the we need more workshop files like that one Quote Link to comment Share on other sites More sharing options...
AnthonyPython Posted February 9, 2015 Share Posted February 9, 2015 I Modified it a bit to allow the Font to be changed in the editor, anyways good job beo6 Quote OS: Windows 10 Pro CPU: i3-10100 CPU @ 3.60GHz GPU: NVIDIA 2060 Super - 8 GB RAM: 32 GB Link to comment Share on other sites More sharing options...
beo6 Posted February 9, 2015 Share Posted February 9, 2015 hi. i just updated the script in in the steam workshop with some features. like you wrote i added a selection for font (if none is selected the Arial.ttf is used) flowgraph outputs so you can for example have a monster chasing you as soon as you have closed the note ( slenderman anyone? ) open / close sounds loading of lua text files so the script also works in Sandbox lua mode. (there is a text1.lua for an example how they should look) Quote Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted February 9, 2015 Author Share Posted February 9, 2015 hi. i just updated the script in in the steam workshop with some features. like you wrote i added a selection for font (if none is selected the Arial.ttf is used) flowgraph outputs so you can for example have a monster chasing you as soon as you have closed the note ( slenderman anyone? ) open / close sounds loading of lua text files so the script also works in Sandbox lua mode. (there is a text1.lua for an example how they should look) All these updates are just making your only workshop item one of the best around Keep it up! Quote Link to comment Share on other sites More sharing options...
AnthonyPython Posted February 11, 2015 Share Posted February 11, 2015 hey beo, you need to add this in the release function to make sure if the sound isn't nil before trying to release it other wise it will try to release something that is nil and crash the game all together (happened to me pressing esc to go to the menu map) if self.openSound ~= nil then self.openSound:Release() end Quote OS: Windows 10 Pro CPU: i3-10100 CPU @ 3.60GHz GPU: NVIDIA 2060 Super - 8 GB RAM: 32 GB Link to comment Share on other sites More sharing options...
beo6 Posted February 11, 2015 Share Posted February 11, 2015 ah right. sorry about that. will fix this as soon as possible. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.