Author Topic: Glest tower defense  (Read 45326 times)

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Glest tower defense
« Reply #50 on: 24 July 2009, 14:17:27 »
You should make it so that you can send a unit any ware on the map not just starting points.
like a big grid.
Get the Vbros': Packs 1, 2, 3, 4, and 5!

hailstone

  • GAE Team
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Glest tower defense
« Reply #51 on: 24 July 2009, 22:06:31 »
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?

I think the code would be something like this but now I think about it, there would need to be an event that notifies you of the unit arriving at the position (or completed the command) otherwise it's just going to execute them all at once leaving the unit only following the last command.

Code: [Select]
function givePathCommand(unitId, coordinates)
  for position in coordinates do
    commandId = givePositionCommand(unitId, "move", position))
    waitForCommand(commandId) --unimplemented function that would wait for the command to finish before continuing
    --or maybe
    waitForEvent(event, other info)
  end
end
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #52 on: 24 July 2009, 23:22:44 »
You should make it so that you can send a unit any ware on the map not just starting points.
This is possible now. See the wiki.
https://docs.megaglest.org/Scenario_Editing
It could use some more work yet, but how 'locations' are handled is explained.

... Or is it possible to make a function in lua which does nearly the same?
I think the code would be something like this but now I think about it, there would need to be an event that notifies you of the unit arriving at the position (or completed the command) otherwise it's just going to execute them all at once leaving the unit only following the last command.
Precisely the problem. You need a timer so you can check if they've arrived at a waypoint, and only then give them the next move command. I can kinda-sorta do this now, but the code is ugly as hell. hopefully it can be generalised enough to be useful :)
« Last Edit: 18 June 2016, 19:35:48 by filux »
Glest Advanced Engine - Code Monkey

Timeline | Downloads

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Glest tower defense
« Reply #53 on: 25 July 2009, 02:17:09 »
Here is a tower of defense scenario I made.
It has 5 waves first 6 sword men then 5 guards then 4 horsemen then 3 catapults then a big siege machine.
If you kill them all you win.

