Author Topic: Glest tower defense  (Read 45292 times)

me5

  • Guest
Re: Glest tower defense
« Reply #25 on: 7 July 2009, 16:51:45 »
Sorry this was the wrong version of my code. If the monsters of faction 1 are dead and faction 0 has  an unitcount of unequal 0 then new monsters (of faction 1) have to be spawned. There is a mistake in my code it should be only ">0" instead of ">=0". When I try to run this code the monsters are spawned only three times. But I want it to happen all the time. Also if I use "!=" instead of ">0" (in old version ">=0") I get an error : Error loading lua script: Script error: [string "unitCreated"]:5: 'then' expected near '!'.

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #26 on: 8 July 2009, 00:12:27 »
'!=' is not a lua operator... you wan't '~='

Also, do you realise that buildings are units?
« Last Edit: 8 July 2009, 00:14:42 by silnarm »
Glest Advanced Engine - Code Monkey

Timeline | Downloads

me5

  • Guest
Re: Glest tower defense
« Reply #27 on: 8 July 2009, 17:33:58 »
Thanks. I havn't realised that. But it doesn't matter for now because the faction I would like to spawn monsters recently has no buildings so it only looks for units. But is there a way to look only for monsters and why are the monsters not spawned every time the unitcount is "0"?
So if faction 1 has only monsters (no buildings) new monsters should be spawned when the unit count is 0, all the time (not only three times). Or am I wrong? ???

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest tower defense
« Reply #28 on: 11 July 2009, 12:03:48 »
Been away a while, haven't I?

