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

CCrate:: grab crate from far away ()
http://px.worms2d.info/forum/viewtopic.php?f=15&t=2097
Page 1 of 1

Author:  Resurrection [ Sun Sep 25, 2016 12:00 am ]
Post subject:  CCrate:: grab crate from far away ()

Is there a way to make a crate be "grabbed" with code?
Only way that kind of works is delete the crate and then roll your own random weapon code with "AddWeapon();".
However i would like the scheme weapon crate chance% to be used. A good random weapon function would be fine also if someone has it.

Noticed the CCrate(obj)->desc.weapon .. amount .. etc. are all empty, i guess it randomizes after the crate is grabbed and then fills the values in after.
Found out that you can override CCrate::Free() to get the values but it is not useful for me since a worms need to touch it first.

Author:  Resurrection [ Sun Sep 25, 2016 4:18 pm ]
Post subject:  Re: CCrate:: grab crate from far away ()

There was a function GenerateContent(); inside CCrate that generated weapon to drop!
Had to store the found crate in a local CCrate* for some reason or else it didnt work.


Code:
           local wep = GS->GetWeaponByIndex(1, tmpCratep->desc.weapon-100);
           local wepindex = wep->GetWeaponIndex();
           
           GS->Info.AddWeapon(firstwormTeam,wepindex,tmpCratep->desc.amount);

Author:  Akropesgreox [ Sun Mar 04, 2018 2:28 pm ]
Post subject:  CCrate grab crate from far away

Hi

I have some VPSs in different data centers, and I would like to move them to one DC, is it possible, and how can I do that?

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