Quote
<?xml version="1.0" standalone="yes" ?>
<scenario>
   <difficulty value="1"/>
   <players>
      <player control="human" faction="tower_2" team="1"/>
      <player control="cpu" faction="tower_2" team="2"/>
      <player control="cpu" faction="tower_2" team="2"/>
      <player control="cpu" faction="tower_2" team="2"/>   
   </players>
   <map value="defence_1"/>
   <tileset value="forest"/>
   <tech-tree value="tower"/>
   <default-resources value="false"/>
   <default-units value="false"/>
   <default-victory-conditions value="false"/>
   <scripts>
      <startup>
         disableAi(1)
         createUnit('finish', 0, startLocation(1))
         finishUnit= lastCreatedUnit()
         setCameraPosition(unitPosition(finishUnit))
                        createUnit('worker', 0, startLocation(3))
                        createUnit('worker', 0, startLocation(3))
         createUnit('worker', 0, startLocation(2))
         createUnit('worker', 0, startLocation(2))
         createUnit('w_c_1', 0, startLocation(2))
         w_c_1Unit= lastCreatedUnit()
         giveResource('gold', 0, 1000)
         showMessage('Welcome', 'sword_man')
         setDisplayText('setuptowers')
         objective= 'set_up_towers'
      </startup>      
      <unitCreatedOfType type="start_wave_1">         
         if objective=='set_up_towers' then
            showMessage('Thesword_manscome', 'sword_man')
            setDisplayText('Thesword_manscome')

                         createUnit('sword_man', 1, startLocation(0))
                         sword_manUnit= lastCreatedUnit()
                         givePositionCommand(sword_manUnit, 'move', startLocation(1))

            for i=1, 5 do
               createUnit('sword_man', 1, startLocation(0))
               givePositionCommand(lastCreatedUnit(), 'move', startLocation(1))
            end      

            objective= 'defend_from_sword_mans'         
                 end   
         
      </unitCreatedOfType>

      <unitCreatedOfType type="start_wave_2">         
         if objective=='set_up_more_towers' and unitCount(1)==0 then
            showMessage('Theguardscome', 'guard')
            setDisplayText('Theguardscome')

                         createUnit('guard', 1, startLocation(0))
                         guardUnit= lastCreatedUnit()
                         givePositionCommand(guardUnit, 'move', startLocation(1))

            for i=1, 4 do
               createUnit('guard', 1, startLocation(0))
               givePositionCommand(lastCreatedUnit(), 'move', startLocation(1))
            end      

            objective= 'defend_from_guards'         
                 end   
         
      </unitCreatedOfType>

      <unitCreatedOfType type="start_wave_3">         
         if objective=='set_up_some_more_towers' and unitCount(1)==0 then
            showMessage('Theknightscome', 'knight')
            setDisplayText('Theknightscome')

                         createUnit('knight', 1, startLocation(0))
                         knightUnit= lastCreatedUnit()
                         givePositionCommand(knightUnit, 'move', startLocation(1))

            for i=1, 3 do
               createUnit('knight', 1, startLocation(0))
               givePositionCommand(lastCreatedUnit(), 'move', startLocation(1))
            end      

            objective= 'defend_from_knights'         
                 end   
         
      </unitCreatedOfType>

      <unitCreatedOfType type="start_wave_4">         
         if objective=='set_up_even_more_towers' and unitCount(1)==0 then
            showMessage('Thecatapultscome', 'catapult')
            setDisplayText('Thecatapultscome')

                         createUnit('catapult', 1, startLocation(0))
                         catapultUnit= lastCreatedUnit()
                         givePositionCommand(catapultUnit, 'move', startLocation(1))

            for i=1, 3 do
               createUnit('catapult', 1, startLocation(0))
               givePositionCommand(lastCreatedUnit(), 'move', startLocation(1))
            end      

            objective= 'defend_from_catapults'         
                 end   
         
      </unitCreatedOfType>

      <unitCreatedOfType type="start_wave_5">         
         if objective=='set_up_the_last_bunch_of_towers' and unitCount(1)==0 then
            showMessage('Thesiege_machinecomes', 'siege_machine')
            setDisplayText('Thesiege_machinecomes')

                         createUnit('siege_machine', 1, startLocation(0))
                         siege_machineUnit= lastCreatedUnit()
                         givePositionCommand(siege_machineUnit, 'move', startLocation(1))

            objective= 'defend_from_the_siege_machine'         
                 end   
         
      </unitCreatedOfType>

      <unitDied>
                        <!--  sword_man round   -->
         if objective=='defend_from_sword_mans' and unitCount(1)==0 then
            clearDisplayText()

         createUnit('w_c_2', 0, startLocation(2))
         w_c_2Unit= lastCreatedUnit()

         giveResource('gold', 0, 1000)
         setDisplayText('setupmoretowers')
         objective= 'set_up_more_towers'
         end
                        <!--  guard round   -->
         if objective=='defend_from_guards' and unitCount(1)==0 then
            clearDisplayText()

         createUnit('w_c_3', 0, startLocation(2))
         w_c_3Unit= lastCreatedUnit()

         giveResource('gold', 0, 1000)
         setDisplayText('setupsomemoretowers')
         objective= 'set_up_some_more_towers'
         end

                        <!--  knight round   -->
         if objective=='defend_from_knights' and unitCount(1)==0 then
            clearDisplayText()

         createUnit('w_c_4', 0, startLocation(2))
         w_c_4Unit= lastCreatedUnit()

         giveResource('gold', 0, 1500)
         setDisplayText('setupevenmoretowers')
         objective= 'set_up_even_more_towers'
         end

                        <!--  catapult round   -->
         if objective=='defend_from_catapults' and unitCount(1)==0 then
            clearDisplayText()

         createUnit('w_c_5', 0, startLocation(2))
         w_c_5Unit= lastCreatedUnit()

         giveResource('gold', 0, 1000)
         setDisplayText('setupthelastbunchoftowers')
         objective= 'set_up_the_last_bunch_of_towers'
         end

                        <!--  siege machine round   -->
              if objective=='defend_from_the_siege_machine' and unitCount(1)==0 then
            clearDisplayText()

         createUnit('w_c_6', 0, startLocation(2))
         w_c_6Unit= lastCreatedUnit()

         giveResource('gold', 0, 1000)
         setDisplayText('setupabunchmoretowers')
         objective= 'set_up_a_bunch_more_towers'
         end

         --check for finish dying
         if lastDeadUnit()==finishUnit then
            clearDisplayText()
            setPlayerAsWinner(1)
            setPlayerAsWinner(2)
            setPlayerAsWinner(3)            
            endGame()
         end

         if objective=='defend_from_the_siege_machine' and unitCount(1)==0 then
            clearDisplayText()
            setPlayerAsWinner(0)
            endGame()
         end
      </unitDied>
   </scripts>
</scenario>
Get the Vbros': Packs 1, 2, 3, 4, and 5!

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #54 on: 25 July 2009, 04:53:54 »
Interesting script!

I was thinking the w_c_* units must produce the start_wave_* units, but then I noticed you give the w_c_* units to the human player... so, how does it work?
Glest Advanced Engine - Code Monkey

