LuaGaia cannot see units

LuaGaia cannot see units

Discuss your problems with the latest release of the engine here. Problems with games, maps or other utilities belong in their respective forums.

Moderator: Moderators

Post Reply
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

LuaGaia cannot see units

Post 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.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: LuaGaia cannot see units

Post by Argh »

It can work. See World Builder maps.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: LuaGaia cannot see units

Post 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?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: LuaGaia cannot see units

Post by Argh »

It's 200MB, get the latest version.

Long story short, you need to include a draw.lua and main.lua.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: LuaGaia cannot see units

Post 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/
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: LuaGaia cannot see units

Post 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?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: LuaGaia cannot see units

Post 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.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: LuaGaia cannot see units

Post 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.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: LuaGaia cannot see units

Post 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...
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: LuaGaia cannot see units

Post 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.)
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: LuaGaia cannot see units

Post by KDR_11k »

That would still not allow stuff like maps with teleporters...
Post Reply

Return to “Help & Bugs”