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

Restricting Girder placement around worm's radius
http://px.worms2d.info/forum/viewtopic.php?f=13&t=2111
Page 1 of 1

Author:  -raffie- [ Thu Oct 05, 2017 5:16 pm ]
Post subject:  Restricting Girder placement around worm's radius

This could really help out in many different schemes (like Holy War) in making it a lot harder to block worms with the girder.
Probably easy to do but I have no idea where to start, any help is eternally appreciated :D

Author:  worminater [ Fri Oct 06, 2017 2:23 pm ]
Post subject:  Re: Restricting Girder placement around worm's radius

I'd be interested in this as well for my scheme. Sorry I can't help but you aren't alone in wanting this.

Author:  rafa``2 [ Sun Oct 08, 2017 5:02 am ]
Post subject:  Re: Restricting Girder placement around worm's radius

Saludos,
I hope this helps.

Code:
override void CTurnGame::Message(CObject* sender,EMType Type,int MSize,CMessageData* MData)
{
     super;
     //rafa``2
     if(int(Type) == 17)
   {
             if((GS->Tick % 2) == 0)
             {
                       
                        CWorm * cw = GetCurrentWorm();
                        if(cw == NullObj || cw->CurWeapon == NullObj) return;
                       
                        if(cw->CurWeapon->CheckName("Girder") || cw->CurWeapon->CheckName("Girder Starter-Pack"))
                        {
                             for (local i = 1; i < Env->Objs.Count; i++)
                             {
                                  local obj = Env->Objs.Objs[i];
                             
                                  if(obj == NullObj) continue;
                                  if((obj is CWorm) == false) continue;
                             
                                  CWorm * w = CWorm(obj);
                             
                                  if(w == NullObj) continue;                             

               local dx = w->PosX - GS->landSelectX; 
               local dy = w->PosY - GS->landSelectY;
               local dist = sqrt(dx*dx + dy*dy);

                                   if(dist <= 100)
               {
                    //cw->CanFire = false;
                    cw->WeaponN = 0;
                  
                                        if((GS->Tick % 4) == 0)
                                             cw->PlayLocalSound(120, 3, 1, 1);
                                        return;
               }         
             }
             //cw->CanFire = true;
             cw->WeaponN = cw->CurWeapon->GetWeaponIndex();
                        }
               }
}

Author:  -raffie- [ Sun Oct 08, 2017 8:43 am ]
Post subject:  Re: Restricting Girder placement around worm's radius

rafa``2 to the rescue! PogChamp

I'll use this in my scheme and test it tonight! Thank you so much!

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