[Behavior] jj_Weapon

Post your completed addons to share with the community

Post » Mon Sep 12, 2016 5:57 am

Hi @aznmonkeyboy @zchggf and @sachos345

I solved some of your issues in this modified version of jj_weapon. Here are the new things:

  • Support for multiple instances of the same weapon. In the original version it didn’t pick the right instance when shooting, so all bullets came from the same weapon
  • It triggers the On Created event after spawning bullets.
  • Added support to modify the stock size from event sheets.

https://github.com/JeyDotC/JeyDotc-C2-E ... /releases/
Last edited by JeyDotC on Thu May 25, 2017 11:08 pm, edited 1 time in total.
Image
B
35
S
9
G
1
Posts: 10
Reputation: 2,399

Post » Tue Nov 15, 2016 12:51 am

Is there a tutorial on how to use this? Like an inventory System Or Something like

(Top Down)

I have 3 Weapons in game.

The player starts out with one weapon. and then when the player collects the second weapon, the player can scroll between the 2 weapons. then the player picks up the third weapon and now the player can scroll between all 3.



Anyway to do something like that with this plugin?
B
25
S
8
Posts: 35
Reputation: 1,649

Post » Tue Nov 15, 2016 2:03 am

Hi @datiel12, I also tried to do that some time ago, after some experimentation, I figured out how to do that with some arrays and a single weapon object type with several animations.

You can find a full example of that buying my game template :D (https://www.scirra.com/store/royalty-fr ... plate-2942).

But I'll give you some tips here:

  • Have just one weapon object type. With its jj_Weapon behavior.
  • Make it have an animation for each weapon kind.
  • Have a bi-dimensional array with the statistics of all weapons. Where first axis is the weapon index and second axis are weapons values. Like this:
    Code: Select all
      |0:Animation|1:Shoot interval|2:Clip size|3:Stock size|4:Clip|5:Stock|6:Reload time
    0 | Pistol    |             300|         12|         128|     0|      0|         1800
    1 | Magnum    |             400|          6|          30|     0|      0|         4000
    ....
  • Have a second uni-dimensional array with the weapons the player has. It shall contain just the weapon indexes. It will be empty at the beginning.
  • Give the player a CurrentWeapon instance variable.
  • Have a function for each weapon type which sole purpose is to set the Bullet instance for the weapon.

Those are the ingredients, I'll be giving the recipe in a next post (I have to go to my job now).

Hope this help you point to the right direction :)

datiel12 wrote:Is there a tutorial on how to use this? Like an inventory System Or Something like

(Top Down)

I have 3 Weapons in game.

The player starts out with one weapon. and then when the player collects the second weapon, the player can scroll between the 2 weapons. then the player picks up the third weapon and now the player can scroll between all 3.



Anyway to do something like that with this plugin?
Image
B
35
S
9
G
1
Posts: 10
Reputation: 2,399

Post » Mon Dec 12, 2016 11:31 pm

JeyDotC wrote:Hi @datiel12, I also tried to do that some time ago, after some experimentation, I figured out how to do that with some arrays and a single weapon object type with several animations.

You can find a full example of that buying my game template :D (https://www.scirra.com/store/royalty-fr ... plate-2942).

But I'll give you some tips here:

  • Have just one weapon object type. With its jj_Weapon behavior.
  • Make it have an animation for each weapon kind.
  • Have a bi-dimensional array with the statistics of all weapons. Where first axis is the weapon index and second axis are weapons values. Like this:
    Code: Select all
      |0:Animation|1:Shoot interval|2:Clip size|3:Stock size|4:Clip|5:Stock|6:Reload time
    0 | Pistol    |             300|         12|         128|     0|      0|         1800
    1 | Magnum    |             400|          6|          30|     0|      0|         4000
    ....
  • Have a second uni-dimensional array with the weapons the player has. It shall contain just the weapon indexes. It will be empty at the beginning.
  • Give the player a CurrentWeapon instance variable.
  • Have a function for each weapon type which sole purpose is to set the Bullet instance for the weapon.

Those are the ingredients, I'll be giving the recipe in a next post (I have to go to my job now).

Hope this help you point to the right direction :)

datiel12 wrote:Is there a tutorial on how to use this? Like an inventory System Or Something like

(Top Down)

I have 3 Weapons in game.

The player starts out with one weapon. and then when the player collects the second weapon, the player can scroll between the 2 weapons. then the player picks up the third weapon and now the player can scroll between all 3.



Anyway to do something like that with this plugin?

Hey, Thanks man! just wating for that second recipe of yours :D
B
25
S
8
Posts: 35
Reputation: 1,649

Post » Tue May 16, 2017 1:30 am

@JeyDotC can you reupload the this modded behavior please ?
B
8
Posts: 9
Reputation: 318

Post » Fri May 19, 2017 5:17 am

giffary19 wrote:@JeyDotC can you reupload the this modded behavior please ?


Sure, here it is: https://github.com/JeyDotC/JeyDotc-C2-E ... /releases/
Last edited by JeyDotC on Thu May 25, 2017 10:43 pm, edited 1 time in total.
Image
B
35
S
9
G
1
Posts: 10
Reputation: 2,399

Post » Thu May 25, 2017 10:36 pm

Hey guys, I've been making some changes to the jj_Weapon behavior. Now I feel like the de-facto maintainer of this awesome extension :p

I took the audacity to create a Github repository where I'll be uploading any new changes and releases of this and other behaviors I work on. You can download the latest version of everything here.

And you're free to contribute by forking the repo

The improvements in this version are:

1. Support for multiple instances of the same weapon. In the original version it didn’t pick the right instance when shooting, so all bullets came from the same weapon.
2. It triggers the on created event after spawning bullets.
3. Added support to modify the stock size from event sheets.
4. *NEW* It can save its state when required (implemented 'saveToJson' and 'loadFromJson' methods) this is very important to persist the state of the weapons.

DOWNLOAD | Contribute

IMPORTANT NOTE:

This jj_Weapon is a derived work from @JohnJ and I'll keep recognizing him as the original author of the extension.
Image
B
35
S
9
G
1
Posts: 10
Reputation: 2,399

Previous

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest