LUA + MML

Have a question, suggestion, or comment about Aleph One's features and functionality (Lua, MML, the engine itself, etc)? Post such topics here.
irons

I've seen a lot of confused posts around here. Most of you make understandable assumptions about the extensions to Aleph One, Lua and MML. It is pretty easy to find out what each can or can't do by looking at the documentation, which is always included in the Aleph One download (although most Mac users probably only copy the App):Lua DocumentMML DocumentHowever, many of you probably don't take the time to read the above documentation. Believe me, it's not that complicated; I had no programming experience a year ago, and I picked up Lua and got very far within six months--I had finished AORPG by then and was doing some work on Juggernauts.

For those of you who are still daunted by these extension languages--or just lazy--I'm going to include a few rules of thumb that can help you determine whether or not Lua or MML can make something possible.

Look at MML if you want to...add substitute graphics or sounds (à la Texture Enhancement Package)change a lot of defaults that are hard-coded in the engine (gravity, liquid color, strings, map colors, damage flash colors, other stuff)make level-wide or engine wide modifications to environments, weapon order, item properties, etc.release a modification that requires download to use (Including new shapes or something like that)--as long as both players are guaranteed to have the MML file. (In other words, you can prevent OOS by ensuring that all players in a multi-player game will have the same version of the MMLLook at Lua if you want to..manipulate game mechanics on-the-fly (gravity in certain places, oxy drain in certain places, polygon heights, platform behavior, monster enemies + friends, etc)replace complex map trickery with simpler solutions (stacked terminals vs. displaying multiple term text on a single terminal)use accurate timers (a.k.a. variables as opposed to platforms)manipulate the position, health, oxygen, angle-facing, etc. of individual playersplace individual monsters and items on specific polygonsmanipulate monster actions like attack and movemanipulate the position, yaw, pitch, or target of individual projectilesdistribute a modification that needs only be played by joining a net game (non-embedded Lua scripts are sent to all players)Neither of these languages is capable of...modifying the basic numbers of a Shapes file (ticks-per-frame, etc)changing weapon behavior mid-game (burst count, recoil, etc)writing to files other than Aleph One Log.txtcontrolling monsters precisely (although this is improving)altering map geometry by adding or removing polygons, switches, rechargers, and terminal locationsAs you can see, MML is usually for static, configuration-like changes to the engine, such as those often used to make Total Conversions, etc. Lua, on the other hand, is useful for hacking in-game parameters in a dynamic fashion. Obviously, I haven't covered everything, but you can post here or simply look at the documentation if you really want to know about something. Both languages are still changing, but not neccessarily very quickly. If I encounter a new "rule of thumb," I'll add it here so that everyone can see. I'll try to keep this list up-to-date as well.
Last edited by irons on Feb 17th '11, 21:45, edited 1 time in total.
Samus

Could you upload a copy of your head shot lua?
User avatar
assassingao
Vidmaster
Posts: 1174
Joined: Jan 24th '06, 21:42

What does this command do?

"prompt (player, prompt)"




(I read the lua documentaion but I don't seem to understand...)


How'd you give specific weapon to specific players with specific names/color with lua?
(Like in AORPG, But I looked in and kinda...not understand it....)

(It'll be important to the insta-gib script... To define player's beam color and stuff...)
User avatar
LegacyTyphoon
Vidmaster
Posts: 2506
Joined: Jan 24th '06, 01:23
Contact:

Wait, I thought earlier you said recoil was possible.
The Pf'hak - Read it.
Science technology jargon physics.
User avatar
SirBlastalot
Vidmaster
Posts: 789
Joined: Mar 28th '06, 19:11
Location: Currently marooned on Earth, please assist!
Contact:

It says changeing recoil mid-game, not just changeing recoil. Also, recoil in this case probably refers to the player being pushed backwards, not looking up.
Attachments
PID_Character_Scripts.zip
(29.32 KiB) Downloaded 701 times
The only choice you have is the one I've already made for myself. Disappear into the darkness. Then make them fear the shadows.

"Real life, getting in the way of nerds since 1983"
-DcBob
User avatar
LegacyTyphoon
Vidmaster
Posts: 2506
Joined: Jan 24th '06, 01:23
Contact:

I wonder if its possible to change Physics files mid game...
The Pf'hak - Read it.
Science technology jargon physics.
irons

Gao, the prompt basically asks a user to input something. I could have a Lua script do something like this:

the game: What is your name?
(enter name): irons
the game: Hello, irons.

It is not available in netgames so players can't use it to cheat.

Gao, if "instagib" is what I think it is (starting all players with some powerful weapon and ensuring that they die in one hit), it's easy to use a physics file only to make this "mode." Just make the pistol item give the player a super-powerful weapon that will kill in one shot.

Recoil the way I suspect Legacy means it, that is, making the view inch up as the player fires shots, is possible, but shoddy at best. And Legacy, you can't change physics files in-game.
Last edited by irons on Jun 19th '06, 20:51, edited 1 time in total.
User avatar
assassingao
Vidmaster
Posts: 1174
Joined: Jan 24th '06, 21:42

Gao, if "instagib" is what I think it is (starting all players with some powerful weapon and ensuring that they die in one hit), it's easy to use a physics file only to make this "mode." Just make the pistol item give the player a super-powerful weapon that will kill in one shot.
I thought of that first, but then I decided to use lua to let the player choose their beam/gun style. (Like in AORPG, different class, different weapons)


(There'll be Light Blue, Green, Flame, Yellow, Soul, Simulacrum, Poison warhead and BALL!, each beams will have different damage type and appearance, but have SAME AMOUNT of damage.)


Each guns will use SAME kind of ammo, though.

Still in testing...
(Forgot to decrease the theta error, forgot to change "alien weapon" contrail back to "lamp breaking" and change the soul to be a missile contrail since grenade was too small.)
Last edited by assassingao on Jun 20th '06, 16:45, edited 1 time in total.
User avatar
Homocidal Ham
Cyborg
Posts: 318
Joined: Jan 22nd '06, 14:16
Location: Behind you (mwahahaha)
Contact:

Q: can I change the player's monster type?
"I often think about poor old bill, and how hard he was to saw."
donmerlin

irons wrote:[/list]Neither of these languages is capable of...modifying the basic numbers of a Shapes file (ticks-per-frame, etc)changing weapon behavior mid-game (burst count, recoil, etc)writing to files other than Aleph One Log.txtcontrolling monsters precisely (although this is improving)altering map geometry by adding or removing polygons, switches, rechargers, and terminal locations
If your weapons are Lua controlled to begin with, then you can actually use Lua to change weapon behavior mid-game. You can use counters to determine values for a weapon, and if you wanted to have these values saved in a saved game, then convert them to Forge parameters. I usually used lights to save booleans, and platforms to save numeric values.

To some degree, recoil can be emulated with Lua. The actual burst count from a gun cannot be altered, but you could have projectiles spawn other projectiles, and then change that value as the level progresses.

While there are limitations, I still think there is much more that can be done with Lua that people have yet to tap into. It requires a lot of creativity to work around the engine restrictions. It's a lot of fun when you get something working. :)
User avatar
irons
Vidmaster
Posts: 2651
Joined: Mar 1st '06, 20:44
Location: (.Y.)
Contact:

You can't spawn projectiles directly.
underworld : simple fun netmaps // prahblum peack : simple rejected netmaps
azure dreams : simple horrible netmaps // v6.0!!!: thomas mann's greatest hits : simple simple netmaps
donmerlin

irons wrote:You can't spawn projectiles directly.
You can spawn them in a number of ways. You can make the Forge projectile activate immediately, and upon activation, spawn a creature the sends out multiple projectiles (and then change the creature that gets spawned as the level progresses).

You can also spawn a normal projectile on detonation. For example, when Merlin's wand uses the firestorm spell, I could have made the spell more powerful as the level continued by:

A) spawning more fires for each fireball that landed, and
B) extended the life of the fire, and
C) actually change the spawned fire creature to another one that emits hotter fire.

