Lua: where the heck do I begin? D:
Moderator: Coders of Rage
-
- Chaos Rift Newbie
- Posts: 2
- Joined: Mon Jun 09, 2008 7:04 pm
Re: Lua: where the heck do I begin? D:
Necro post, but meh. The hardest part of making a game script is figuring out how to organize it. Check out this tutorial. Actually the tutorial kinda sucks, but look at how he structured his code. He made a script engine that manages all scripts, processes them and deletes them properly. All the scriptable objects are managed by a singleton. Imo this works fairly well, since you can add scripts on the fly and the singleton manager class will take care of managing that object. Also, you should use toLua++ I use to use Ruby for scripting, and it was so dam slow.
I never let my schooling interfere with my education.
- Moosader
- Game Developer
- Posts: 1081
- Joined: Wed May 07, 2008 12:29 am
- Current Project: Find out at: http://www.youtube.com/coderrach
- Favorite Gaming Platforms: PC, NES, SNES, PS2, PS1, DS, PSP, X360, WII
- Programming Language of Choice: C++
- Location: Kansas City
- Contact:
Re: Lua: where the heck do I begin? D:
Heya--
We're trying to implement NPCs in our Infinite Hat engine right now, but we're confused a little bit.
We're going to have a list of NPCs, their coordinates, and image code, but we also want them to sort of copy over attributes from a template npc. For example, an orc type with it's stats and movement pattern.
Is this possible to copy over info from one table to another?
The way the scripter is talking, it sounds like it ends up pointing to the information and changing it when you try to change the child NPC, so we were thinking of copy-pasting. I just wanted to know if it'd be possible to say like
class Human()
Human Rachel;
but I think it'd be implemented more like (and I don't know what the lua syntax is like)
Pointing
npc orc
npc Rachel
Rachel.type = orc
Copying attributes
npc Rachel
Rachel.attribute1 = Potato.attribute1
Rachel.attribute2 = Potato.attribute2
We're trying to implement NPCs in our Infinite Hat engine right now, but we're confused a little bit.
We're going to have a list of NPCs, their coordinates, and image code, but we also want them to sort of copy over attributes from a template npc. For example, an orc type with it's stats and movement pattern.
Is this possible to copy over info from one table to another?
The way the scripter is talking, it sounds like it ends up pointing to the information and changing it when you try to change the child NPC, so we were thinking of copy-pasting. I just wanted to know if it'd be possible to say like
class Human()
Human Rachel;
but I think it'd be implemented more like (and I don't know what the lua syntax is like)
Pointing
npc orc
npc Rachel
Rachel.type = orc
Copying attributes
npc Rachel
Rachel.attribute1 = Potato.attribute1
Rachel.attribute2 = Potato.attribute2