323 function CheckOnShroom() |
323 function CheckOnShroom() |
324 return GetX(youngh) >= 2461 and StoppedGear(youngh) |
324 return GetX(youngh) >= 2461 and StoppedGear(youngh) |
325 end |
325 end |
326 |
326 |
327 function DoOnShroom() |
327 function DoOnShroom() |
328 ropeCrate1 = SpawnUtilityCrate(2751, 1194, amRope) |
328 ropeCrate1 = SpawnUtilityCrate(2751, 1194, amRope, 100) |
329 SetGearMessage(CurrentHedgehog, 0) |
329 SetGearMessage(CurrentHedgehog, 0) |
330 AddAnim(onShroomAnim) |
330 AddAnim(onShroomAnim) |
331 AddEvent(CheckOnFlower, {}, DoOnFlower, {}, 0) |
331 AddEvent(CheckOnFlower, {}, DoOnFlower, {}, 0) |
332 end |
332 end |
333 |
333 |
335 return rope1Taken and StoppedGear(youngh) |
335 return rope1Taken and StoppedGear(youngh) |
336 end |
336 end |
337 |
337 |
338 function DoOnFlower() |
338 function DoOnFlower() |
339 AddAmmo(youngh, amRope, 100) |
339 AddAmmo(youngh, amRope, 100) |
340 paraCrate = SpawnUtilityCrate(3245, 1758, amParachute) |
340 paraCrate = SpawnUtilityCrate(3245, 1758, amParachute, 100) |
341 SetGearMessage(CurrentHedgehog, 0) |
341 SetGearMessage(CurrentHedgehog, 0) |
342 AddAnim(onFlowerAnim) |
342 AddAnim(onFlowerAnim) |
343 AddEvent(CheckTookParaCrate, {}, DoTookParaCrate, {}, 0) |
343 AddEvent(CheckTookParaCrate, {}, DoTookParaCrate, {}, 0) |
344 end |
344 end |
345 |
345 |
366 return x < 3005 and y > 1500 and StoppedGear(youngh) |
366 return x < 3005 and y > 1500 and StoppedGear(youngh) |
367 end |
367 end |
368 |
368 |
369 function DoPastMoleHead() |
369 function DoPastMoleHead() |
370 RemoveEventFunc(CheckOnMoleHead) |
370 RemoveEventFunc(CheckOnMoleHead) |
371 ropeCrate2 = SpawnUtilityCrate(2782, 1720, amRope) |
371 ropeCrate2 = SpawnUtilityCrate(2782, 1720, amRope, 100) |
372 AddAmmo(youngh, amRope, 0) |
372 AddAmmo(youngh, amRope, 0) |
373 SetGearMessage(CurrentHedgehog, 0) |
373 SetGearMessage(CurrentHedgehog, 0) |
374 AddAnim(pastMoleHeadAnim) |
374 AddAnim(pastMoleHeadAnim) |
375 AddEvent(CheckTookRope2, {}, DoTookRope2, {}, 0) |
375 AddEvent(CheckTookRope2, {}, DoTookRope2, {}, 0) |
376 end |
376 end |
377 |
377 |
378 function DoOnMoleHead() |
378 function DoOnMoleHead() |
379 RemoveEventFunc(CheckPastMoleHead) |
379 RemoveEventFunc(CheckPastMoleHead) |
380 ropeCrate2 = SpawnUtilityCrate(2782, 1720, amRope) |
380 ropeCrate2 = SpawnUtilityCrate(2782, 1720, amRope, 100) |
381 AddAmmo(youngh, amRope, 0) |
381 AddAmmo(youngh, amRope, 0) |
382 SetGearMessage(CurrentHedgehog, 0) |
382 SetGearMessage(CurrentHedgehog, 0) |
383 AddAnim(onMoleHeadAnim) |
383 AddAnim(onMoleHeadAnim) |
384 AddEvent(CheckTookRope2, {}, DoTookRope2, {}, 0) |
384 AddEvent(CheckTookRope2, {}, DoTookRope2, {}, 0) |
385 end |
385 end |
390 |
390 |
391 function DoTookRope2() |
391 function DoTookRope2() |
392 AddAmmo(youngh, amRope, 100) |
392 AddAmmo(youngh, amRope, 100) |
393 SetGearMessage(CurrentHedgehog, 0) |
393 SetGearMessage(CurrentHedgehog, 0) |
394 AddAnim(tookRope2Anim) |
394 AddAnim(tookRope2Anim) |
395 punchCrate = SpawnAmmoCrate(2460, 1321, amFirePunch) |
395 punchCrate = SpawnAmmoCrate(2460, 1321, amFirePunch, 100) |
396 AddEvent(CheckTookPunch, {}, DoTookPunch, {}) |
396 AddEvent(CheckTookPunch, {}, DoTookPunch, {}) |
397 end |
397 end |
398 |
398 |
399 function CheckTookPunch() |
399 function CheckTookPunch() |
400 return punchTaken and StoppedGear(youngh) |
400 return punchTaken and StoppedGear(youngh) |
416 function CheckTargDestroyed() |
416 function CheckTargDestroyed() |
417 return targetsDestroyed == 5 and StoppedGear(youngh) |
417 return targetsDestroyed == 5 and StoppedGear(youngh) |
418 end |
418 end |
419 |
419 |
420 function DoTargDestroyed() |
420 function DoTargDestroyed() |
|
421 AddAmmo(youngh, amFirePunch, 0) |
421 SetGearMessage(CurrentHedgehog, 0) |
422 SetGearMessage(CurrentHedgehog, 0) |
422 AddAnim(challengeAnim) |
423 AddAnim(challengeAnim) |
423 targetsDestroyed = 0 |
424 targetsDestroyed = 0 |
424 AddFunction({func = SetChoice, args = {}}) |
425 AddFunction({func = SetChoice, args = {}}) |
425 ropeCrate3 = SpawnAmmoCrate(2000, 1200, amRope) |
426 ropeCrate3 = SpawnUtilityCrate(2000, 1200, amRope, 100) |
426 AddEvent(CheckTookRope3, {}, AddAmmo, {youngh, amRope, 100}, 0) |
427 AddEvent(CheckTookRope3, {}, AddAmmo, {youngh, amRope, 100}, 0) |
427 AddEvent(CheckCratesColled, {}, DoCratesColled, {}, 0) |
428 AddEvent(CheckCratesColled, {}, DoCratesColled, {}, 0) |
428 AddEvent(CheckChallengeWon, {}, DoChallengeWon, {}, 0) |
429 AddEvent(CheckChallengeWon, {}, DoChallengeWon, {}, 0) |
429 AddEvent(CheckTimesUp, {}, DoTimesUp, {}, 1) |
430 AddEvent(CheckTimesUp, {}, DoTimesUp, {}, 1) |
430 end |
431 end |
452 function CheckChallengeWon() |
453 function CheckChallengeWon() |
453 return cratesCollected == crateNum[difficulty] and StoppedGear(youngh) |
454 return cratesCollected == crateNum[difficulty] and StoppedGear(youngh) |
454 end |
455 end |
455 |
456 |
456 function DoChallengeWon() |
457 function DoChallengeWon() |
457 desertCrate = SpawnAmmoCrate(1240, 1212, amDEagle) |
458 desertCrate = SpawnAmmoCrate(1240, 1212, amDEagle, 100) |
458 SetGearMessage(CurrentHedgehog, 0) |
459 SetGearMessage(CurrentHedgehog, 0) |
459 AddAnim(challengeCompletedAnim) |
460 AddAnim(challengeCompletedAnim) |
460 AddEvent(CheckDesertColled, {}, DoDesertColled, {}, 0) |
461 AddEvent(CheckDesertColled, {}, DoDesertColled, {}, 0) |
461 end |
462 end |
462 |
463 |
580 function PutCrate(i) |
581 function PutCrate(i) |
581 if i > crateNum[difficulty] then |
582 if i > crateNum[difficulty] then |
582 return |
583 return |
583 end |
584 end |
584 if difficulty == 1 then |
585 if difficulty == 1 then |
585 crates[1] = SpawnAmmoCrate(targXdif1[i], targYdif1[i], amRope) |
586 crates[1] = SpawnFakeAmmoCrate(targXdif1[i], targYdif1[i], false, false) |
586 else |
587 else |
587 crates[1] = SpawnAmmoCrate(targXdif2[i], targYdif2[i], amRope) |
588 crates[1] = SpawnFakeAmmoCrate(targXdif2[i], targYdif2[i], false, false) |
588 end |
589 end |
589 end |
590 end |
590 |
591 |
591 function PutTargets(i) |
592 function PutTargets(i) |
592 targets[1] = AddGear(targetPosX[i][1], targetPosY[i][1], gtTarget, 0, 0, 0, 0) |
593 targets[1] = AddGear(targetPosX[i][1], targetPosY[i][1], gtTarget, 0, 0, 0, 0) |
668 paraTaken = true |
669 paraTaken = true |
669 elseif gear == ropeCrate2 then |
670 elseif gear == ropeCrate2 then |
670 rope2Taken = true |
671 rope2Taken = true |
671 elseif gear == ropeCrate3 then |
672 elseif gear == ropeCrate3 then |
672 rope3Taken = true |
673 rope3Taken = true |
673 elseif gear == crates[1] and deleteCrate == true then |
674 elseif gear == crates[1] then |
674 deleteCrate = false |
675 -- Play sound if challenge crate (fake crate) collected |
675 elseif gear == crates[1] and challengeFailed == false then |
676 if band(GetGearMessage(gear), gmDestroy) ~= 0 then |
676 crates[1] = nil |
677 PlaySound(sndShotgunReload) |
677 cratesCollected = cratesCollected + 1 |
678 end |
678 PutCrate(cratesCollected + 1) |
679 |
|
680 -- Update crate challenge |
|
681 if deleteCrate == true then |
|
682 deleteCrate = false |
|
683 elseif challengeFailed == false then |
|
684 crates[1] = nil |
|
685 cratesCollected = cratesCollected + 1 |
|
686 PutCrate(cratesCollected + 1) |
|
687 end |
679 elseif gear == punchCrate then |
688 elseif gear == punchCrate then |
680 punchTaken = true |
689 punchTaken = true |
681 elseif gear == desertCrate then |
690 elseif gear == desertCrate then |
682 desertTaken = true |
691 desertTaken = true |
683 elseif GetGearType(gear) == gtTarget then |
692 elseif GetGearType(gear) == gtTarget then |