Much you can do!
User avatar
irons
Vidmaster
Posts: 2651
Joined: Mar 1st '06, 20:44
Location: (.Y.)
Contact:

Don Merlin wrote:You can also spawn a normal projectile on detonation.
What do you mean?
underworld : simple fun netmaps // prahblum peack : simple rejected netmaps
azure dreams : simple horrible netmaps // v6.0!!!: thomas mann's greatest hits : simple simple netmaps
donmerlin

irons wrote:What do you mean?
I mean that instead of using an invisible immediate projectile to spawn a creature, you can also use a normal projectile. In my example, the fireball is a standard projectile in the game, but for this particular spell, it spawns fire creatures upon detonation.
User avatar
irons
Vidmaster
Posts: 2651
Joined: Mar 1st '06, 20:44
Location: (.Y.)
Contact:

Where's the function to spawn projectiles?
underworld : simple fun netmaps // prahblum peack : simple rejected netmaps
azure dreams : simple horrible netmaps // v6.0!!!: thomas mann's greatest hits : simple simple netmaps
donmerlin

irons wrote:Where's the function to spawn projectiles?
To spawn projectiles, you first spawn a creature, whether a special creature like a fire, or an invisible creature, and that creature is set to launch whatever projectile you define for it.
Phortiphy
Vidmaster
Posts: 2290
Joined: May 5th '07, 02:04
Contact:

