Author Topic: lua in Units XML?  (Read 3067 times)

Psychedelic_hands

  • Guest
lua in Units XML?
« on: 24 October 2010, 07:42:03 »
Hey, I have a tad little query I'd like an answer for. Basically what we want to do is make a message appear when a certain type of unit dies ingame..... not in a scenario but normal, regular game. I thought the best way to achieve this is though lua..... which brings me to the point that I don't know whether or not it's possible to add lua into a unit xml..... if it is possible great  8)

Sorry if this is a stupid question, as I really don't know much about this area :(

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: lua in Units XML?
« Reply #1 on: 24 October 2010, 23:56:59 »
Currently not possible. While I'm not completely sure of the use of Lua in a skill, I'll move this to the suggestions board.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: lua in Units XML?
« Reply #2 on: 25 October 2010, 02:31:54 »

Psychedelic_hands

  • Guest
Re: lua in Units XML?
« Reply #3 on: 25 October 2010, 05:41:10 »
Thanks you guys! :)

No milestone? This seems like it could be a pretty useful thing...

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: lua in Units XML?
« Reply #4 on: 25 October 2010, 06:39:31 »
No milestone? This seems like it could be a pretty useful thing...

No doubting it could be very useful, but it is also opening a can-o-worms with potential multiplayer problems, so I wouldn't expect to see it until 0.6 at the earliest.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: lua in Units XML?
« Reply #5 on: 25 October 2010, 17:39:31 »
How would it be used though? I can't think of any good uses for it, and displaying a message on death would not be a good thing, but just annoying... If a message appeared every time a unit died for me, I'd edit out the entire mod... So, barring a message, what use could this have?
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Zoythrus

  • Guest
Re: lua in Units XML?
« Reply #6 on: 25 October 2010, 17:46:23 »
well, the message thing would be cool if you did something like take down a super uber unit - a way to congratulate the victor.

now, what if you wanted a unit to be built with other units automatically garrisoned inside? couldnt lua do that?

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: lua in Units XML?
« Reply #7 on: 26 October 2010, 23:26:34 »
well, the message thing would be cool if you did something like take down a super uber unit - a way to congratulate the victor.

now, what if you wanted a unit to be built with other units automatically garrisoned inside? couldnt lua do that?
Well, there's no way to garrison a unit (yet). Besides, even if there was a garrison command, you'd be unable to tell the newly created unit which unit to garisson it to (Lua doesn't have a means for that).

As for taking down a powerful unit, I've yet to see a unit that is "difficult" to take down other than a scenario unit. Buildings have the most HP, but they can go down fast when you pile them, just like any other unit. Any sole unit can fall pretty fast when it's piled. The only difficult unit's I've seen are scenario units, namely the finally boss of Military's End of Morning scenarios, which has a large Bunker with over 200k HP, and being a scenario unit, it can have messages on death on its own (it's not available in game anyway).
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Zoythrus

  • Guest
Re: lua in Units XML?
« Reply #8 on: 26 October 2010, 23:59:07 »
well, the message thing would be cool if you did something like take down a super uber unit - a way to congratulate the victor.

now, what if you wanted a unit to be built with other units automatically garrisoned inside? couldnt lua do that?
Well, there's no way to garrison a unit (yet). Besides, even if there was a garrison command, you'd be unable to tell the newly created unit which unit to garisson it to (Lua doesn't have a means for that).

As for taking down a powerful unit, I've yet to see a unit that is "difficult" to take down other than a scenario unit. Buildings have the most HP, but they can go down fast when you pile them, just like any other unit. Any sole unit can fall pretty fast when it's piled. The only difficult unit's I've seen are scenario units, namely the finally boss of Military's End of Morning scenarios, which has a large Bunker with over 200k HP, and being a scenario unit, it can have messages on death on its own (it's not available in game anyway).

in case you arent too sure, when i said garrison, i meant transport. GAE can do that.  so, you cant make a unit with other units already inside? dang.

