jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 31 Dec 2011 04:52 AM |
Okay, who didn't hear about my new game can look here;
http://www.roblox.com/Forum/ShowPost.aspx?PostID=54151398
It's pretty hard to script all those ideas, the first issue is the Eat/Drink tool. I'm not familar with Lua yet, but I'm pretty good in coding other languages (C++, Python)
The idea is that if you select the script a GUI pops up. This works already.
Then it checks if you can eat or drink the item your mouse is on. Every part that is edible has an edible tag in it, with NumberValues in it that define how much hunger and thirst it fills. It shows it in the GUI with text (number of health points) and a bar that gives you an idea of the health points it gives back in the bar itself (to see in just a moment if something gives you more food!)
The bar itself is like this, it's above a GUI that shows you your current health points, it looks exactly the same. Between those guys there is a black bar that shows you if you can eat it or not, and if you can then it shows you what it is (e.g. bread). I got those already. Also, if it gives you a positive hunger, it goes to the right (from the middle!) and if it gives you negative hunger it goes to the left. So, every bar starts in the middle ;) The GUI itself is done.
I'm pretty confused about the script itself. As I said, the GUI is doen aswell the popping up and deleting the guy again (it moves itself from the Backpack to PlayerGUI!)
The idea that I wanna get first is this, look at this piece of code.
wait(1)
local name_player = script.Parent.Parent.Parent.Name local player = game.Workspace:FindFirstChild(name_player) local player_new = script.Parent.Parent.Parent
local thirst_after_eaten = script.Parent.ScreenGui.Frame.ThristNew local hunger_after_eaten = script.Parent.ScreenGui.Frame.HungerNew
local tool = script.Parent
local thirst_after_eaten_textlabeltext = script.Parent.ScreenGui.Frame.ThristNew.TextLabel.Text local hunger_after_eaten_textlabeltext = script.Parent.ScreenGui.Frame.HungerNew.TextLabel.Text
local ScreenGUI = script.Parent.ScreenGui
function onSelected(mouse) ScreenGUI.Parent = player_new.PlayerGui end
function onDeselected(mouse) ScreenGUI.Parent = tool
mouse.Move:connect(function() onMouseMove(mouse) end) end
function onMouseMove(mouse) print("Mouse moved!") end
tool.Selected:connect(onSelected) tool.Deselected:connect(onDeselected)
The issue is in the function onMouseMove(mouse). It doesn't print anything and I really don't know how to fix it. Someone has an idea?
Happy New Year too :) |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2011 05:22 AM |
So are you trying to define the mouse after the tool is deselected?
Happy new year :) |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2011 05:23 AM |
| Maybe try it in the onSelected(mouse) function. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 31 Dec 2011 05:45 AM |
| You can't use it after you deselected, because Roblox only allows mouse if a tool is selected ;) It's to update the GUI if the mouse if moved (because if you move the mouse, your target food/drink or something else is changed!). But that comes later, I first wanna get that message printed ;) |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2011 05:47 AM |
Any Output?
R.I.P Ben Breedlove. |
|
|
| Report Abuse |
|
|
juriaan
|
  |
| Joined: 25 Nov 2008 |
| Total Posts: 939 |
|
|
| 31 Dec 2011 05:48 AM |
This is also then a good idea : If the Tool is Selected then do the next script.Parent.Parent = nil It will remove the tool. But you are still able to do the Events.
Juriaan
|
|
|
| Report Abuse |
|
|
| |
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 31 Dec 2011 05:51 AM |
Output? Yep, after I deselect it.
12:50:23 - Players.Player.Backpack.Eat/Drink.Script:24: attempt to index local 'mouse' (a nil value) 12:50:23 - Script "Players.Player.Backpack.Eat/Drink.Script", Line 24 12:50:23 - stack end
It stops the script AFTER I deselect the tool.
@Juriaan, what do you mean? It removes the tool itself, so one use only? I'm trying to understand you :) |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Dec 2011 05:54 AM |
function onDeselected(mouse) repeat wait() until mouse ScreenGUI.Parent = tool mouse.Move:connect(function() onMouseMove(mouse) end)
R.I.P Ben Breedlove. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 31 Dec 2011 05:55 AM |
@rangersmash: The ideas are based of Survival 404, but it's totally different. And no, this is not Survival 404. Read the other topic in the first post to see it for yourself.
Repeat: This is not a remake/copy of Survival 404, it's a full new game except the base ideas (Surviving, eating, drinking, crafting) are from 404, the rest (new chat, upgrading, repairing, new ships, new mining, new weather, day night.. etc) are ALL new.
Why do you think this is Survival 404? That hurts you know! |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 31 Dec 2011 05:56 AM |
@rangersmash: *sigh* Believe me or not, go to my place on my profile and check it out. I can script, if you don't believe me thats ur own problem.
I gtg now, happy new year everywone and till monday (not on tomorrow) |
|
|
| Report Abuse |
|
|