Samus wrote:Could you upload a copy of your head shot lua?
EDIT: not asking, still interested. Edit: forget that.
Last edited by Phortiphy on Jun 9th '07, 16:19, edited 1 time in total.
Can't speel for hist.
User avatar
irons
Vidmaster
Posts: 2651
Joined: Mar 1st '06, 20:44
Location: (.Y.)
Contact:

Bill, from the form of your original message, it seemed that there were two ways of spawning projectiles: one using monsters, and another "normal" way. Hence this confusion.

Phortiphy, don't ask about the head shot script again.
underworld : simple fun netmaps // prahblum peack : simple rejected netmaps
azure dreams : simple horrible netmaps // v6.0!!!: thomas mann's greatest hits : simple simple netmaps
Volcanon
Mjolnir Mark IV
Posts: 356
Joined: Mar 11th '07, 08:04
Contact:

Is there a way to have the player be interlevel warped from any polygon immediately after finishing the objective?
Also, how do I get a monster to warp in only if X happens, like I kill a trooper or something?
User avatar
irons
Vidmaster
Posts: 2651
Joined: Mar 1st '06, 20:44
Location: (.Y.)
Contact:

Your first request is easy: teleport_player_to_level(player, level). The second is not so easy, because monsters can't normally teleport, unless they've reached a goal polygon or get activated (teleporting out immediately).
underworld : simple fun netmaps // prahblum peack : simple rejected netmaps
azure dreams : simple horrible netmaps // v6.0!!!: thomas mann's greatest hits : simple simple netmaps
User avatar
Drictelt
Vidmaster
Posts: 1438
Joined: Nov 27th '06, 19:21
Contact:

The lua guide i found here(http://www.cebix.net/viewcvs/alephone/a ... ml?rev=1.6) is very unclear at some points, and the fact that it contains remarks everywhere makes me think it can be edited somehow. Im wondering, is this possible and how? I think we could spare a lot of double work if everyone that uses the guide helps to extend it. The wiki principle actually... But currently the wiki points at this guide.

Same probably counts for the mml guide.
Eternal - Victory Dance IV - KTA III - Phoenix
More on Simplici7y: Xmas I-II-III - Winter I - Narcotics - Thrudnesday
User avatar
treellama
Vidmaster
Posts: 6110
Joined: Jun 2nd '06, 02:05
Location: Pittsburgh
Contact:

You can send patches to me as diffs against the files in CVS, and I'll commit them. Or, you can re-write the guide in Wiki format on s.b.o., and I'll include a printable version in releases.

The first way is less work for me (because CVS version control makes it easier to figure out what Lua and MML is available in what release). The second way might encourage people to help out, or, like the manual, it might go a little ways then die.
Last edited by treellama on Jun 28th '07, 19:03, edited 1 time in total.
Phortiphy
Vidmaster
Posts: 2290
Joined: May 5th '07, 02:04
Contact:

Just flipping through the LUA documentation, it seems like there's no trigger for simply checking to see if a switch has been used at all, the only triggers are for players hitting the action key. Why would this be, and/or could there be a trigger for if the switch has been used by anything?
Can't speel for hist.
User avatar
treellama
Vidmaster
Posts: 6110
Joined: Jun 2nd '06, 02:05
Location: Pittsburgh
Contact:

Do you mean you want to check a switch's state? If it's a tag switch, check the tag's state; if it's a light switch, check the light's state; if it's a platform switch, the platform's state.

The engine doesn't actually keep a log of "this monster pressed this switch", so you have to do it yourself.

I think this should have been in a new thread :)
Post Reply