45 -------------- |
45 -------------- |
46 --0.6 |
46 --0.6 |
47 -------------- |
47 -------------- |
48 -- move 1 line of code :D (allows loading of HWMAP points to actually work) |
48 -- move 1 line of code :D (allows loading of HWMAP points to actually work) |
49 |
49 |
|
50 -------------- |
|
51 --0.7 |
|
52 -------------- |
|
53 -- allow waypoints to be loaded automatically via TechMaps or HWMAP |
|
54 -- (temporarily?) remove ability to place waypoints manually |
|
55 -- break stuff? |
|
56 |
50 ----------------------------- |
57 ----------------------------- |
51 -- SCRIPT BEGINS |
58 -- SCRIPT BEGINS |
52 ----------------------------- |
59 ----------------------------- |
53 |
60 |
54 HedgewarsScriptLoad("/Scripts/Locale.lua") |
61 HedgewarsScriptLoad("/Scripts/Locale.lua") |
574 |
581 |
575 runOnGears(RemoveGear) |
582 runOnGears(RemoveGear) |
576 |
583 |
577 end |
584 end |
578 |
585 |
|
586 function CallBob(x,y) |
|
587 if not racerActive then |
|
588 if wpCount == 0 or wpX[wpCount - 1] ~= x or wpY[wpCount - 1] ~= y then |
|
589 |
|
590 wpX[wpCount] = x |
|
591 wpY[wpCount] = y |
|
592 wpCol[wpCount] = 0xffffffff |
|
593 wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true) |
|
594 |
|
595 SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount]) |
|
596 |
|
597 wpCount = wpCount + 1 |
|
598 |
|
599 --AddCaption(loc("Waypoint placed.") .. " " .. loc("Available points remaining: ") .. (wpLimit-wpCount)) |
|
600 end |
|
601 end |
|
602 end |
|
603 |
|
604 |
|
605 |
579 function HandleFreshMapCreation() |
606 function HandleFreshMapCreation() |
580 |
607 |
581 -- the boom stage, boom girders, reset ammo, and delete other map objects |
608 -- the boom stage, boom girders, reset ammo, and delete other map objects |
582 if activationStage == 1 then |
609 if activationStage == 1 then |
583 |
610 |
592 -- these are from onParameters() |
619 -- these are from onParameters() |
593 if (mapID == nil) or (mapID == 0) then |
620 if (mapID == nil) or (mapID == 0) then |
594 LoadMap(2000) |
621 LoadMap(2000) |
595 else |
622 else |
596 LoadMap(mapID) |
623 LoadMap(mapID) |
|
624 end |
|
625 |
|
626 for i = 0,(wpCount-1) do |
|
627 DeleteVisualGear(wpCirc[i]) |
|
628 end |
|
629 wpCount = 0 |
|
630 |
|
631 for i = 1, techCount-1 do |
|
632 CallBob(techX[i],techY[i]) |
597 end |
633 end |
598 |
634 |
599 activationStage = 200 |
635 activationStage = 200 |
600 --runOnHogs(RestoreHog) |
636 --runOnHogs(RestoreHog) |
601 |
637 |
830 elseif specialPointsFlag[i] == 127 then |
866 elseif specialPointsFlag[i] == 127 then |
831 PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmRubber, 3, 4294967295, nil, nil, nil, lfBouncy) |
867 PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmRubber, 3, 4294967295, nil, nil, nil, lfBouncy) |
832 |
868 |
833 -- Waypoints |
869 -- Waypoints |
834 else -- 0 / no value |
870 else -- 0 / no value |
835 PlaceWayPoint(specialPointsX[i], specialPointsY[i]) |
871 CallBob(specialPointsX[i], specialPointsY[i]) |
836 end |
872 end |
837 |
873 |
838 end |
874 end |
839 |
875 |
840 end |
876 end |
867 "", 4, 4000 |
903 "", 4, 4000 |
868 ) |
904 ) |
869 |
905 |
870 TryRepositionHogs() |
906 TryRepositionHogs() |
871 |
907 |
872 end |
908 activationStage = 2 |
873 |
909 HandleFreshMapCreation() |
874 function PlaceWayPoint(x,y) |
910 |
875 if not racerActive then |
911 end |
876 if wpCount == 0 or wpX[wpCount - 1] ~= x or wpY[wpCount - 1] ~= y then |
912 |
877 |
913 |
878 wpX[wpCount] = x |
|
879 wpY[wpCount] = y |
|
880 wpCol[wpCount] = 0xffffffff |
|
881 wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true) |
|
882 |
|
883 SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount]) |
|
884 |
|
885 wpCount = wpCount + 1 |
|
886 |
|
887 AddCaption(loc("Waypoint placed.") .. " " .. loc("Available points remaining: ") .. (wpLimit-wpCount)) |
|
888 end |
|
889 end |
|
890 end |
|
891 |
914 |
892 function onNewTurn() |
915 function onNewTurn() |
893 |
916 |
894 CheckForNewRound() |
917 CheckForNewRound() |
895 TryRepositionHogs() |
918 TryRepositionHogs() |
905 |
928 |
906 |
929 |
907 trackTime = 0 |
930 trackTime = 0 |
908 |
931 |
909 currCount = 0 -- hopefully this solves problem |
932 currCount = 0 -- hopefully this solves problem |
910 AddAmmo(CurrentHedgehog, amAirAttack, 0) |
933 -- AddAmmo(CurrentHedgehog, amAirAttack, 0) |
911 gTimer = 0 |
934 gTimer = 0 |
912 |
935 |
913 -- Set the waypoints to unactive on new round |
936 -- Set the waypoints to unactive on new round |
914 for i = 0,(wpCount-1) do |
937 for i = 0,(wpCount-1) do |
915 wpActive[i] = false |
938 wpActive[i] = false |
917 SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i]) |
940 SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i]) |
918 end |
941 end |
919 |
942 |
920 -- Handle Starting Stage of Game |
943 -- Handle Starting Stage of Game |
921 if (gameOver == false) and (gameBegun == false) then |
944 if (gameOver == false) and (gameBegun == false) then |
922 if wpCount >= 3 then |
945 -- if wpCount >= 3 then |
923 gameBegun = true |
946 gameBegun = true |
924 --activationStage = 200 |
947 -- --[[activationStage = 200]] |
925 roundNumber = 0 |
948 roundNumber = 0 |
926 firstClan = GetHogClan(CurrentHedgehog) |
949 firstClan = GetHogClan(CurrentHedgehog) |
927 ShowMission(loc("RACER"), |
950 ShowMission(loc("RACER"), |
928 loc("GAME BEGUN!!!"), |
951 loc("GAME BEGUN!!!"), |
929 loc("Complete the track as fast as you can!"), 2, 4000) |
952 loc("Complete the track as fast as you can!"), 2, 4000) |
930 else |
953 --else |
931 ShowMission(loc("RACER"), |
954 -- ShowMission(loc("RACER"), |
932 loc("NOT ENOUGH WAYPOINTS"), |
955 -- loc("NOT ENOUGH WAYPOINTS"), |
933 loc("Place more waypoints using the 'Air Attack' weapon."), 2, 4000) |
956 -- loc("Place more waypoints using the 'Air Attack' weapon."), 2, 4000) |
934 AddAmmo(CurrentHedgehog, amAirAttack, 4000) |
957 -- AddAmmo(CurrentHedgehog, amAirAttack, 4000) |
935 SetWeapon(amAirAttack) |
958 -- SetWeapon(amAirAttack) |
936 end |
959 -- end |
937 end |
960 end |
938 |
961 |
939 if gameOver == true then |
962 if gameOver == true then |
940 gameBegun = false |
963 gameBegun = false |
941 racerActive = false -- newadd |
964 racerActive = false -- newadd |