Page 1 of 1

Create Random world weapons

Posted: Thu Oct 12, 2017 2:55 am
by The Noah
I was wondering if someone could give me some code to make the fallowing plug-in:
Creates random world weapons at random positions and random rotations. After a once the shot the world weapon(s) and the shot reloads the world weapon(s) change to another random position and rotation. Have variables (set through the config) that would set the world size (or if that can be detected that would be great), how often shots are fired, and what type of shots are fired (e.g. SW, US, GM, etc.)

Please PM me with the code and not post it.

Thanks,
The Noah

Re: Create Random world weapons

Posted: Thu Oct 12, 2017 3:52 am
by allejo
Search the API and learn for yourself: https://wiki.bzflag.org/Functions_(API); there's a section for "world weapon management." As for world size, it's a BZDB variable; there's a function for that too. There's also the API header file which is the authoritative source until the official documentation is done: https://github.com/BZFlag-Dev/bzflag/bl ... /bzfsAPI.h

You'd get a better response from me, and possibly others, if you make an attempt first on what code you've tried and ask for feedback from there. I find saying, "hey write this code for me but send it to me privately because I don't want others to see it or learn from it" to be just rude.

If others just write code for you, it'll be a disservice to you since you'll never learn.

Re: Create Random world weapons

Posted: Thu Oct 12, 2017 2:06 pm
by The Noah
There are a few things I would like to say.
1. I searched the API, and found the world weapon management, but I don't know how to use it.
2. I don't know how I would control multiple world weapons, and keep them separate.
3. I thought of making some code first, but knew I wouldn't get anything other then the frame.
4.
I find saying, "hey write this code for me but send it to me privately because I don't want others to see it or learn from it" to be just rude
I'm sorry you find it rude, and it kinda is, but first, someone requested me making a plug-in for them, and said for it to be private. And seconds, since I didn't know the main part (what makes it do what it does), I ask on the forums.

I'm sorry for being rude,
The Noah

Re: Create Random world weapons

Posted: Thu Oct 12, 2017 2:11 pm
by JeffM
The world weapon api is very simple, call a function, weapon is triggered, end of story. All world weapons art triggered separately, so your comment of how to “keep them seperate” makes no sense. What are you trying to do that is so are for you?

Calling functions is basic programming....

Re: Create Random world weapons

Posted: Thu Oct 12, 2017 4:31 pm
by Zehra
From my understanding of plug-ins:

A plug-in will call a function when an event happens.
The logic and functions are all up to whoever decides to write the plug-in.

A list of some plug-ins which use world weapons which have been released on the forums.
(These plug-ins are not part of the official distribution)

* Turret Plugin Release
Triggers world weapons based on players.
* Grenade flag release - as seen on Apocalypse
Fires a shockwave based on timing and where a shot is heading.
* SnakeShots
World weapons are used to "fake/make" extra shots for a player.
* CustomFlags
World weapons are used to "fake/make" extra shots for a player.
* UselessMine - Create mines with the Useless flag (2.x)
World weapons are fired when players drive on zones set by players.
* ProximityMine - What UselessMine should have been (2.x)
World weapons are fired when players reach zones set by players.
* UselessMine - Create Mines with the Useless Flag Once Again!
A version of the useless mines plug-in for 2.4.x.

A list of plug-ins from the official distribution which use world weapons are listed below.(At the time of writing from this post)

* ShockwaveDeath
* wwzones

Hopefully these plug-ins can help give an idea of what can be done with world weapons and to also help assist in writing a plug-in.

-Zehra