Jump to content

Recommended Posts

Posted

To build on josk's answer if you do go global variables (I would maybe look at file i/o for this unless you want it to work on the game player) make a global table and store the values in there inside Main.lua. It'll just be easier to organize things that way vs loose variables.

  • Upvote 2
Posted

If i add the variable Josk suggested, how do i call that variable in FPSPlayer.lua?

 

Im assuming its Script.heath = HitPoints, but that doesnt seem to work.

 

Edit:

Ok, I literally used find and replace in FPSPlayer.lua for self.health to Hitpoints, which made it work. Thank you!

 

One other thing though, How exactly would I go about using file i/o?

Posted

I wouldn't be in a hurry to use file i/o if you are just using LUA, as that would probably preclude the use of the game player, which requires sand pit mode, and using file i/o will probably mean you cant get your game published as easily. If you have a requirement for file i/o and it would be general purpose and safe, Josh may code some new api, to wrap up your functionality that would then allow that to be added, like he did for the high score board.

  • Upvote 1

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...