Lets see, your code should work, but all units are grouped together. If you want the buildings not to be included, you can either tag every unit (would be code innefficent, and I doubt it would work since Glest seems to crash with too big scripts (silnarm, must see if you can fix that in merge). The 'too-big' range is actually very small around 8kb.

If the monsters are not spawned, you may be over producing this. Because lau is insanely fast, so my best guess is that you would perform the if statement multiple times while the enemy still has 0 units (before it recognizes that it no longer has that many units, since the units count updater seems to be slower). This could cause an overload and the entire thing is canceled. That's just a guess though, since such a thing has happened to me in my past before (I think, my memory is tired right now).

Why not try having a variable check to see if the command has been done before.

Code: [Select]
if unitCount(1)==0 and unitCount(0)>=0 and haveIDoneThis==1 then
for i=1, 4 do
createUnit('initiate', 1, startLocation(1))
givePositionCommand(lastCreatedUnit(1), 'move', startLocation(0))
                                                haveIDoneThis=0
end
end
In short:

Code: [Select]
checkFoesUnits checkOurUnits checkIfWeHaveDoneThisYet {
   produceFourInitiate
   giveInitiateMoveCommand
   setTheHaveIDoneThisToZero -- This is to make sure we only loop once. The first time the var is true, but the second time we have already changed it so it is false.
}
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #29 on: 12 July 2009, 04:54:08 »
"We're Gonna Need a Bigger Boat"

I've decided this is a really good idea... anyone want to volunteer their services to make some new towers? I'll probably try to get one or two done myself... but my texturing leaves a lot to be desired...

I'm thinking initially maybe 5 tower types, each but the basic one requiring research upgrades. The defender would be 'Tech' with nothing but the Castle (maybe modified to be 'tower like'), workers and the towers, and the attackers would be bits and pieces of magic and/or other mods, all the nasty looking stuff we can find (and that gels well) ie the Magic's Deamon & Behemoth might be candidates.

I'm happy to 'steal' models for units at this point, but I think some new towers are called for.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

me5

  • Guest
Re: Glest tower defense
« Reply #30 on: 13 July 2009, 17:19:52 »
@ silnarm
Sounds great!

@ omega
If "haveIDoneThis" is set to false in the end the if statement is only performed once. But I want everytime the monster group dies a new to be spawned. (Maybe I didn't get it)

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #31 on: 14 July 2009, 00:12:30 »
But I want everytime the monster group dies a new to be spawned. (Maybe I didn't get it)

I think your test is in the wrong spot, you want it in the unitDied event...

I just threw together an experiment to get myself thinking about this... it's not perfect, I'm using os.time() which is not ideal (returns actual time, has nothing to do with 'game time' ...) to decide how many daemons to spawn... it also never ends... :)  But it should serve as a good basis for your own experiments...

Code: [Select]
  <scripts>
    <startup>
      --disableAi (1);
      --disableAi (2);
      --disableAi (3);
      createUnit ( "daemon", 1, startLocation(1) );
      createUnit ( "daemon", 2, startLocation(2) );
      createUnit ( "daemon", 3, startLocation(3) );

      createUnit ( "castle", 0, startLocation(0) );
      createUnit ( "defense_tower", 0, {startLocation(0)[1] + 5, startLocation(0)[2]} );
      createUnit ( "defense_tower", 0, {startLocation(0)[1], startLocation(0)[2] - 5} );
      createUnit ( "worker", 0, startLocation(0) );
      createUnit ( "worker", 0, startLocation(0) );
      createUnit ( "worker", 0, startLocation(0) );
      setCameraPosition ( startLocation(0) );
      showMessage ( "start_msg", "Expirement - Tower Defence 0" );
      startTime = os.time();
    </startup>
    <unitDied>
      timeSinceStart = os.time() - startTime;
      lastFaction = unitFaction ( lastDeadUnit () );
      if ( lastFaction > 0 and unitCount ( lastFaction ) == 0 ) then
        numUnits = 1;
        if ( timeSinceStart > 180 ) then
          numUnits = 5;
        elseif ( timeSinceStart > 120 ) then
          numUnits = 4;
        elseif ( timeSinceStart > 60 ) then
          numUnits = 3;
        elseif ( timeSinceStart > 30 ) then
          numUnits = 2;
        end
        for i=1, numUnits do           
          createUnit ( "daemon", lastFaction, startLocation(lastFaction) );
        end -- for
      end -- if ( lastFaction > 0 and unitCount ( lastFaction ) == 0 )
    </unitDied>
  </scripts>
Glest Advanced Engine - Code Monkey

Timeline | Downloads

me5

  • Guest
Re: Glest tower defense
« Reply #32 on: 14 July 2009, 16:28:41 »
This is my recent version:
Code: [Select]
<unitDied>

timeSinceStart = os.time() - startTime;

lastFaction = unitFaction ( lastDeadUnit () );





  if ( lastFaction > 0 and unitCount ( lastFaction ) == 0 ) then

numUnits = 1;

if ( timeSinceStart > 180 ) then

  numUnits = 5;

elseif ( timeSinceStart > 120 ) then

  numUnits = 4;

elseif ( timeSinceStart > 10 ) then

  numUnits = 3;

elseif ( timeSinceStart > 5 ) then

  numUnits = 2;

end



for i=1, numUnits do   

  createUnit ( "daemon", lastFaction, startLocation(lastFaction) );

  givePositionCommand(lastCreatedUnit(1), 'move', startLocation(0))

end -- for



if (lastDeadUnit () == lastDeadUnit (lastFaction)) then

giveResource('gold', 0, 100);

giveResource('stone', 0, 100);

giveResource('wood', 0, 100);

giveResource('food', 0, 100);

  end



  end -- if ( lastFaction > 0 and unitCount ( lastFaction ) == 0 )





</unitDied>

Is it possible to check if a unit of a certain faction died? The problem is that the monsters are grouped. So in my version the player only gets resources when the whole group dies. But I think one should also get resources when only one monster dies so the player can repair and upgrade towers while the monsters attack him.
Can someone tell me what the "UnitId" is? Has each unit a unique Id? Have the Ids of a certain faction something in common?

btw. why does this not work? (see next code)
Code: [Select]
for i=2, 4 do



createUnit('initiate', 1, startLocation(1))

givePositionCommand(lastCreatedUnit(1), 'move', {22,2})

end

if (unitPosition(lastCreatedUnitId(1)) == {22,2}) then

givePositionCommand(lastCreatedUnit(1), 'move', {30,55})

end

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #33 on: 14 July 2009, 22:39:34 »
lastFaction = unitFaction ( lastDeadUnit () );
This gives you the index of the faction whose unit just died. err... see below...

Quote from: me5
if (lastDeadUnit () == lastDeadUnit (lastFaction)) then
This test is redundant, it can only ever be true... You've already established that lastDeadUnit() belongs to lastFaction, so lastDeadUnit(lastFaction) will return the same unit id.
Quote from: me5
Is it possible to check if a unit of a certain faction died?
Code: [Select]
if ( lastFaction > 0 )This check ensures that the rest of the code in the unitDied handler only executes for the AI players, the Human is assumed to be player 1 ( index 0 ).

Quote from: me5
So in my version the player only gets resources when the whole group dies. But I think one should also get resources when only one monster dies so the player can repair and upgrade towers while the monsters attack him.
You have all the tests you need in there, you just need to re-organise them...
Code: [Select]
if ( lastFaction > 0 ) then
  -- A unit died, and it belonged to the AI,
  -- give the human some goodies here
  if ( unitCount ( lastFaction ) == 0 ) then
    -- This was the last of this AIs units... spawn some more...
  end

end -- if ( lastFaction > 0 )


Quote from: me5
Can someone tell me what the "UnitId" is? Has each unit a unique Id? Have the Ids of a certain faction something in common?
Every unit has a unique id, and a faction's unit's IDs have absolutely nothing 'common' in them. You just use the unitFaction () function, passing the ID as a parameter, and you get back the faction index.

Quote from: me5
Code: [Select]
for i=2, 4 do
  createUnit('initiate', 1, startLocation(1))
  givePositionCommand(lastCreatedUnit(1), 'move', {22,2})
end

if (unitPosition(lastCreatedUnitId(1)) == {22,2}) then
  givePositionCommand(lastCreatedUnit(1), 'move', {30,55})
end

It does work... but it doesn't wait for conditions to come true...
Code: [Select]
if (unitPosition(lastCreatedUnitId(1)) == {22,2}) thenis executed immediately... and it hence evaluates to false, because the unit is not there yet.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

me5

  • Guest
Re: Glest tower defense
« Reply #34 on: 15 July 2009, 16:48:09 »
Many thanks! Now I have to try some things. :D

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #35 on: 16 July 2009, 08:30:01 »
To be honest, this is going to be difficult to do without timers...
But I believe most if not all the difficulties can be overcome with clever scripting.

While I think a GAE version with man-able walls/towers as well as timers will be much better, that's probably still a couple months away at the earliest, and a 3.2 version could act as a working prototype for a later GAE version, so this is worth continuing.

I'm willing to provide what support I can for the scripting... I'll have to think about how to solve a couple of potential problems, either that or just convince myself they are not problems :)

Should hopefully be able to find some time for it on the weekend, and I'll give you some scripts to play with... I won't have time to test whole games often, so I'll be needing you to test them out, possibly change a parameter or two yourself to get something working more to your liking, and provide feedback.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest tower defense
« Reply #36 on: 17 July 2009, 08:30:05 »
I'm willing to provide what support I can for the scripting... I'll have to think about how to solve a couple of potential problems, either that or just convince myself they are not problems :)
What problems are they? I can't do c++ much, but my lua isn't too bad.

