Author Topic: [done]Lock units in scenarios (lua)  (Read 1664 times)

titi_son

  • Draco Rider
  • *****
  • Posts: 283
  • titi_son
    • View Profile
[done]Lock units in scenarios (lua)
« on: 15 November 2014, 18:16:28 »
I think it would be nice to have a function to block units in scenarios.

Like you need to reach this objective to unlock this unit. I made a scenario using this feature: DOWNLOAD
You need to checkout titison/megaglest-source/tree/feature/lua_blockUnits to try :P

Syntax is
Code: [Select]
setLockedUnitForFaction(unitName,FactionIndex,1=true;0=false)
--Lock the unit
setLockedUnitForFaction('battlemage',0,[color=red]1[/color])
--Unlock the unit
setLockedUnitForFaction('battlemage',0,[color=red]0[/color])

Please correct me (and my pull request) if this is wrong but i think MegaGlest can't read boolean values from lua or there arent any real bools in lua
Or does this even work with true and false? i dont think so.

Of course you can do this already with some kind of hidden upgrade for example but you need a new techtree for this and its inconvenient.
Do you think this is a good idea or just needless stuff?

Pull Request

EDIT:There is a bug i need to fix before you merge this pull request. ( not saved in savegames i think ) fixed
« Last Edit: 4 December 2014, 23:56:18 by titi_son »
My first Tilseset: SPRING :) (included in Megaglest )

Secret Hint: To play online join the IRC #megaglest-lobby on freenode which is the lobby chat ingame. So you can chat with or wait for people in the lobby without running megaglest all the time.

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Lock units in scenarios (lua)
« Reply #1 on: 19 November 2014, 05:46:33 »
Yes we stick to using int for booleans as I think i saw that using booleans gave unpredictable results.

Thanks

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Lock units in scenarios (lua)
« Reply #2 on: 20 November 2014, 00:21:50 »
I think this feature is useful and I would like to merge it.
Anyone else wants it ?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios