Page 1 of 1

TeamWeapons - just started

Posted: Sat Jun 06, 2009 8:26 am
by Enigma
Requirements: Development BZFlag from svn at revision 19878.

This is a simple plug-in I started last night. The plug-in changes the shot types for specific teams. I believe at one point there was a plug-in that assigned flags to teams, where one team would always get laser, another would get guided missile, and so on. In contrast, the TeamWeapons plug-in allows you to pick up a wings flag or a cloaking flag and still have the shot type assigned to a team.

It is not finished. I posted the source code if anyone want to mess around with it.

**edit - The download is in a lower post. **

Re: TeamWeapons - just started

Posted: Sat Jun 06, 2009 3:01 pm
by clarahobbs
Oh cool! That sounds amazing. I can imagine someone having cloaking/laser and never killing himself. And those graphics - I had no idea that BZFlag 3 had such beautiful laser beams!

Re: TeamWeapons - just started

Posted: Sat Jun 06, 2009 4:50 pm
by Bambino
Ahem, is there Guided Geno? :P

But really, that is a cool plugin. "Shot Switcher" <-- Name?

Re: TeamWeapons - just started

Posted: Mon Jun 29, 2009 11:12 pm
by mrapple
aww snap! me and flying_popcorn (i think it was him) were talking about releasing a pplugin and map just like that in 3.0!!!!! darnet :(

Re: TeamWeapons - just started

Posted: Thu Jul 09, 2009 12:18 pm
by die muszx double
Lol, you could have CL and ST :D

Re: TeamWeapons - just started

Posted: Thu Jul 09, 2009 8:41 pm
by Anxuiz
die muszx double wrote:Lol, you could have CL and ST :D
No, actually. The API only supports the changing of shot types, not flag effects. And the API can only set the shot type to one shot type (so no guided geno or laser).

So for example you could have these shot & flag combos:
  • GM + WG
  • L + WG (that'd be interesting :shock:)
  • CL + WG
  • CL + L
  • G + WG
  • G + ST
  • etc.
But you couldn't have these:
  • G + L
  • WG + ST
  • L + GM
  • G + IB
  • etc.
Although I do believe that changing flag effects has been discussed before, but was never implemented ;)

- Yassen

Re: TeamWeapons - just started

Posted: Fri Jul 10, 2009 8:50 am
by Enigma
Actually the there isn't a genocide shot type:

Code: Select all

typedef enum {
  eNoShot = 0,
  eStandardShot,
  eGMShot,
  eLaserShot,
  eThiefShot,
  eSuperShot,
  ePhantomShot,
  eShockWaveShot,
  eRicoShot,
  eMachineGunShot,
  eInvisibleShot,
  eCloakedShot,
  eRapidFireShot,
  eLastShotType
} bz_eShotType;

Re: TeamWeapons - just started

Posted: Thu Jul 16, 2009 1:38 am
by Enigma
This is the current source code right now. I added a command to change the shot types while the plug-in is loaded.

The command works as follows:

Code: Select all

/tw <action> <param_1> <param_2> ... <param_N>
There are two actions as of posting this: set and info. The info action takes no parameters, and set requires two parameters. The set action has the following form:

Code: Select all

/tw set <team> <flag_code>
where

Code: Select all

team := red | green | blue | purple | rogue | hunter | rabbit;
and

Code: Select all

flag_code := standard | GM | L | TH | SB | PZ | SW | R | MG | IB | CS | F; 
For instance, to set the GM shot type for the red team, you would use

Code: Select all

/tw set red GM
Note that it is case sensitive.

The code is released under the MIT license. It is very non-restrictive, and I'm not too worried what people do with the code. Have fun.

Re: TeamWeapons - just started

Posted: Thu Jul 16, 2009 1:44 am
by Enigma
I should also add, the shot types will not change until a flag is grabbed. Without a flag, everyone has the standard shot type. If someone is holding a flag while the shot type is changed, the changes will not take effect until the current flag is dropped and a new flag is grabbed.

Re: TeamWeapons - just started

Posted: Thu Jul 16, 2009 4:17 pm
by clarahobbs
Oh wow, this sounds absolutely amazing. Changing the shot type for the rabbit team could be really useful, as it could actually give people some incentive to become rabbit. Would it be possible to make it change shot type for people in a certain area of a map specified in the .bzw file?

Re: TeamWeapons - just started

Posted: Thu Jul 16, 2009 5:27 pm
by joevano
Ratfink wrote:Oh wow, this sounds absolutely amazing. Changing the shot type for the rabbit team could be really useful, as it could actually give people some incentive to become rabbit.
And being the only person to be able to score isn't enough incentive?

Re: TeamWeapons - just started

Posted: Thu Jul 16, 2009 11:44 pm
by Enigma
Ratfink wrote:Would it be possible to make it change shot type for people in a certain area of a map specified in the .bzw file?
Probably. It would require more code though. It would probably be better as a separate plug-in.

Re: TeamWeapons - just started

Posted: Sun Sep 06, 2009 1:40 pm
by mrapple
when you say that we must have revision 19878, do we actually need that revision?

Im pretty sure but im not positive, because when i compiled then loaded the plugin, it loaded fine and i could type /tw info, but it would not let me set shot types!

if we do need a specific revision, do you know if this is a bug and if so when you plan to fix it for the 3.0 release?

thanks enigma.

Re: TeamWeapons - just started

Posted: Sun Sep 06, 2009 5:27 pm
by blast
More than likely that would be a minimum revision that you need.

Re: TeamWeapons - just started

Posted: Sun Sep 06, 2009 6:25 pm
by Enigma
Blast is right. I meant it as the minimum revision. I'm not even sure if you would need that revision. It was the revision I tested the plug-in with, so it's more of a recommendation. Everyone should have a newer revision anyway.

What happened when you tried to set the shot types? If you type in the command wrong, you should get an error message. If you type it in correctly, you should get the message "Shot type set for ..."

Just in case you didn't see this...
Enigma wrote:I should also add, the shot types will not change until a flag is grabbed. Without a flag, everyone has the standard shot type. If someone is holding a flag while the shot type is changed, the changes will not take effect until the current flag is dropped and a new flag is grabbed.

Re: TeamWeapons - just started

Posted: Sun Sep 06, 2009 6:35 pm
by mrapple
Enigma wrote: What happened when you tried to set the shot types? If you type in the command wrong, you should get an error message. If you type it in correctly, you should get the message "Shot type set for ..."
i dont get that at all. it doesnt say command not recongized or anything. it just does nothing. so i type it and i get nothing, not even an error.
Enigma wrote: Just in case you didn't see this...
dont worry i saw that. i tried picking up neumerous flags that dont change shot types, ex: st, cl, mq, etc. nothing.

Re: TeamWeapons - just started

Posted: Fri Sep 18, 2009 12:56 am
by Enigma
Sorry about replying so late. I haven't been coming here lately. I'm going to compile it and test it, and I'll let you know what happens.

Re: TeamWeapons - just started

Posted: Tue Jun 29, 2010 12:59 am
by Enigma
I just tried it. It works for me. I don't know why it doesn't work for you.

Re: TeamWeapons - just started

Posted: Tue Jun 29, 2010 5:26 pm
by mrapple
I havent tried it in a while but Ill compile it later today and let you know the results.

Thanks for your response Enigma :)

Re: TeamWeapons - just started

Posted: Tue Jun 29, 2010 11:42 pm
by Enigma
I would have tested it sooner, but bzflag doesn't always build, but that is expected to happen. I had to rename the header TeamWeapons/include/EventHandler.h to get it to compile. The build system was getting it confused with bzflag/include/EventHandler.h for some reason.

Also, run "rm -rf *" in plugins/TeamWeapons/.libs before you build the plug-in.