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.

Post Mar 10th '06, 17:24

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):However, 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 MML
Look 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 players
  • place individual monsters and items on specific polygons
  • manipulate monster actions like attack and move
  • manipulate the position, yaw, pitch, or target of individual projectiles
  • distribute 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.txt
  • controlling monsters precisely (although this is improving)
  • altering map geometry by adding or removing polygons, switches, rechargers, and terminal locations
As 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.
irons

Post May 5th '06, 07:44

Could you upload a copy of your head shot lua?
Samus

Post May 5th '06, 16:24

irons

Post Jun 19th '06, 05:50

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...)
Eternity lies ahead of us and behind.
Have you drunk your fill?
User avatar

assassingao
Up yours.

Post Jun 19th '06, 17:46

Wait, I thought earlier you said recoil was possible.
The Pf'hak - Read it.
-eld- Post here or PM me if you'd like to join.
It's not what you say, it's the fact that you shouldn't have said it at all.
User avatar

LegacyTyphoon

Post Jun 19th '06, 18:06

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 10 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

SirBlastalot
Currently marooned on Earth, please assist!

Post Jun 19th '06, 18:38

I wonder if its possible to change Physics files mid game...
The Pf'hak - Read it.
-eld- Post here or PM me if you'd like to join.
It's not what you say, it's the fact that you shouldn't have said it at all.
User avatar

LegacyTyphoon

Post Jun 19th '06, 20:49

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.
irons

Post Jun 20th '06, 16:43

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.
Eternity lies ahead of us and behind.
Have you drunk your fill?
User avatar

assassingao
Up yours.

Post Jul 5th '06, 16:07

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

Homocidal Ham
Behind you (mwahahaha)

Post Jun 8th '07, 22:04

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.txt
  • controlling 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. :)
Excalibur: Morgana's Revenge 3.0
http://emr.excaliburworld.com/
User avatar

donmerlin

Post Jun 8th '07, 22:16

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

irons
(.Y.)

Post Jun 8th '07, 22:28

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!
Excalibur: Morgana's Revenge 3.0
http://emr.excaliburworld.com/
User avatar

donmerlin

Post Jun 8th '07, 22:43

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 // v4.0!!!: thomas mann's greatest hits : simple simple netmaps
User avatar

irons
(.Y.)

Post Jun 8th '07, 22:56

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.
Excalibur: Morgana's Revenge 3.0
http://emr.excaliburworld.com/
User avatar

donmerlin

Post Jun 9th '07, 01:47

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

irons
(.Y.)

Post Jun 9th '07, 04:23

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.
Excalibur: Morgana's Revenge 3.0
http://emr.excaliburworld.com/
User avatar

donmerlin

Post Jun 9th '07, 12:03

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.
Phortiphy
http://youaredestiny.ytmnd.com/

Post Jun 9th '07, 13:26

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 // v4.0!!!: thomas mann's greatest hits : simple simple netmaps
User avatar

irons
(.Y.)

Post Jun 20th '07, 04:32

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?
Volcanon

Post Jun 20th '07, 20:53

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 // v4.0!!!: thomas mann's greatest hits : simple simple netmaps
User avatar

irons
(.Y.)

Post Jun 28th '07, 18:49

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 - Xmas I - Xmas II - Xmas III - Victory Dance IV - Winter I: The Venom - KTA III - Phoenix - somewhere in the heavens, waiting: The Syndicate
User avatar

Drictelt
Belgium

Post Jun 28th '07, 19:03

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.
User avatar

treellama
Pittsburgh

Post Jul 22nd '09, 18:25

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?
Phortiphy
http://youaredestiny.ytmnd.com/

Post Jul 22nd '09, 19:14

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 :)
User avatar

treellama
Pittsburgh

Next

Return to Aleph One Discussion



Who is online

Users browsing this forum: No registered users

cron