share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua
changeset 12511 15e9ef8be44f
parent 12510 cc146b018d14
child 12548 933aee9786c3
equal deleted inserted replaced
12510:cc146b018d14 12511:15e9ef8be44f
   136 cyborgPos = {745, 1847}
   136 cyborgPos = {745, 1847}
   137 cyborgsPos = {{2937, 831}, {2945, 1264}, {2335, 1701}, {448, 484}}
   137 cyborgsPos = {{2937, 831}, {2945, 1264}, {2335, 1701}, {448, 484}}
   138 cyborgsDir = {"Left", "Left", "Left", "Right"}
   138 cyborgsDir = {"Left", "Left", "Left", "Right"}
   139 
   139 
   140 cratePos = {
   140 cratePos = {
   141             {788, 1919, amGirder, 2}, {412, 1615, amGirder, 1},
   141             {{788, 1919, amGirder, 2}, true}, {{412, 1615, amGirder, 1}, true},
   142             {209, 1474, amSniperRifle, 1}, {1178, 637, amDEagle, 1},
   142             {{209, 1474, amSniperRifle, 1}}, {{1178, 637, amDEagle, 1}},
   143             {633, 268, amDEagle, 1}, {3016, 1545, amDEagle, 1},
   143             {{633, 268, amDEagle, 1}}, {{3016, 1545, amDEagle, 1}},
   144             {249, 1377, amRope, 3}, {330, 1018, amGirder, 1},
   144             {{249, 1377, amRope, 3}, true}, {{330, 1018, amGirder, 1}, true},
   145             {888, 647, amRope, 3}, {2116, 337, amRope, 3},
   145             {{888, 647, amRope, 3}, true}, {{2116, 337, amRope, 3}, true},
   146             {1779, 948, amRope, 3}, {3090, 1066, amRope, 3},
   146             {{1779, 948, amRope, 3}, true}, {{3090, 1066, amRope, 3}, true},
   147             {947, 480, amBazooka, 3}, {1097, 480, amMortar, 3},
   147             {{947, 480, amBazooka, 3}}, {{1097, 480, amMortar, 3}},
   148             {1139, 451, amSnowball, 3}, {1207, 468, amShotgun, 3},
   148             {{1139, 451, amSnowball, 3}}, {{1207, 468, amShotgun, 3}},
   149             {1024, 393, amSniperRifle, 2}, {998, 391, amDynamite, 2},
   149             {{1024, 393, amSniperRifle, 2}}, {{998, 391, amDynamite, 2}},
   150             {1024, 343, amRope, 2}, {998, 341, amRope, 2}
   150             {{1024, 343, amRope, 2}, true}, {{998, 341, amRope, 2}, true},
   151            }
   151            }
   152 reactions = {loc("Yeah, take that!"), loc("Bullseye"), loc("Die, die, die!")}
   152 reactions = {loc("Yeah, take that!"), loc("Bullseye"), loc("Die, die, die!")}
   153 
   153 
   154 secondPos = {{1010, 510}, {1067, 510}}
   154 secondPos = {{1010, 510}, {1067, 510}}
   155 -----------------------------Variables---------------------------------
   155 -----------------------------Variables---------------------------------
   306   AnimSwitchHog(native)
   306   AnimSwitchHog(native)
   307   AnimWait(native, 1)
   307   AnimWait(native, 1)
   308   AddFunction({func = HideHedge, args = {cyborg}})
   308   AddFunction({func = HideHedge, args = {cyborg}})
   309 end
   309 end
   310 
   310 
       
   311 function SpawnCrateByID(id)
       
   312     if cratePos[id][2] == true then
       
   313        crates[id] = SpawnUtilityCrate(unpack(cratePos[id][1]))
       
   314     else
       
   315        crates[id] = SpawnAmmoCrate(unpack(cratePos[id][1]))
       
   316     end
       
   317     return crates[id]
       
   318 end
       
   319 
   311 function AfterStartAnim()
   320 function AfterStartAnim()
   312   SetGearMessage(native, 0)
   321   SetGearMessage(native, 0)
   313   cratesNum = 0
   322   cratesNum = 0
   314   for i = 1, 6 do
   323   for i = 1, 6 do
   315     crates[i] = SpawnAmmoCrate(unpack(cratePos[i]))
   324     SpawnCrateByID(i)
   316     cratesNum = cratesNum + 1
   325     cratesNum = cratesNum + 1
   317   end
   326   end
   318   FollowGear(native)
   327   FollowGear(native)
   319   AddNewEvent(CheckGearsDead, {{crates[1], crates[2]}}, PutCrates, {2}, 0) 
   328   AddNewEvent(CheckGearsDead, {{crates[1], crates[2]}}, PutCrates, {2}, 0) 
   320   TurnTimeLeft = TurnTime
   329   TurnTimeLeft = TurnTime
   390 
   399 
   391 
   400 
   392 function PutWeaponCrates()
   401 function PutWeaponCrates()
   393   for i = 1, 8 do
   402   for i = 1, 8 do
   394     cratesNum = cratesNum + 1
   403     cratesNum = cratesNum + 1
   395     crates[cratesNum] = SpawnAmmoCrate(unpack(cratePos[cratesNum]))
   404     SpawnCrateByID(cratesNum)
   396   end
   405   end
   397   FollowGear(native)
   406   FollowGear(native)
   398 end
   407 end
   399 
   408 
   400 function DoCratesTaken()
   409 function DoCratesTaken()
   406 end
   415 end
   407 
   416 
   408 function PutCrates(index)
   417 function PutCrates(index)
   409   if index <= 7 then
   418   if index <= 7 then
   410     cratesNum = cratesNum + 1
   419     cratesNum = cratesNum + 1
   411     crates[cratesNum] = SpawnUtilityCrate(unpack(cratePos[cratesNum]))
   420     SpawnCrateByID(cratesNum)
   412     AddNewEvent(CheckGearDead, {crates[cratesNum]}, PutCrates, {index + 1}, 0)
   421     AddNewEvent(CheckGearDead, {crates[cratesNum]}, PutCrates, {index + 1}, 0)
   413     FollowGear(native)
   422     FollowGear(native)
   414   else
   423   else
   415     AddEvent(StoppedGear, {native}, DoCratesTaken, {}, 0)
   424     AddEvent(StoppedGear, {native}, DoCratesTaken, {}, 0)
   416   end
   425   end