User Tag List

Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 34

Thread: Best way to make a weapon selection system tied to mouse wheel

  1. #1
    No Products Registered

    Join Date
    Jan 2014
    Location
    Indiana, USA
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Best way to make a weapon selection system tied to mouse wheel

    Ok, here's what I'm trying to accomplish. On mouse up and down, I want the next weapon or previous weapon to become available for use (this was actually easy to accomplish). I set up the weapons in numbered order (i.e. 1 = regular, 2 = spread, 3 = rapid) and moving the mouse wheel up or down would change the weapon selection counter +1 or -1, enabling the weapon for use.

    My issue now is what if one of the weapons wasn't available and I want to skip over it? Let's say 'spread' wasn't available for selection and I moused up from blaster. I want to skip over the unavailable '2' and go to the next available weapon which is '3'. If '2' and '3' weren't available, it should loop back to '1'.

    The only way I can think to accomplish this is in a referential database but that doesn't look possible in MMF2. How do others accomplish this? Thanks!

    --Jarred

  2. #2
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    944
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    What I'd do is compare the current weapon setting against a global value associated with each potential weapon.

    Example:

    If (mouse wheel is rotated down) and WHEELCOUNTER = 2 and SPREADGUN = 0 then WHEELCOUNTER = 3
    If (mouse wheel is rotated down) and WHEELCOUNTER = 3 and RAPIDGUN = 0 then WHEELCOUNTER = 4
    If (mouse wheel is rotated down) and WHEELCOUNTER = 4 and LASTPOSSIBLEGUN = 0 then WHEELCOUNTER = 1

    and etc.

    This way if you put these comparisons before the actual part that assigns the guy the gun, it will skip to the next available gun you possess, and if you get to the end of all the possible guns then it circles back to your regular gun that's always owned.

    This may not be the best way to handle it, but that's what I'd do.

  3. #3
    No Products Registered

    Join Date
    Jan 2014
    Location
    Indiana, USA
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know your solution would work Del, but I was hoping to avoid that

    There's got to be a way to do this where I can have an infinite number of weapons and don't have to account for every possible scenario where 1 isn't available.

  4. #4
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    944
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Beats me but I'm sure there's a way to do it.
    This place has loads of programming Gods, they just have to come down from the clouds and see this thread

  5. #5
    Clickteam Clickteam
    Jeff's Avatar
    Join Date
    Jun 2006
    Location
    Battle Ground Washington
    Posts
    11,825
    Mentioned
    8 Post(s)
    Tagged
    2 Thread(s)
    Idea: Should work but I didn't actually try it

    You would need to add your weapon data to a hidden list box
    As you scroll the wheel you select the next item in the list when it gets to the end of the items in the list box you jump back to the first item
    (Or last item in the list if your scrolling the other way)

    As you scroll you retrieve the data from the list box and parse it out to get the details of the selected line.

    I might go build a little example of this seems pretty cool.

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    ^^ what Jeff said

    or a good old array,
    where X index would be weapon type,
    Y0 value would be "available/not available"
    (Y1 if needed would be player no#)

    ...that and some nice fastlooping
    avoiding empty Y0's and jumping from >dimx to first valued Y0 line shouldn't be a problem!

  7. #7
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Jeff. Your method does sound really cool. I shall sit at the computer until your example shows up. he he.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  8. #8
    No Products Registered

    Join Date
    Jan 2014
    Location
    Indiana, USA
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks All. Now I feel dumb I didn't know arrays were an option (which makes perfect sense as a method). I was originally going to make my own array with nothing but variables but that was a disaster.

    I'm going to start putting this together but I could probably use some help with the fast looping syntax to make X++ where Y=0.

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    SoftWarewolf's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    941
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    it's actually very easy, you just need to store which way you are going.

    wheel-up: set scroll to 1, set weapon +1
    wheel-down: set scroll to 2, set weapon - 1

    current weapon unavailable, and scroll = 1: set weapon +1
    current weapon unavailable, and scroll = 2: set weapon -1

    current weapon available: change weapon.

    let's say you have 5 weapons
    if weapon = 0, set weapon 5
    if weapon = 6, set weapon 1

  10. #10
    No Products Registered

    Join Date
    Jan 2014
    Location
    Indiana, USA
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SoftWarewolf, do you have an example of how to insert the 'current weapon unavailalbe' in to the event? I keep getting a syntax error with the 'Loops - on each object'

Page 1 of 4 1 2 3 ... LastLast

Similar Threads

  1. [Suggestion] Mouse Wheel & Middle Mouse
    By izac in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 10th May 2009, 12:39 PM
  2. Mouse Wheel Grief
    By kungsangun in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 8th April 2008, 07:34 PM
  3. Mouse Wheel?
    By workshop2 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 9th December 2007, 04:11 AM
  4. Help with Mouse Wheel in Build 244
    By Jaeu in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 7th April 2007, 08:19 PM
  5. Mouse Wheel - can we access it yet?
    By Dines in forum Extension Development
    Replies: 5
    Last Post: 2nd November 2006, 07:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •