playMaker

Author Topic: Creating arrays: Weapon/club selection  (Read 5074 times)

tim.holman

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 49
Creating arrays: Weapon/club selection
« on: September 16, 2011, 04:14:14 PM »
I'm trying to allow the player to scroll through a list of golf clubs (Driver, Iron, Putter, etc.) using the mouse scroll wheel. So far, I've set up an integer variable called "Club Number" and told it to add one when the scroll wheel goes forward, or subtract one when it goes backwards. My question is, how can I associate each club with a specific integer (For example: Driver = 0, 3 Wood = 1,.....Putter = 12). Is there a way to set up an array? My initial thought was to have the player scroll through the array, then left click to select, then go to a different state to set everything up for that club (gui image displayed, amount of force to be added, etc.)

Maybe I'm not on the right track here... does anybody see a better way to do something like this? Any help would be greatly appreciated. Thank you!!!

Satrio

  • Junior Playmaker
  • **
  • Posts: 67
Re: Creating arrays: Weapon/club selection
« Reply #1 on: September 17, 2011, 11:45:26 AM »
use a "switch int" node to setup the various club choices.
each "switch" number triggers a certain event. Then you just fiddle with the variable.

Maybe in your "scoremanager" you put variables like curr_club_name,curr_club_min_dmg,curr_club_max_dmg,
curr_club_weight,curr_club_condition etc. to represent the club you are using at the moment.

Then with the switch you set new values for those variables according to each "club event" in the switch.
workflow tip: make sure you set all the needed variables in one statefirst, then copy it to create the different types.

sometimes I use a "wait" action with zero time and change its name as a "rem statement" in my actionspanel as a header to groups of actions that stick togeather. I think it is better than changing names on each action..as usually I want to see the name of the action to know what it is/does when collapsed.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Creating arrays: Weapon/club selection
« Reply #2 on: September 19, 2011, 02:17:51 AM »
Hi,
 
 I am currently working on a an array ( arraylist and hashtable) system that works with playmaker with all the required actions to set up, and work with them right within playmaker.

 Get in touch with me if you want to have access to the beta.

Bye,

 Jean

 

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Creating arrays: Weapon/club selection
« Reply #3 on: October 05, 2011, 04:59:23 PM »
Hi there... i know this is an old thread but i would like to know how you've tackled the mousewheel selection system since the one i've tried keeps returning a possible infinite loop and crashes the FSM i've got them on, stopping them in their tracks.

it's basically the same idea as yours but only six weapons so far to cycle through. here's hoping you can help me crack this.

tim.holman

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 49
Re: Creating arrays: Weapon/club selection
« Reply #4 on: October 05, 2011, 06:28:08 PM »
May not be the best way to do it, but here's what I did:

-Setup a float variable for the value of the scroll wheel
-Use "Get Axis" to get the value of the "Scroll Wheel" (referenced in the input manager)
-Do a float compare for the scroll wheel value. If less than 0, send to scroll down state, if more than 0, send to scroll up state
-Setup an int variable for "WeaponNumber." In the scroll up state, add one. In the scroll down state, subtract one.
-In both the scroll up state and scroll down state, do an int compare for all weapons. (i.e. If int = 1, send to weapon1 state, if int = 2, send to weapon 2 state.) You'll also need to clamp (IntClamp) your "WeaponNumber" variable to a set range (which is the total number of weapons you have.) Finally, you'll need a transition for each weapon.
-In the weapon selected state, setup everything for the specified weapon (Damage, range, GUI, etc.) Then proceed to send an event to the original state, so that you can cycle through over and over again.

That's the basis of what I have setup. If you have any questions, let me know.