lxFirebal69xl Posted June 8, 2015 Share Posted June 8, 2015 Ok, so the purpose of this forum thread to to get some general help with any type of mechanic a user with bad programming skills might need for their game, think of it as an add-on to the tutorials I myself have been having a bit of trouble with a couple of things. As you might know I'm in the process of making a game called "A Demon's Game", it's a horror game so it needs some mechanics that I myself haven't been really able to work out that well which are... 1)Battery system, seriously, I have been battling this for the longest time and I can't figure out a good way to make a system whereas the user has a bar, or a countdown number that indicates how many seconds the flashlight has left, then it shuts off and can't be turned on untill another battery is picked up. Any help with this would be amazing. 2)Leaning/peeking, this one shoulnd't be too hard to make, all it is is camera manipulation whenever the user presses Q or E. But alas, I'm too dumb to figure out this for myself 3)Sneaking, yea, this one is a though one, imagine sneaking from thief or dishonored but in a more simple way, whereas the player crouches and the monster's visibility is lowered or something that would do the same effect. 4)Something that is really simple, if you've played vectronic, you would notice the reticle when you're playing looks like these 2 lines that used to form a square but with a slice down the middle, I would like to make something similar to that, a reticle, maybe even have it change depending on what the player was looking at, for example if the player looked at a note, the reticle would change to a magnifiying glass and when the player looked around normally it would go back to the default one. Sorry if I seem a bit hopeless with this post, but programming is the only thing that I'm not good at, so I would greatly appreciate some help! Cheers! 1 Quote Link to comment Share on other sites More sharing options...
thehankinator Posted June 9, 2015 Share Posted June 9, 2015 Are you looking to learn how to do these things yourself or looking for a volunteer? #1 Seems pretty straight forward. Are you using the default FPSPlayer script? #2 This is tricky, maybe translate to the side then rotate? #3 I have implemented very simple sneaking in the game I am working on. Basically I cast a ray (World:Pick) from the monster to the player, if it is unobstructed I measure the angle, I have mine check for ~120 degrees. If it is within that angle I set the monster to attack #4 This shouldn't be hard to do, if you are using the FPSPlayer script, you could take a look at the canUse variable. After the World:Pick, you could check a variable in the resulting entity to see if it is a note or something else. Quote Link to comment Share on other sites More sharing options...
Rick Posted June 9, 2015 Share Posted June 9, 2015 3)Sneaking, yea, this one is a though one, imagine sneaking from thief or dishonored but in a more simple way, whereas the player crouches and the monster's visibility is lowered or something that would do the same effect. Is this more about sound than visual? A decent way to handle this could be using http://www.leadwerks.com/werkspace/page/api-reference/_/world/worldforeachentityinaabbdo-r66 Use the players AABB which there should be a function in the Entity part of the documentation and then just add to it's values to make it larger when running/walking and smaller when sneaking. The function itself will return all entities in the bounding box you provide it. You can then loop over all entities and if one of them is a monster alert it. The thing is we are giving you basic ideas and not typing the code for you. Are the basic ideas all you need or do you need actual code typed because you find it hard to translate a design we tell you to actual code? Quote Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted June 9, 2015 Author Share Posted June 9, 2015 Are you looking to learn how to do these things yourself or looking for a volunteer? #1 Seems pretty straight forward. Are you using the default FPSPlayer script? #2 This is tricky, maybe translate to the side then rotate? #3 I have implemented very simple sneaking in the game I am working on. Basically I cast a ray (World:Pick) from the monster to the player, if it is unobstructed I measure the angle, I have mine check for ~120 degrees. If it is within that angle I set the monster to attack #4 This shouldn't be hard to do, if you are using the FPSPlayer script, you could take a look at the canUse variable. After the World:Pick, you could check a variable in the resulting entity to see if it is a note or something else. Both really, I want to get into scripting, but I'm only able to do simple stuff at the moment, that's why I started this thread, to hopefully get help from people, I mean, if someone wants to just make a script for any of these things for comunity use, that would be cool too. Because the problem is, while I do understand what you're trying to say for all of the mechanics I'm trying to implement into my game, I have no clue how to go about it. But thank you anyways, for giving me another perspective on them. Quote Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted June 9, 2015 Author Share Posted June 9, 2015 Is this more about sound than visual? A decent way to handle this could be using http://www.leadwerks.com/werkspace/page/api-reference/_/world/worldforeachentityinaabbdo-r66 Use the players AABB which there should be a function in the Entity part of the documentation and then just add to it's values to make it larger when running/walking and smaller when sneaking. The function itself will return all entities in the bounding box you provide it. You can then loop over all entities and if one of them is a monster alert it. The thing is we are giving you basic ideas and not typing the code for you. Are the basic ideas all you need or do you need actual code typed because you find it hard to translate a design we tell you to actual code? I kind of understand what you're saying with the AABB thing, but just like I told hankinator, I have no clue how to actually use the code, I can see where you going with it, but I think I would much rather have the script written down for me, otherwise I will never get past this anytime soon Quote Link to comment Share on other sites More sharing options...
Rick Posted June 9, 2015 Share Posted June 9, 2015 I do provide starting Lua training for people. It's $10 for 1 hour and I've worked with people that have zero programming skills before. I'm very patient and understanding and easy to get along with and have about 15+ years programming experience in total. You seem to be a person who would benefit from 1 on 1 training as you have the desire to learn but probably learn better from a person than some textbooks. Hit me up in a PM if you are interested and we can work out a time. It'll go a long way with you I think. Quote Link to comment Share on other sites More sharing options...
thehankinator Posted June 9, 2015 Share Posted June 9, 2015 Both really, I want to get into scripting, but I'm only able to do simple stuff at the moment, that's why I started this thread, to hopefully get help from people, I mean, if someone wants to just make a script for any of these things for comunity use, that would be cool too. Because the problem is, while I do understand what you're trying to say for all of the mechanics I'm trying to implement into my game, I have no clue how to go about it. But thank you anyways, for giving me another perspective on them. Training from Rick would probably help you most in the long run but if that isn't a possibility, we can go through some of this stuff one a time and create a tutorial like modification to the default scripts so that everyone can benefit. Quote Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted June 9, 2015 Author Share Posted June 9, 2015 Yeah, as much as I would like to have a 1 on 1 class with rick, sadly for me and him, that's not a possibility at this moment, maybe in the future. So yea, the last option is to go through each of these things slowly and thoughtfully to help everyone in need of these specific mechanics, maybe we could even put the scripts in the workshop when they're done! Quote Link to comment Share on other sites More sharing options...
Rick Posted June 9, 2015 Share Posted June 9, 2015 So yea, the last option is to go through each of these things slowly and thoughtfully to help everyone in need of these specific mechanics, maybe we could even put the scripts in the workshop when they're done! It's a very noble thought and I hope people have the time to help. It just generally doesn't work out that way very well and so knowing how to turn these higher level ideas into code yourself is a huge benefit. I understand though. Quote Link to comment Share on other sites More sharing options...
thehankinator Posted June 9, 2015 Share Posted June 9, 2015 Yeah, as much as I would like to have a 1 on 1 class with rick, sadly for me and him, that's not a possibility at this moment, maybe in the future. So yea, the last option is to go through each of these things slowly and thoughtfully to help everyone in need of these specific mechanics, maybe we could even put the scripts in the workshop when they're done! Alright, I'll work on a tutorial for item #1 first then go from there. I don't have excessive amounts of time to invest on this so it may take a few days. Quote Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted June 9, 2015 Author Share Posted June 9, 2015 Alright, I'll work on a tutorial for item #1 first then go from there. I don't have excessive amounts of time to invest on this so it may take a few days. Do take your time, I appreciate the help Quote Link to comment Share on other sites More sharing options...
thehankinator Posted June 10, 2015 Share Posted June 10, 2015 I had some time tonight. Not sure which task I'll look into next. Item #1 http://www.leadwerks.com/werkspace/topic/12783-flashlight-battery-tutorial/ Quote Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted June 10, 2015 Author Share Posted June 10, 2015 Today I fiddled around with the sneaking aspect and I got a crouching thing going on, since you know sneaking involves crouching and stuff. I made 2 new variables Script.crouchHeight = 0.6 --float "Crouch Height" Script.crouched = false --crouched Starting at line 629 of the FPSPlayer script this is what I got. -- Check for crouching if App.window:KeyHit(Key.C) then crouched = not crouched end --With smoothing --Position camera at correct height and playerPosition self.entity:SetInput(self.camRotation.y, playerMovement.z, playerMovement.x, jump , crouched, 1.0, 0.5, true) local playerPos = self.entity:GetPosition() local newCameraPos = self.camera:GetPosition() local playerTempHeight = 0 if (self:IsCrouched()) then playerTempHeight = self.crouchHeight + playerPos.y else playerTempHeight = self.playerHeight + playerPos.y end --playerTempHeight = ((self:IsCrouched() == true) and crouchHeight or playerHeight) newCameraPos = Vec3(playerPos.x, newCameraPos.y ,playerPos.z) --if newCameraPos.y<playerPos.y + self.eyeheight then newCameraPos.y = Math:Curve(playerTempHeight, newCameraPos.y, 8) --else --newCameraPos.y = playerPos.y + self.eyeheight --end self.camera:SetPosition(newCameraPos) Any thoughts if I should change something? This is just the crouching part of the sneaking, nothing else. Quote Link to comment Share on other sites More sharing options...
thehankinator Posted June 13, 2015 Share Posted June 13, 2015 Item #3 http://www.leadwerks.com/werkspace/topic/12805-basic-sneaking-tutorial/ 1 Quote Link to comment Share on other sites More sharing options...
thehankinator Posted June 23, 2015 Share Posted June 23, 2015 I added item #2 to to the sneaking tutorial. 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.