Page 1 of 1

OnCap function for worldWeapons-ServerShots

Posted: Thu May 17, 2018 8:31 pm
by Zehra
I'd like if there was a function for triggering onCap world weapons.
So it would be possible to introduce a few new modes and to also be able to trigger them when using altered or enhanced CTF modes.
(Triggering onCap with flags/kill streaks/points..etc..)

Sample base with onCap world weapon:

Code: Select all

base
 position 100 0 0
 rotation 0
 size 10 10 0
 color 1
 oncap SW
end
-Zehra

Re: OnCap function for worldWeapons-ServerShots

Posted: Thu May 17, 2018 9:34 pm
by JeffM
bz_triggerFlagCapture should already do that.

Re: OnCap function for worldWeapons-ServerShots

Posted: Fri May 18, 2018 3:24 am
by Zehra
I'm not sure if I'm missing something, so please correct me if I'm wrong, but I checked for 'bz_triggerFlagCapture' with Notepad++ on bzfsAPI.h from BZFlag version 2.4.10 and didn't find it.
I'm probably doing something wrong, so could a little bit of help be given?

-Zehra

Re: OnCap function for worldWeapons-ServerShots

Posted: Fri May 18, 2018 4:58 am
by JeffM
It may only be in 2.6

Re: OnCap function for worldWeapons-ServerShots

Posted: Fri May 18, 2018 5:00 am
by JeffM
No it’s in the current 2.4.x, always check the current code.

Re: OnCap function for worldWeapons-ServerShots

Posted: Fri May 18, 2018 10:32 pm
by Zehra
Thanks JeffM.

I'll be using the latest API from now on.

bzfsAPI.h

Code: Select all

// game type info
BZF_API bz_eGameType bz_getGameType ( void );
BZF_API bool bz_triggerFlagCapture(int playerID, bz_eTeamType teamCapping, bz_eTeamType teamCapped);
Note: 2.4.12 or above is required to run any plug-in with the bz_triggerFlagCapture function.
I still have to see if it triggers world weapons though.

-Zehra

Re: OnCap function for worldWeapons-ServerShots

Posted: Mon May 21, 2018 3:44 am
by allejo
bz_triggerFlagCapture calls the internal bzfs function which is used whenever a flag capture happens regularly, meaning a flag capture event is fired. The onCap world weapons listen to the flag capture event, so unless the current code is broken, it'll trigger the world weapons.

Keep in mind, this function will destroy all of the tanks and modify team scores as dictated. It won't *just* fire off onCap world weapons.

Re: OnCap function for worldWeapons-ServerShots

Posted: Mon May 21, 2018 3:54 am
by JeffM
Yeah it's intended to do ALL the capture things, in order to properly support custom capture conditions.