Project X Forums
http://px.worms2d.info/forum/

making mines and barrels.
http://px.worms2d.info/forum/viewtopic.php?f=5&t=78
Page 1 of 1

Author:  anoamas321 [ Wed Jun 23, 2010 8:56 am ]
Post subject:  making mines and barrels.

i just made a script to make a mine or barrel ecah turn in a random postion.

Code:
//makes a mine every  2 turns
var
turns : integer;
procedure InitHooks;
begin
  RegisterHook('OnTurnBegin', ON_TURN_BEGIN);
  RegisterHook('OnInIt', ON_INIT)
end;
procedure OnInIt;
begin
turns := 0
end;
procedure OnTurnBegin;
var
  newmine : TWPobj;
begin
  if turns = 2 then begin
    newmine := MakeMine(GetSyncRandom(1920, 10),GetSyncRandom(696, 10));
    turns := 0;
  end;
  turns := turns + 1;
end;


making barrels is pretty similer but with barrels instead of mines,and turns starting at 1 rather then 0 so that they barrels and mines drop toghter.

one thing i wanted to do as check the postion of the mine before it was droped to ensure i was not on top of another worm, however there does not seem to be a way of selecting worms in order(no function to select worm by number/team number that i can find) so i cant do this check. if there is a way can some please let me know thanks.

Author:  Pac-Man [ Wed Jun 23, 2010 10:35 am ]
Post subject:  Re: making mines and barrels.

Well you also don't check if the objects is placed correctly in air and no inside terrain... I have the same question.

Author:  anoamas321 [ Wed Jun 23, 2010 10:43 am ]
Post subject:  Re: making mines and barrels.

yes you are right, but that is not a problem, if they end up being place in the terrain they just fall until the come out of the terrain. then they the objects keep falling until they hit terrain again or water.

Author:  Pac-Man [ Wed Jun 23, 2010 11:12 am ]
Post subject:  Re: making mines and barrels.

Yes, that's how Worms checks for collisions. Even if you see terrain, it doesn't mean objects get stuck in it. Only if they hit borders of the landscape in the direction they are moving, they collide. This trick is greatly abused in WWP: http://worms2d.info/Girdering_an_occupied_location

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/