Timeline | Downloads

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Glest tower defense
« Reply #55 on: 25 July 2009, 06:40:51 »
The  start_wave_* unit needs a w_c_* unit to be built. And as soon as you kill all the 1st wave it makes a w_c_* (and gives you 1000 gold to build towers with) so you can start the next wave wen your ready.

Ill be posting the scenario and the tech once I have enough band with.
« Last Edit: 25 July 2009, 06:45:50 by ElimNator »
Get the Vbros': Packs 1, 2, 3, 4, and 5!

me5

  • Guest
Re: Glest tower defense
« Reply #56 on: 25 July 2009, 17:15:08 »
@silnarm
How can I do this with a timer? You meen to check after some ticks what the position of the unit is? If so, what about units of different speed? It is difficult to guess the time a unit needs to reach a certain point. So the units will wait at last position until the time has been reached.
(I also thought of a transparent little thing instead of a worker to harvest ressources .(for the timer))

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #57 on: 26 July 2009, 03:16:17 »
I just test the position of the first unit in the group, to handle groups of multiple unit types you may want to simply make sure the first unit in the group is the slowest.

A size 1 cellmap = 0 harvester unit might be a very good idea. I had another idea that doesn't work unfortunately (low HP unit with regen = -1, then catch the death event). But a simple modification, adding a second unit to actually kill it (repeatedly) would be much simpler and easier to set up...

Anyway, I'm setup with the resource timer, so using that, this is how you could route units...

The helper functions: [These need to be before any calls to them, so put them at the top of the startup event]
Code: [Select]
----------------------------------------------------------------------------
--                Unit Creation and Group Management                      --
----------------------------------------------------------------------------