BTW: when testing scripts for lua, be sure to try some larger files to see if they work. Something above 10kb... My scripts can't load if they reach usually something in the 7-8 kb range. Not sure why, but I must see if others are affected...
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #37 on: 18 July 2009, 02:44:12 »
What problems are they? I can't do c++ much, but my lua isn't too bad.

BTW: when testing scripts for lua, be sure to try some larger files to see if they work. Something above 10kb... My scripts can't load if they reach usually something in the 7-8 kb range. Not sure why, but I must see if others are affected...

If you're willing to help out, I'd be delighted to accept assistance... I'm rather busy atm, and I kind of have this thing about loosely typed programming languages, being that I think they're an abomination. So if you're willing to have a go at cobbling together some functions we'll be needing...

function isPointInside ( point, topLeft, bottomRight )
  -- check if point is in the rectangle specified by topLeft and bottomRight
  -- return true if it is, false if not
end

function createGroup ( faction, unitType, groupSize, location )
  -- the name says it all :)
end

That's actually all I can think of right now, there will be more though... I want createGroup() to ultimately record 'information' about the group, probably just the 'leader' ID. So we can later test to see if they've made it to a certain waypoint... but I'm not sure what LUA offers in terms of data structures we might store that in... so I'll have to look into it.

I'm suggesting we work within the bounds of what Glest 3.2 offers for this... Let's push it to the limits of what it can do... this will no doubt help give some ideas of what new things would be nice, or what current things are too slow in LUA and may be deserving of more 'help' from the engine.

Making our own 'Fake' (and inaccurate) Timer:

The main problem is of course the lack of a timer... but I have a solution, not a fantastic one perhaps, but it's something. It wont work for 'general purpose' scenarios, but for this one it should work fine, because we are taking complete control of the AIs unit creation, and we can assure the human never gets close to the AI 'Base'...

What we'll do is make a new techtree/factions and 'hobble' the computer player's faction. We'll give him a single worker unit at the start of the game, and no mechanism to create more. We'll be controlling the unit creation for them, so the computer player wont actually need resources, but the AI doesn't know this!  We give it 1000 wood and a 1000 stone (or more...), plenty of energy if we are just modifying a magic faction, and 0 gold.  The AI will evaluate all this and assign his lone worker to mine gold.

