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

Highlander mod: crates
http://px.worms2d.info/forum/viewtopic.php?f=15&t=2054
Page 1 of 1

Author:  -raffie- [ Sat Oct 03, 2015 3:40 pm ]
Post subject:  Highlander mod: crates

Would it be possible to get the weapon from a picked up crate into the script so that it works in for example a Highlander?

I've studied the Highlander code and understand how it works (1 huge array for all worms' weapons in the game, a certain register within the array is loaded for each specific worm). So if someone might help me with how to get the crate's weapon - when it is picked, into the code (if at all possible), I think I could go from there and adapt the Highlander script.

Thanks in advance for any help.

Author:  rafa``2 [ Sun Mar 20, 2016 5:38 am ]
Post subject:  Re: Highlander mod: crates

-raffie- wrote:
Would it be possible to get the weapon from a picked up crate into the script so that it works in for example a Highlander?

I've studied the Highlander code and understand how it works (1 huge array for all worms' weapons in the game, a certain register within the array is loaded for each specific worm). So if someone might help me with how to get the crate's weapon - when it is picked, into the code (if at all possible), I think I could go from there and adapt the Highlander script.

Thanks in advance for any help.




easiest way I've found out


Code:
override void CCrate::Free(bool FreeMem)
{
    if((desc.type == CT_WEAPON || desc.type == CT_MWEAPON) && desc.weapon > 100)
    {
         local wep = GS->GetWeaponByIndex(1, desc.weapon-100);
         
         if(wep != NullObj)
         {
              local wepindex = wep->GetWeaponIndex();    //index of picked up weapon
         }
    }
   
    super;
}

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