-- creates a unit and puts its id in group
function createAndGroup ( group, type, faction, pos )
  createUnit ( type, faction, pos );
  group[#group+1] = lastCreatedUnit ();
end
-- create a group of num units of a single unit type
function groupOfType ( group, type, faction, num, pos )
  for i=1,num do createAndGroup ( group, type, faction, pos ) end
end
-- create a group of units of different types
function groupFromTypes ( group, types, faction, pos )
  for i=1,#types do createAndGroup ( group, types[i], faction, pos ) end 
end
-- remove a unit id from a group
function removeFromGroup ( group, unitId )
  for i=1,#group do
    if ( group[i] == unitId ) then
      table.remove ( group, i );
      return;
    end
  end
end

----------------------------------------------------------------------------
--                          Group Commands                                --
----------------------------------------------------------------------------

-- give a group of units move commands to location
function groupMoveCommon ( units, location )
  for i=1,#units do givePositionCommand ( units[i], "move", location ) end
end
-- give a group of units move commands to distinct locations
function groupMoveSpecific ( units, locations )
  for i=1,#units do givePositionCommand ( units[i], "move", locations[i] ) end
end
-- give a group of units attack commands to location
function groupAttack ( units, pos )
  for i=1,#units do givePositionCommand ( units[i], "attack", pos ) end
end

----------------------------------------------------------------------------
--                             Geometry                                   --
----------------------------------------------------------------------------

-- is pos in rectangle
function pointIsIn ( pos, rectangle )
  if ( pos[1] >= rectangle[1] and rectangle[3] > pos[1]
  and pos[2] >= rectangle[2] and rectangle[4] > pos[2] ) then
    return true;
  end
  return false;
end

-- returns a rectangle around the point 'pos'
function areaAround ( pos )
  return { pos[1]-5, pos[2]-5, pos[1]+5, pos[2]+5 };
end

set up: [the rest of the startup event]
Code: [Select]
----------------------------------------------------------------------------
--                             Start-Up                                   --
----------------------------------------------------------------------------

-- the patrol table will store the waypoints and regions around them
patrol = {};
patrol.waypoints = { {15,15}, {50,15}, {50,50}, {15,50} };
patrol.regions = {};
for i=1,#patrol.waypoints do
  patrol.regions[#patrol.regions+1] = areaAround(patrol.waypoints[i]);
end

-- Make a group of 8 daemons...
disableAi (2);
daemons = {};
daemons.units = {};
groupOfType ( daemons.units, "daemon", 2, 8, patrol.waypoints[1] );

-- start them on their way...
groupMoveCommon ( daemons.units, patrol.waypoints[2] );
-- remember where they are currently going...
daemons.dest = 2; -- index of current target

-- Timer
timer = {};
groupFromTypes ( timer, {"mage_tower","initiate"}, 1, startLocation(1) );
giveResource ( "energy", 1, 1 );
tickCount = 0;

and in the resourceHarvested event...
Code: [Select]
  if ( resourceAmount ("gold", 1) > 0 ) then
    -- increment the tick counter
    tickCount = tickCount + 1;
   
    -- Check if daemons have reached target...
    local cur_pos = unitPosition(daemons.units[1]);
    local cur_dest = patrol.regions[daemons.dest];
    if ( pointIsIn(cur_pos, cur_dest) ) then
      -- we have arrived, set next destination...
      daemons.dest = daemons.dest % #patrol.waypoints + 1;
      -- and head on out..
      groupMoveCommon ( daemons.units, patrol.waypoints[daemons.dest] );
    end
    -- Do things at particular times here...
    if ( tickCount == 10 ) then
      -- scripted action...
    elseif ( tickCount == 20 ) then
      -- another scripted action...
    elseif ( tickCount == 30 ) then
      -- etc
    end
   
    -- now take the gold back, to reset for next time...
    giveResource ("gold", 1, -10);
  end
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 #58 on: 28 July 2009, 02:42:05 »
Not yet  ;)

Maybe that will be implimented later.

However, judging from the posts in the GAE board, it may be possible to have the unit walk to point A, then check if it is at point A, and if so, move to point B, but not sure how to make such an event fire, since there's no unit deaths or creations, and that's really the only tags there is. Of course, maybe it'll work without that 'firing' tag.

Silnarm?
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 #59 on: 29 July 2009, 04:52:42 »
Silnarm?

Not actually sure what you're asking ... :)

The code from my last post is 'fully functional' using the timer I described earlier. It just sends a group of 8 deamons on a square path, indefinitely... but could be modified to do more interesting things.

I was hoping to have scenario out soon, showing what is indeed possible... but I'm having some hardware 'issues' atm, so it might take a bit longer than I had hoped (3 people & 3 computers was fine, but 3 people & 1 computer ... not so good).
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 #60 on: 29 July 2009, 05:15:41 »
My bad. I apparently was one page behind! I must have been replying to something old.

Great code BTW.
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

Heretik

  • Guest
Re: Glest tower defense
« Reply #61 on: 29 July 2009, 18:42:52 »
Hi,

I've implemented a simple TD. It's mainly a tech demo to show how it's possible to make a TD in Glest without any real coding. I hope it can be useful as a base for other people who wanna make their own original and fancy TD.

You can download it there : http://anarres.homelinux.net/~heretik/glest_simple_td.zip

To install it, just copy the directories in maps, scenarios and techs into correponding directories in glest data. Then run Glest, go to Scenarios menu and select "Simple TD".

All comments and questions are welcome.

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Glest tower defense
« Reply #62 on: 2 August 2009, 05:16:13 »
Here is a tower of defense senario I made.

Down load it here.
http://soft-haus.com/blog/wp-content/plugins/download-monitor/download.php?id=21

What do you think?
Get the Vbros': Packs 1, 2, 3, 4, and 5!

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest tower defense
« Reply #63 on: 2 August 2009, 08:26:01 »
Umm, descriptions of either?

I don't really like downloading stuff blindly, not on my web. If I had blazing internet, I could go downloading everything that I lay my eyes on, but I don't, so that's why I am 3 months behind!  :D
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

me5

  • Guest
Re: Glest tower defense
« Reply #64 on: 10 August 2009, 10:24:24 »
Can someone tell me how I can give a harvest command to units?
I tried "givePositionCommand(unitId, "harvest", position)" but it didn't work.
I was told that this command may only work with "attack" and "move".
Is there maybe another way to do this? ???

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest tower defense
« Reply #65 on: 10 August 2009, 12:16:11 »
I don't think it can be done...

But what do we need to harvest for? Just give any resources you need. If necessary, you can use the clock method I gave earlier to make intervals.
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

me5

  • Guest
Re: Glest tower defense
« Reply #66 on: 16 August 2009, 17:32:57 »
1. @ElimiNator Can you please upload your project again ? I think there is a file missing "tower_of_defence/techs/tower/factions/tower_2/units/.svn/.svn.xml"

2. Because I couldn't find a way to give a harvest command to units I tried to use two fighting units instead (idea of silnarm) for the timer but it also doesn't work.
this is what I try to do:
-Create two units at the beginning
-UnitA is "immortal" and kills UnitB all the time
-When UnitB is killed a new unit should be created at the same position as before

Code: [Select]
<startup>

disableAi(1)

createUnit ( "castle", 0, startLocation(0) );

createUnit('worker', 0, {startLocation(0)[1],startLocation(0)[2]});

                        createUnit ( "UnitA", 0, {30,55} );

createUnit ( "UnitB", 1, {38,55} );

givePositionCommand(lastCreatedUnit(0), 'attack', {38,55});

setCameraPosition({38,55});

giveResource('gold', 0, 1000);

giveResource('stone', 0, 100);

giveResource('wood', 0, 1000);

giveResource('food', 0, 500);



startTime = os.time();

id = lastCreatedUnit(1);

</startup>



 

<unitDied>

timeSinceStart = os.time() - startTime;

if ( LastDeadUnit()  == id  ) then

createUnit ( "UnitB", 1, {38,55} );

end



</unitDied>

How does glest execute the lua script?
What I thought:
-execute everything until "</startup>" and then wait until an event like unit was killed or unitoftype was created ... is triggered and then execute everything between "<unitDied>" and "</unitDied>" or
"<ressourceHarvested>" ... .

modman

  • Guest
Re: Glest tower defense
« Reply #67 on: 16 August 2009, 23:52:13 »
You're supposed to delete the svns; Eliminator said[i/] he deleted them.

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest tower defense
« Reply #68 on: 17 August 2009, 02:44:03 »
-UnitA is "immortal" and kills UnitB all the time
-When UnitB is killed a new unit should be created at the same position as before

Your script has errors :)

