Page 1 of 1
LuaGaia cannot see units
Posted: 10 Apr 2009, 07:12
by zwzsg
I want to make a map where the terrain deform when you build units on certain place.
When I use \LuaGaia\Gadgets\*.lua like I've been told I should, UnitCreated is not called. I have to use \LuaRules\Gadgets\*.lua like I've been told I should NOT.
Re: LuaGaia cannot see units
Posted: 10 Apr 2009, 07:18
by Argh
It can work. See World Builder maps.
Re: LuaGaia cannot see units
Posted: 10 Apr 2009, 09:47
by zwzsg
Merely renaming the folder from LuaGaia to LuaRules suddenly made the UnitCreated function be called, so I know it's not because I borked my code, and I know they are handled differently.
WorldBuilder is part of Pure, that is 500 mb heavy and does not work on my computer. Can you just explain what's the trick?
Re: LuaGaia cannot see units
Posted: 10 Apr 2009, 10:10
by Argh
It's 200MB, get the latest version.
Long story short, you need to include a draw.lua and main.lua.
Re: LuaGaia cannot see units
Posted: 10 Apr 2009, 10:19
by zwzsg
I included a draw.lua and a main.lua.
Maybe should I stress that the GameFrame function is called both from /LuaGaia/ and from /LuaRules/, it's the UnitCreated function that is called only in /LuaRules/
Re: LuaGaia cannot see units
Posted: 10 Apr 2009, 10:23
by Argh
In the LuaGaia folder? And you're just talking about the event callin, right?
Why do you want that to be map-specific, btw? Can't you do it with a Gadget and a config on the map side?
Re: LuaGaia cannot see units
Posted: 10 Apr 2009, 11:52
by zwzsg
Here's the map. When the folder is named LuaRules, the map detects structures being built on the crosses. When the folder is named LuaGaia, the map does not detect structures being built.
Re: LuaGaia cannot see units
Posted: 10 Apr 2009, 17:22
by lurker
Do not have a main.lua and draw.lua if you're using the LuaRules folder. You just broke any mod that has code run in its main.lua, notably CA.
Re: LuaGaia cannot see units
Posted: 11 Apr 2009, 06:02
by zwzsg
I knew I was doing it wrong....
Now help me doing it right (with a /LuaGaia/ folder).
Edit:
lurker wrote:Do not have a main.lua and draw.lua if you're using the LuaRules folder. You just broke any mod that has code run in its main.lua, notably CA.
OK,
removed those two files from Palladium, lurker. But I apparently still have to use /LuaRules/ in order to react to player's units.
Argh wrote:It can work. See World Builder maps.
I had a look in PURE_RC6_BAREBONES.zip's maps. The only call-in you use is GameStart() (and maybe GetInfo()). None of them use UnitCreated, or even any call-in related to player's units. Which is why they are not subject to the problem I have. So maybe it's my fault for not precising from the start that indeed call-ins such as Initialize, GameStart, GameFrame work fine when in /LuaGaia/ and that it is only call-ins such as UnitCreated that are ignored, but having seen World Builder maps didn't help.
From #lua
<Tobi> LuaGaia seems to be set up to control / see the gaia team only
<Tobi> so it doesn't get events for non-gaia units being created
<Tobi> ah and it also sets teamsLocked to true, not sure when exactly that's used but it sound like in current version the only way around it is to use LuaRules
<zwzsg> Is this considered a bug that will be fixed, or a feature that will stay?
<Tobi> I don't really see why LuaGaia should be limited so much
So apparently /LuaGaia/ is not "The Lua of the map" but "The lua of the Gaia faction".
Devs and mappers need to have a discussion about why where those limits were put into place, what's the advised way to create a map that reacts to player units, etc...
Re: LuaGaia cannot see units
Posted: 16 Apr 2009, 20:55
by Tobi
Just modified LuaGaia so it can see everything, but still only control the gaia team.
(Seems like a good compromise, keeping the original intent (map not messing with the game too much) while still allowing the map to react to game events.)
Re: LuaGaia cannot see units
Posted: 17 Apr 2009, 16:53
by KDR_11k
That would still not allow stuff like maps with teleporters...