-
Posts
39 -
Joined
-
Last visited
Recent Profile Visitors
3,166 profile views
CoolBeans's Achievements
Newbie (1/14)
2
Reputation
-
Decreasing Food / Thirst. Hello, Trying to figure out how to have a calorie and thirst system. Ive already cheated and copied the health system twice and renamed both of them. Ive also set up 3 meters on screen health, hunger and thirst. Eventually I want to use calories and dehydration when my charater walks, chops, crafts, or any kind of activity for the most part. For now Id settle for a timed system first. I just want the food and thirst levels to decrease as time goes on in game. --float so i can adjust the speeds individually on the fly Thirst script on bottle of water or what ever fluids. Script.thirst = 15.0 --float "Thirst" Script.useOnce = true --bool "Use once" function Script:Start() if self.thirst < 0 then error("Thirst can't be a negative value.") end end function Script:Use(player) if player.script.thirst < player.script.maxThirst then player.script:ReceiveThirst(self.thirst) if self.useOnce then self.entity:Release() end end end FPSPlayer Script Script.thirst = 100 --float "Thirst" Script.maxThirst = 100 --float "Max Thirst" ** function Script:Thirst(Thirsty,distributorOfThirst) if self.thirst>0 then self.sound.damage[math.random(#self.sound.damage)]:Play() self.thirst = self.thirst - damage if self.thirst<=0 then self:Kill() end end end ** --If thirst lower or equal to zero, the player is dead if self.thirst <= 0 then self.alive = false --Call the OnDead output self:OnDead() end end --Increase thirst function Script:ReceiveThirst(thirstPoints)--in --Increase thirst self.thirst = self.thirst + thirstPoints; --Thirst can not be more then maximum thurst if self.thirst > self.maxThirst then self.thirst = self.maxThirst end --Call Thurst received output self.component:CallOutputs("ThirstReceived") end --when thirst is zero or lower, an output call is made function Script:OnDead()--out --Extra check to make sure that the player is no longer alive if not(self:IsAlive()) then self.component:CallOutputs("Ondead") end Any help on the timed decrease would be awesome! If you can help with other details like faster decrease of thirst in different environments like desert or when chopping a tree etc would be a plus At least point me the direction. Further If I could have it start to decrease your health after a certain point I just thought of! Please O' man help an amateur out! Sneaking one in... Another question. Best way to have a map full of different trees and have it to where I can chop them down and convert them to wood. Maybe play the tree falls over animation. I found one topic in here on this matter and it fizzled out. Need some detailed help / direction if possible. Thank you! CB!
-
Yes Rick its "player" the only part of this I'm fully understanding. Some lessons would be nice. I currently have no cash but when I do I will consider your services for sure. I'm just a guy tired of his job trying to changed gears half way through life while sitting at home with no work. Ive got 150 hours into this so no I don't know the most basic stuff. However I am trying to keep my motivation going with what I have achieved so far. (Impressed myself anyways) I will study up more on functions. I'm still in the if, then, and, early stages of comprehension so bare with me
-
I'm hoping to take this topic further as I do want to make my zombies drop random ammo per gun. I have random spawning zombies and random dropping guns and health packs working. I have the hud working, day night cycle, zombie kill score all working. Once I get this going motivation will be great and lean towards level design since Ill be satisfied with mechanics at that point for a while. Oh quick question too why can't the FPSplayer crouch? I admit I have not looked the code over for contrl key use. I will now and try to answer my own question lol. Too much coffee!!!
-
No problem man your help big or small is greatly appreciated! I'm glad someone is in the same boat with me I just hope it doesn't sink on us CB
-
Yes I assumed that "person" could be any name. Ie Player, Character, John, Moses. Whatever your "player" is named. Since the FPSplayer script uses player it makes more sense to me to keep it that way. I'm trying to understand what Rick said but I'm not far along enough to fully make it all click and work. Wont stop me from trying however. All I know is BlueH doesn't go over adding any code anywhere else. He makes a box. Give is a mass of 1 makes it a prop and give this code to the box. ******************************************************************** AMMOBOX- attempt to index field 'weapons' (anil value) line 3 Script.AmmoAmount=50 --float function Script:Use(player) player.weapons[player.currentweaponindex].ammo = player.weapons[player.currentweaponindex].ammo + self.AmmoAmount self.entity:Release() end Then he uses the stock prefab FPSplayer in the scene and it works fine so you got me as to why it does not work. Same with his small hurt script above and health script. The tutorials are 2 months old so its very frustrating they don't work. Honestly I figured most of you experts could look at things like this and in 5 sec say "hey here the problem" am I crazy to be thinking this? Specially dealing with stock or add-on assets... Thanks again CB
-
Same error. His script calls for "person.weapons" I even tried changing all instances to "player" same error Script.ammoamount=6 --int "Ammo Amount" Script.ammotype=1 --int "Ammo Type" function Script:Use(player) for a=0,6 do if player.weapons[a]~=nil then if player.weapons[a].index==self.ammotype then if player.weapons[a].ammo+player.weapons[a].clipammo<player.weapons[a].maxammo then player.weapons[a].ammo= player.weapons[a].ammo + self.ammoamount if player.weapons[a].ammo+player.weapons[a].clipammo>player.weapons[a].maxammo then player.weapons[a].ammo=player.weapons[a].maxammo-player.weapons[a].clipammo end self.entity:Release() self.entity=nil return end end end end end If I could get it to work and define ammo type per gun that would be aces! I think something must be added to FPSplayer.
-
BluHornets Tutorial. Gone over them can't find the obvious. He makes a helath box, ammo box and hurt box. The scripts below. I either miss where he adds something to the FPSplayer script or he forgets to mention it to avoid these errors? ******************************************************************** AMMOBOX- attempt to index field 'weapons' (anil value) line 3 Script.AmmoAmount=50 --float function Script:Use(player) player.weapons[player.currentweaponindex].ammo = player.weapons[player.currentweaponindex].ammo + self.AmmoAmount self.entity:Release() end ******************************************************************** HEALTHBOX- atempt to call method 'ReceiveHealth' (a nil value) line 4 Script.HealthAmount=50 --float function Script:Use(entity) entity:ReceiveHealth(self.HealthAmount) self.entity:Release() end ******************************************************************** HURTBOX- attempt to call 'Hurt' (a nill value) line 7 Script.HurtAmount=25 --float function Script:Start() end function Script:Use(entity) entity:Hurt(self.HurtAmount) end ************************************* This is Jorns health kit I got working but If I remember right something is added to FPSplayer for i to work. Maybe that's the problem above. I tired to PM bluH about this he must be busy. Thanks CB Script.health = 15.0 --float "Health" Script.useOnce = true --bool "Use once" function Script:Start() if self.health < 0 then error("Health can't be a negative value.") end end function Script:Use(player) if player.script.health < player.script.maxHealth then player.script:ReceiveHealth(self.health) if self.useOnce then self.entity:Release() end end end
-
Published Workshop item not in Addon Manager
CoolBeans replied to epsilonion's topic in General Discussion
Thanks I thought I was going crazy looking for them. I tried the root, add-ons, I was on a hunt. No luck and same on the 'thumb.tex' -
Published Workshop item not in Addon Manager
CoolBeans replied to epsilonion's topic in General Discussion
Any chance there is still a problem with the 24 Height maps on the workshop? I'm not ready to rule out that I'm blind but I sure have put on a good search for some time now. I pretty sure I have to import them into the terrain editor and make sure the maps are the same size. Where are they? -
Thanks for the tip BH. I'm starting to see how every problem overcome is a valuable learning experience. Just a few weeks ago I thought I would never get this but already I'm fixing things and learning fast. I know I'm a long long long way away but every time I think that I learn something new and the motivation sticks. Never thought it could be so frustrating wanting to learn everything yesterday. Why wasn't it like that back in school . Of course I have many of you to thank for your help so thanks again!
-
Thanks Panther extremely handy. CB
-
0o0 OMG! I may as well throw in the towel too much to learn. This is amazing man! If only there was organized information somewhere on this stuff people could actually learn from...
-
Odd it was there, copied it from his tutorial Again thanks so much you have helped me advance more in 24 hours then I have in 2 weeks. I got some oddities I'm going to try to tune on myself with the display but the ammo count works as well as clip and health.This is awesome! 2 Problems I got to ask at this point since you are so kind to help. Do you know how I can start with no weapon and not get the nil error? In my game you start with no guns. The other problem is the prefab machete doesn't work if added to a game with the Hud script active. I get the hand icon and I can manually pick it up. Swept over auto pickup not working as well as can't equip or use it.I added shot gun working fine. Something to do with the machete not having ammo mechanics .. and the Hud script? I have awesome in game sound, day night cycle and now the hud sorta working as well as navmash and ai, this is monumental Can anyone tell me how to make screen shots in game? It doesn't capture the game app. CB
-
Thanks for the fix on the health bar flashing from the other topic. http://www.leadwerks.com/werkspace/topic/10817-problem-with-pistol-prefab/ Well maybe I'm in too deep on this one. This is the HUD tutorial from Blue Hornet. I'm starting to think he did some prior tutorials and there is some code I'm missing in other areas like FPSplayer for example. Besides the one already done. Killscore for example must be else where. I need to learn the global, local, place in lua.app or not ect have not gone over a good description of how the order of things work in lua perhaps I shall. I added the killscore = 0 at the top of lua got me passed that error and on to the next ;( error in function 'DrawImage'. argument #6 is '[no object]';'number' expected. line 66 context:DrawImage(self.HudRightImage,context:GetWidth()-self.HudRightImage:GetWidth(),context:GetHeight()-self.HudRightImage:GetWidth(),context:GetHeight()) Thank you, CB Edit: another problem I'm having with a lot of tutorials is the FPSplayer is not the same code in most examples. even on tutorials that are only 2 months old.
-
You are the man! Thank you very much! Works like a champ I really appreciate you helping out.