lastCreatedUnit() does not take any parameters.

It returns the id of the last created unit, period.  You are passing a faction index, hoping for the last created unit of that faction, LUA is seeing a function it doesn't recognise and stopping.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Glest tower defense
« Reply #69 on: 17 August 2009, 03:40:46 »
I did delete them but I didn't upload that one yet.
Get the Vbros': Packs 1, 2, 3, 4, and 5!

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest tower defense
« Reply #70 on: 17 August 2009, 08:13:12 »
Meh, I hate SVN's. Especially in Glest. Just delete that folder and change the code as silnarm mentioned so that lastCreatedUnit() is written like that, with no parameters (parameters are variable names inside the brackets, ie: lastCreatedUnit(1);).
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

me5

  • Guest
Re: Glest tower defense
« Reply #71 on: 17 August 2009, 09:02:18 »
Thx after deleting the ".svn" folders in the techs folder it worked. Didn't it work because I tried it on a win machine so the folders named with a dot at the beginning are not hidden?

@ElimiNator
Some comments on your scenario:
negative:
-it may only work for landunits
-one have to start the attacker waves manually

positive:
-it works  ;D
-nice workaround with the stones

@all
Because I don't know if my own units have bugs I switched to the standard units.
my new code (still does not work):
Code: [Select]
<startup>

disableAi(1)

createUnit ( "castle", 0, startLocation(0) );

createUnit('worker', 0, {startLocation(0)[1],startLocation(0)[2]});

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

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

setCameraPosition(startLocation(0));

giveResource('gold', 0, 1000);

giveResource('stone', 0, 100);

giveResource('wood', 0, 1000);

giveResource('food', 0, 500);



startTime = os.time();

id = lastCreatedUnit();

</startup>



 

<unitDied>

timeSinceStart = os.time() - startTime;



if ( LastDeadUnit()  == id  ) then

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

end



</unitDied>

next error please :)

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest tower defense
« Reply #72 on: 17 August 2009, 09:22:21 »
Possible things to try: replace double quotes with single ones, as some characters may not encode properly in double (I don't see any characters like that in your code, but never hurts). You can also try labeling the lastCreatedUnit()=id line directly after you create the unit.

What on earth is this?

Code: [Select]
{startLocation(0)[1],startLocation(0)[2]});
I found this on line 4. What is it? Try replacing it with just startLocation(0), so the line would look like this:

Code: [Select]
createUnit('worker', 0, startLocation(0));
EDIT//
Oh ho ho. How could I have missed that! I just took another look. You capitalized the wrong letter in one place! On line 17, you use LastCreatedUnit. Lua is case sensitive, so you must use lastCreatedUnit(). Notice the first letter is lowercase. This is called camelwritting. Somehow, in the sick, twisted minds of the 'creators', it reminded them of camels. Dunno where they got the camels from, but interesting trivia!
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Glest tower defense
« Reply #73 on: 17 August 2009, 15:10:26 »
Why dose this need to be changed wen it works?
(The SVNs not included.)
Get the Vbros': Packs 1, 2, 3, 4, and 5!

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest tower defense
« Reply #74 on: 19 August 2009, 05:12:34 »
This is his new code, so he has some errors.

Of course, Eliminator DOES have a point. But where's the download for the no-SVN version?!?
Edit the MegaGlest wiki: http://docs.megaglest.org/

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