Code: [Select]
-- with all of the above set up...
<resourceHarvested>
  if ( resourceAmount ( "gold", 1 ) > 0 )
    -- The AI just collected some gold... this should happen at
    -- fairly regular intervals
    tick (); -- LOOK AT ME... I'm a crappy TIMER!
    -- now take the gold back, to reset for next time...
    giveResource ( "gold", 1, -20 );
  end
</resourceHarvested>

Should work, but I haven't tested it yet...
Glest Advanced Engine - Code Monkey

Timeline | Downloads

wciow

  • Behemoth
  • *******
  • Posts: 968
    • View Profile
Re: Glest tower defense
« Reply #38 on: 18 July 2009, 08:40:38 »
Great idea Silnarm, I'm gonna go try to make this now!

My only concern is that you lose a whole faction to make a clock, but its the best solution so far.
Check out my new Goblin faction - https://forum.megaglest.org/index.php?topic=9658.0

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Glest tower defense
« Reply #39 on: 18 July 2009, 15:15:10 »
What command line makes a unit morph in a scenario.

Like
givePositionCommand(BehemothUnit(), 'move', startLocation(1))
How can I make Him morph?

Is it somthing like this?
giveMorphCommand(BehemothUnit, 'golem')
« Last Edit: 18 July 2009, 16:39:33 by ElimNator »
Get the Vbros': Packs 1, 2, 3, 4, and 5!

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #40 on: 19 July 2009, 01:09:45 »
Great idea Silnarm, I'm gonna go try to make this now!

My only concern is that you lose a whole faction to make a clock, but its the best solution so far.
Not ideal, and not a general purpose solution, but taking out one faction to 'make a clock' is going to be fine for this project. Please let us know how you go!

What command line makes a unit morph in a scenario.

Like
givePositionCommand(BehemothUnit(), 'move', startLocation(1))
How can I make Him morph?

Is it somthing like this?
giveMorphCommand(BehemothUnit, 'golem')
No such command I'm afraid, there may be some way to make the proposition of such a morph seem more attractive to the AI, but even if you could devise such a scheme, it might be difficult to control.

Glest Advanced Engine - Code Monkey

Timeline | Downloads

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest tower defense
« Reply #41 on: 21 July 2009, 08:36:37 »
I'm not so sure I like that timer idea. I mean, it CAN work, but is easily rouge, is it? The way I see it, in order for the AI to collect resources, they must NOT be disabled, and then it's possible for them to do whatever odd things go on in that crazy, silicone, 'brain' of theirs. Suppose they just decide to wander off for some reason (dunno how the AI will always react, they SHOULD mine resources, but will they?)...

It might be possible to get the time at start-up and every time it is divisible by a certain number, an event can occur. We can get the time at start-up by calling os.time() in the start-up tag, and then try to divide it by a certain number to see if its divisible. If it is, then we know some time has passed, and we can call whatever event. For example, we could check if the time is divisible by 100, since that can only happen every 100 seconds. The only fault I can think of is that we don't know the start time, so the first event could take anywhere from 1 - 99 seconds to occur before it is synchronized again.

You refered to a new function before. What is this 'isPointInside ( point, topLeft, bottomRight )' function? What is it meant to do? BTW, for groups, what about a way to make a group of units that can be of any type, and just add them like adding to an array. This could be VERY useful for checking to see if all the units in a group that was sent to attack are dead, rather than checking an individual unit...
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #42 on: 21 July 2009, 12:54:20 »
I'm not so sure I like that timer idea. I mean, it CAN work, but is easily rouge, is it? The way I see it, in order for the AI to collect resources, they must NOT be disabled, and then it's possible for them to do whatever odd things go on in that crazy, silicone, 'brain' of theirs. Suppose they just decide to wander off for some reason (dunno how the AI will always react, they SHOULD mine resources, but will they?)...
What else is he going to do ?  He only has move and harvest commands  ;D  and he's tucked in a corner of the map, isolated from the 'actual scenario' and unreachable by the human.
I can now confirm it works... and remarkably well!
Indeed if you give your 'pendulum' unit a load capacity of 1, and crank up the speed of his harvest skill, and very cleverly position the resources, the 'pendulum' and the 'clock' unit, you could probably give it reasonable resolution. I'd be careful doing that though... if you ran complex scripts in response to these high resolution ticks, you'll probably find LUA can't keep up, and the game will get horribly unresponsive.
I'm happy with the load==20, harvest speed=200 version myself, so I wont be testing any 'high resolution' timers.