i asked about the big unit thing because i plan on having a unit that is a super-uber unit that can be built. since it's so hard to both build and destroy, we wanted to give some fanfare to the both the person who builds it and a broadcast to everyone that it's dead (like it could ever die....)

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: lua in Units XML?
« Reply #9 on: 27 October 2010, 00:02:25 »
Destroying an enemy Castle, Mage Tower, or similar building could be worthy of a message.  It's kind of a big deal.  Ditto for (currently hypothetical) hero units.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: lua in Units XML?
« Reply #10 on: 27 October 2010, 00:09:09 »
Meh, I hardly think a simple "on destruction" message is worthy of lua commands in the unit's XML. If you really want a message on death, then why not one simply XML tag for that? Lua commands seem to be overkill, especially since there aren't really any other useful commands (after all, you can't tell it to go to another unit, there's no way of knowing the other unit's ID number, nor can you tell it to attack a player's base, since there's no way of knowing if that player number exists, or if it is even an enemy, and you can't tell it to go to a location on the map, since theres no way to know the map the player is on. Other functions like setDisplayText and showMessage are total overhaul, and will just annoy the player (ideally, if such a feature was to be used, it would be best off as similar to "faction destroyed" message.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: lua in Units XML?
« Reply #11 on: 27 October 2010, 00:14:48 »
I'll admit I know almost nothing about Lua, so I don't really know what the possibilities would be.

Zoythrus

  • Guest
Re: lua in Units XML?
« Reply #12 on: 27 October 2010, 01:16:20 »
I'll admit I know almost nothing about Lua, so I don't really know what the possibilities would be.
same here!

Psychedelic_hands

  • Guest
Re: lua in Units XML?
« Reply #13 on: 3 November 2010, 10:50:19 »
I thought of another way we could use this.... Monuments! have a victory timer set to a building...

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: lua in Units XML?
« Reply #14 on: 3 November 2010, 21:49:53 »
I thought of another way we could use this.... Monuments! have a victory timer set to a building...
Same problem: No way to say which faction to set as the winner (plus allies).

Besides, things like that would be better off done with a separate XML tag then implimentation of Lua, on the sole basis that Lua in unit XMLs is overkill.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Zoythrus

  • Guest
Re: lua in Units XML?
« Reply #15 on: 3 November 2010, 22:21:45 »
I thought of another way we could use this.... Monuments! have a victory timer set to a building...
Same problem: No way to say which faction to set as the winner (plus allies).

Besides, things like that would be better off done with a separate XML tag then implimentation of Lua, on the sole basis that Lua in unit XMLs is overkill.

so, how do you plan for things like messages and auto-garrisoned units?

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: lua in Units XML?
« Reply #16 on: 3 November 2010, 22:45:11 »
I thought of another way we could use this.... Monuments! have a victory timer set to a building...
Same problem: No way to say which faction to set as the winner (plus allies).

Besides, things like that would be better off done with a separate XML tag then implimentation of Lua, on the sole basis that Lua in unit XMLs is overkill.

so, how do you plan for things like messages and auto-garrisoned units?
Messages, I've opposed to be honest... Though, such a thing could get it's own XML tag that goes in the *skill* part of the Unit. For example, the death skill might display a message stating the unit was killed, whereas it would also be possible to display a message to show when a special attack is used (ie: a nuke is launched, in case the huge target isn't a big enough warning). This would also need to be tweeked so that ONLY the player that defeats/is attacked by/is targeted by that command (no clue what would happen if someone went rogue with obscure commands such as walk, which would have no target) sees that message. For example, if the CPU kills another CPUs hero unit, I don't want to know about it by a message (thus another reason why using Lua directly for messages would be a bad idea).

Relatedly, auto garisson would be best done with a tag in the produce command, since no such method exists in Lua anyway.

(In retrospective, messages on skills is amazingly complex, and I would consider it very very low priority. In fact, it would probably be better off as just on death skills too, since it'd be easier to find out what faction killed a unit than trying to do this for targeting skills that target a location (ie: move).

Bottom Line: More complex than appears + low priority = ?
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

 

anything