MegaGlest Forum

MegaGlest => Feature requests => Closed feature requests => Topic started by: titi_son on 15 November 2014, 18:16:28

Title: [done]Lock units in scenarios (lua)
Post by: titi_son 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 (http://titusgames.de/titi_son/forgotten.7z)
You need to checkout titison/megaglest-source/tree/feature/lua_blockUnits (https://github.com/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 (https://github.com/MegaGlest/megaglest-source/pull/30)

EDIT:There is a bug i need to fix before you merge this pull request. ( not saved in savegames i think ) fixed
Title: Re: Lock units in scenarios (lua)
Post by: softcoder 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
Title: Re: Lock units in scenarios (lua)
Post by: titi on 20 November 2014, 00:21:50
I think this feature is useful and I would like to merge it.
Anyone else wants it ?