Project X Forums



It is currently Thu Mar 28, 2024 3:22 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: making mines and barrels.
PostPosted: Wed Jun 23, 2010 8:56 am 
Offline

Joined: Fri May 28, 2010 1:05 pm
Posts: 11
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: making mines and barrels.
PostPosted: Wed Jun 23, 2010 10:35 am 
Offline
User avatar

Joined: Mon Jun 21, 2010 2:10 pm
Posts: 43
Well you also don't check if the objects is placed correctly in air and no inside terrain... I have the same question.


Top
 Profile  
Reply with quote  
 Post subject: Re: making mines and barrels.
PostPosted: Wed Jun 23, 2010 10:43 am 
Offline

Joined: Fri May 28, 2010 1:05 pm
Posts: 11
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: making mines and barrels.
PostPosted: Wed Jun 23, 2010 11:12 am 
Offline
User avatar

Joined: Mon Jun 21, 2010 2:10 pm
Posts: 43
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Skin by Lucas Kane