Thanks a bunch for the quick answers! The script I made was intentionally coded for
this map I built with WormMM. Two players with different weapons team up to stop the enemy team who's trying to break into the tower. I'll be trying to find what's wrong with my turn tracking code to show different messages at the beginning of each turn. Oh, and I also got an "access violation" exception when trying to spawn mines with a W.A. scheme with no random objects enabled. If I set it to have 1 random mine on the map only, the MakeMine functions do work. The barrel ones work no matter the scheme settings.
Here's what I ended up with:
Code:
var
t1w1,t1w2,t1w3,t1w4,t1w5,t1w6,t1w7,t1w8,t2w1,t2w2,t2w3,t2w4,t2w5,t2w6,t2w7,t2w8,t3w1,t3w2,t3w3,t3w4,t3w5,t3w6,t3w7,t3w8 : TWorm;
current_turn : Integer;
procedure InitHooks();
begin
begin
RegisterHook('Init', ON_INIT);
RegisterHook('OnFire', ON_BEGIN_FIRE);
RegisterHook('OnTurn', ON_TURN_BEGIN);
RegisterHook('Frame', ON_FRAME);
RegisterHook('OnCrate', ON_CRATE_PICK); //Don't know if all of these are really necessary
end;
end;
procedure Init;
begin
current_turn := 0
t1w1 := getWormObj(1,1);
t1w2 := getWormObj(1,2);
t1w3 := getWormObj(1,3);
t1w4 := getWormObj(1,4);
t1w5 := getWormObj(1,5);
t1w6 := getWormObj(1,6);
t1w7 := getWormObj(1,7);
t1w8 := getWormObj(1,8);
t2w1 := getWormObj(2,1);
t2w2 := getWormObj(2,2);
t2w3 := getWormObj(2,3);
t2w4 := getWormObj(2,4);
t2w5 := getWormObj(2,5);
t2w6 := getWormObj(2,6);
t2w7 := getWormObj(2,7);
t2w8 := getWormObj(2,8);
t3w1 := getWormObj(3,1);
t3w2 := getWormObj(3,2);
t3w3 := getWormObj(3,3);
t3w4 := getWormObj(3,4);
t3w5 := getWormObj(3,5);
t3w6 := getWormObj(3,6);
t3w7 := getWormObj(3,7);
t3w8 := getWormObj(3,8);
t1w1.PosX := 115 ;
t1w1.PosY := 7940 ;
t1w2.PosX := 155 ;
t1w2.PosY := 7940 ;
t1w3.PosX := 205 ;
t1w3.PosY := 7940 ;
t1w4.PosX := 255 ;
t1w4.PosY := 7940 ;
t1w5.PosX := 2525 ;
t1w5.PosY := 7940 ;
t1w6.PosX := 2575 ;
t1w6.PosY := 7940 ;
t1w7.PosX := 2625 ;
t1w7.PosY := 7940 ;
t1w8.PosX := 2675 ;
t1w8.PosY := 7940 ;
t1w1.Health := 250 ;
t1w2.Health := 500 ;
t1w3.Health := 750 ;
t1w4.Health := 1000 ;
t1w5.Health := 250 ;
t1w6.Health := 500 ;
t1w7.Health := 750 ;
t1w8.Health := 1000 ;
t2w1.PosX := 1768 ;
t2w1.PosY := 1935 ;
t2w2.PosX := 1648 ;
t2w2.PosY := 1888 ;
t2w3.PosX := 1410 ;
t2w3.PosY := 1930 ;
t2w4.PosX := 1243 ;
t2w4.PosY := 1771 ;
t2w5.PosX := 1493 ;
t2w5.PosY := 1666 ;
t2w6.PosX := 1770 ;
t2w6.PosY := 1700 ;
t2w7.PosX := 1230 ;
t2w7.PosY := 1930 ;
t2w8.PosX := 1560 ;
t2w8.PosY := 1770 ;
t2w1.Health := 250 ;
t2w2.Health := 500 ;
t2w3.Health := 750 ;
t2w4.Health := 1000 ;
t2w5.Health := 250 ;
t2w6.Health := 500 ;
t2w7.Health := 750 ;
t2w8.Health := 1000 ;
t3w1.PosX := 1510 ;
t3w1.PosY := 1355 ;
t3w2.PosX := 1650 ;
t3w2.PosY := 1350 ;
t3w3.PosX := 1820 ;
t3w3.PosY := 1315 ;
t3w4.PosX := 1880 ;
t3w4.PosY := 1315 ;
t3w5.PosX := 2030 ;
t3w5.PosY := 1350 ;
t3w6.PosX := 2030 ;
t3w6.PosY := 1130 ;
t3w7.PosX := 1560 ;
t3w7.PosY := 1130 ;
t3w8.PosX := 1500 ;
t3w8.PosY := 1130 ;
t3w1.Health := 250 ;
t3w2.Health := 500 ;
t3w3.Health := 750 ;
t3w4.Health := 1000 ;
t3w5.Health := 250 ;
t3w6.Health := 500 ;
t3w7.Health := 750 ;
t3w8.Health := 1000 ;
end;
procedure OnTurn;
begin
if current_turn = 0 then
begin
MakeMine(1263,6680);
MakeMine(1263,6555);
MakeMine(1423,6680);
MakeMine(1423,6555);
MakeMine(1394,3968);
MakeMine(1460,3968);
MakeMine(1425,3935);
MakeMine(1587,2660);
MakeMine(1618,2660);
MakeMine(1652,2660);
MakeMine(1683,2660);
MakeMine(1714,2660);
MakeBarrel(1790,7440);
MakeBarrel(1790,7480);
MakeBarrel(1790,7520);
MakeBarrel(1790,7560);
MakeBarrel(1790,7600);
MakeBarrel(1470,2705);
MakeBarrel(1821,2721);
MakeBarrel(1376,2368);
MakeBarrel(1506,2368);
MakeBarrel(1634,2368);
MakeBarrel(1762,2368);
MakeBarrel(1631,368);
SetWeaponNum(1,1,1,-1,false);
SetWeaponNum(1,3,1,30,false);
SetWeaponNum(1,6,1,-1,false);
SetWeaponNum(1,7,1,30,false);
SetWeaponNum(1,11,1,-1,false);
SetWeaponNum(1,12,1,-1,false);
SetWeaponNum(1,13,1,27,false);
SetWeaponNum(1,14,1,10,false);
SetWeaponNum(1,15,1,25,false);
SetWeaponNum(1,16,1,-1,false);
SetWeaponNum(1,17,1,-1,false);
SetWeaponNum(1,21,1,15,false);
SetWeaponNum(1,22,1,20,false);
SetWeaponNum(1,23,1,12,false);
SetWeaponNum(1,24,1,12,false);
SetWeaponNum(1,35,1,10,false);
SetWeaponNum(1,37,1,-1,false);
SetWeaponNum(1,38,1,-1,false);
SetWeaponNum(1,39,1,-1,false);
SetWeaponNum(1,47,1,20,false);
SetWeaponNum(1,52,1,25,false);
SetWeaponNum(2,1,1,-1,false);
SetWeaponNum(2,7,1,30,false);
SetWeaponNum(2,12,1,-1,false);
SetWeaponNum(2,15,1,25,false);
SetWeaponNum(2,16,1,-1,false);
SetWeaponNum(2,22,1,20,false);
SetWeaponNum(2,38,1,-1,false);
SetWeaponNum(2,62,1,-1,false);
SetWeaponNum(3,6,1,-1,false);
SetWeaponNum(3,3,1,30,false);
SetWeaponNum(3,11,1,-1,false);
SetWeaponNum(3,13,1,27,false);
SetWeaponNum(3,17,1,-1,false);
SetWeaponNum(3,21,1,15,false);
SetWeaponNum(3,39,1,-1,false);
SetWeaponNum(3,62,1,-1,false);
current_turn := 1;
end;
case current_turn of
1: ShowMessageOnTop(23,'Possible threat spotted!'); //doesn't seem to be working
2: ShowMessageOnTop(23,'Unidentified worms approaching!');
3: ShowMessageOnTop(23,'Their weaponry is bigger than ours.');
4: ShowMessageOnTop(23,'Be careful!');
5: ShowMessageOnTop(23,'End of transmission.');
end;
if current_turn < 6 then
current_turn := current_turn+1
end;
procedure Frame;
begin
end;
function OnFire : boolean;
begin
Result := True;
end;
procedure OnCrate;
begin
end;
Thanks!
I do have really basic knowledge of Lua, but I don't think I have enough knowledge of C to be useful for anything. I mean, I would probably understand the overall structure of the code since it bears some resemblance to 'Game Maker Language', which I'm quite fluent at and have used for years. I didn't really have any experience of Pascal beforehand, though I managed to come up with this script just by taking a look at the ones that come with PX.