Author Topic: Weapon Cycle q's  (Read 6304 times)

Superjeep3

  • Guest
Weapon Cycle q's
« on: 2005-07-19, 07:52:56 AM »
Heya all, I have a little question if anyone could help me out.  I am currently in the beginning stages of making a game with the kit, and I have a question about the ability to cycle through weapons using <> or something, instead of 4 keys for 4 weapons.  Is this possible without script?  The reason I ask is because I have no idea how to script.  Thanx for any help yopu can give.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Weapon Cycle q's
« Reply #1 on: 2005-07-19, 09:32:43 AM »
Yes, it is possible, you would have to define < as, for example, button 1 and > as button 2.

Then, depending on how you want the weapons to work, the following is different.  If there is no visible difference in the player sprite when changing weapons (only difference is in bullets that the player fires), then all you have to do is have two special functions.  One that adds 1 to an inventory that keeps track of what weapon you're on, and one that subtracts one from the same inventory.  Setting the "Reset to Opposite Limit" option would be a nice way to not limit how far you can go.

Then, when shooting, just check to see how many of that inventory you have, and accordingly create the proper bullet sprite.  This may be a little difficult, because the way inventory works is that if you have AT LEAST 1, then it will activate a function that requires 1 of said inventory.  However, there are several ways to get around this.

One is to have each different type of bullet be defined as a class "Bullet" and a different template, then, have a collision defenition between two bullets that activates special function COL_<A_Template><B_Template>*.  Then create special functions called COL_Bullet1Bullet2 and COL_Bullet2Bullet3 and COL_Bullet1Bullet3 etc. (if the names of your bullet templates are Bullet1 Bullet2 Bullet3 etc.) and they would remove all of the first type of bullet from the map. (i.e. COL_Bullet1Bullet2 would remove all of Bullet1).

Another way is to have each bullet a different class, and then just define each collision between the bullets (Collision between Class Bullet1 and class Bullet2), then just destroy Sprite A.

Yet another way is to have many many more special functions and inventory items.  Pressing ">" would instead have 4 special functions associated with it.  Each would require 1 inventory of a different type.  Here, let me just show you:

Activation Parameters: Pressing Button 1
Requires (1) Weapon1Inv (Use it up)
Action: Add 1 to Weapon2Inv

Activation Parameters: Pressing Button 1
Requires (1) Weapon2Inv (Use it up)
Action: Add 1 to Weapon3Inv

Activation Parameters: Pressing Button 1
Requires (1) Weapon3Inv (Use it up)
Action: Add 1 to Weapon4Inv

Activation Parameters: Pressing Button 1
Requires (1) Weapon4Inv (Use it up)
Action: Add 1 to Weapon1Inv

Activation Parameters: Pressing Button 2
Requires (1) Weapon4Inv (Use it up)
Action: Add 1 to Weapon3Inv

Activation Parameters: Pressing Button 2
Requires (1) Weapon3Inv (Use it up)
Action: Add 1 to Weapon2Inv

Activation Parameters: Pressing Button 2
Requires (1) Weapon2Inv (Use it up)
Action: Add 1 to Weapon1Inv

Activation Parameters: Pressing Button 2
Requires (1) Weapon1Inv (Use it up)
Action: Add 1 to Weapon4Inv

Then when firing, each function would just check for 1 inventory of whatever type and create the propper bullet.

However, this would be immensely easier with scripting.  There are many resources to help you learn how.  I really, really reccommend you try learning just a few beginning scripts.  The help that comes with SGDK, the sample scripts on sourceforge, and the people on this forum will help if you get stuck or need help.
Edward Dassmesser

superjeep3

  • Guest
Weapon Cycle q's
« Reply #2 on: 2005-07-19, 10:17:18 AM »
The different weapons would have different looks.  Would that make it harder or could you do something where the function would also change the sprite for the char., as they all have the same sprite, but with different weapons.  I mean to say that the char. looks the same with each weapon, just that the weapon looks different.  Thanx for the help.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Weapon Cycle q's
« Reply #3 on: 2005-07-19, 06:45:43 PM »
That's also possible, but it will be a little harder, of course.  When activating each of those functions, it will instead activate a series of special functions, one which does what it used to (add 1 to proper inventory) and another which switches the sprite.
Edward Dassmesser

Superjeep3

  • Guest
Weapon Cycle q's
« Reply #4 on: 2005-07-19, 07:10:37 PM »
Ok, great, at least now I know it can be done, now I just have to do it (figure out how...heh).  Thanx so much for your help.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Weapon Cycle q's
« Reply #5 on: 2005-07-20, 06:02:53 AM »
In case you change your mind about editing script, I bet it would have been shorter to show you what script to edit (based on the shooting wizard) to accomplish this ::).  Just because you don't know scripting doesn't mean you can't use it.  We can help you with scripting just as easily (in this case, maybe more easily) than with "non-scripting" :).

heh "Non-scripting: The real challenge" ;)

Superjeep3

  • Guest
weapon cycle q's
« Reply #6 on: 2005-07-24, 02:13:02 PM »
ok, I will look at how hard it will be to script, hopefully not to bad.  Thanx again for the help.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Weapon Cycle q's
« Reply #7 on: 2005-07-26, 05:21:41 AM »
Well, if you're willing to script, just let us know and we can probably give you the script, then all you have to to is copy and paste (and maybe change a couple words to match your project).