Quote from: omega
...We can get the time at start-up by calling os.time() in the start-up tag...
The real problem with os.time() is that it returns the real time. You can't use it to time events in a scenario, because you don't know what game speed the player has set, or whether the game is paused.

Quote from: omega
...BTW, for groups, what about a way to make a group of units that can be of any type, and just add them like adding to an array. This could be VERY useful for checking to see if all the units in a group that was sent to attack are dead, rather than checking an individual unit...
That could be a lot of processing... not sure how LUA will handle it, but we should try it, just to see :)
A variant on the theme could help you with your file size limit issue...
Code: [Select]
      -- Create a group of units at one location
      function createGroup ( unitType, faction, count, location )
        for i=1, count do
          createUnit ( unitType, faction, location );
        end
      end

      -- Create a 'group' of units, using a specific location for each
      function createUnits ( type, faction, count, locations )
        for i=1, count do
          createUnit ( type, faction, locations[i] );
        end
      end
and then later...
Code: [Select]
          createGroup ( "worker", 0, 5, startLocation(0) );
          towerPositions = { {144,122},{88,130},{92,139},{124,155},
            {111,155},{130,75},{118,120},{129,120},{133,132} };
          towerCount = 9;
          createUnits ( "defense_tower", 0, towerCount, towerLocations );
Glest Advanced Engine - Code Monkey

Timeline | Downloads

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #43 on: 21 July 2009, 14:15:02 »
What command line makes a unit morph in a scenario.
<snip>
Is it somthing like this?
giveMorphCommand(BehemothUnit, 'golem')
No such command I'm afraid, there may be some way to make the proposition of such a morph seem more attractive to the AI, but even if you could devise such a scheme, it might be difficult to control.

Actually, giveProductionCommand ( unitId, producedName ) might do this, but don't quote me on that!

Edit: Just looked at the source, quicker than testing... giveProductionCommand() will attempt to find any command that produces a unit of type producedName. In short, this will work. So you can quote me if you like :)
« Last Edit: 21 July 2009, 14:23:47 by silnarm »
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest tower defense
« Reply #44 on: 22 July 2009, 07:48:10 »
Really, so morphing CAN be done? Neat, but did you test it rather than just a peek at the source?

Concerning my possible method, I never thought about game speed. When I read your scentence, something just popped! The game speed would be a method of controlling difficultly level as well. High speed means you can do more before the timer is reached, while lower speed means that you can do less before the timer is reached. So in short, fast is easier, slow is harder. Might cause some unseen problems in select scenarios, but should work for the general bit. Once I get things working, I'll test it.
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #45 on: 22 July 2009, 10:13:35 »
Really, so morphing CAN be done? Neat, but did you test it rather than just a peek at the source?
No, I didn't test it, I glanced at the source.  So I just looked again, and this time actually read the code... it must be a command of class 'produce'... so no morphing... Sorry.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest tower defense
« Reply #46 on: 22 July 2009, 21:30:29 »
Hmm, maybe you can make this code possible in GAE? Since the production command can be done, it would be the same thing, except it looks for the morph command rather than produce. Listening to you, I think it may only need a few changes...?
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #47 on: 23 July 2009, 08:18:48 »
Hmm, maybe you can make this code possible in GAE? Since the production command can be done, it would be the same thing, except it looks for the morph command rather than produce. Listening to you, I think it may only need a few changes...?
The morph command will be hooked up to giveProduceCommand() and the missing movement based commands will be hooked up to givePositionCommand(), which currently only accepts 'move' or 'attack'.

When this will happen I can't say for sure. Hopefully before the next release, but there are some 'niceties' I'm adding atm that I feel are more important, so... we'll see.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest tower defense
« Reply #48 on: 23 July 2009, 09:20:19 »
There should be a lua command for every command a unit can have. Most of these commands are covered. Stop is uneeded, so we would probably just need hold position and morph (which you've said you hooked to production).

Wait, what about harvest, build, repair? Harvest would have them harvest the nearest of the specified resource, though they may do nothing if no resource is within their sight. Build builds the specified building at the specified location. Repair would repair the specified unit (the only way I can think of to specify a unit is with a tag), however, being GAE, there should be an autorepair.

I think that's all of the commands... 8)
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

me5

  • Guest
Re: Glest tower defense
« Reply #49 on: 24 July 2009, 08:27:01 »
btw. is there something like "givePathCommand(unitId,{{Point1},{Point2},{Point3},{PointX}})" ? Or is it possible to make a function in lua which does nearly the same?