playMaker

Author Topic: Bulk changing of values of global variables  (Read 1561 times)

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Bulk changing of values of global variables
« on: September 16, 2016, 03:00:15 PM »
Hi guys,

i made a multiple weapon/weapon heating/damage/bullet system for my game and now i have to make a power-up system which will have double fire rate, double damage and no heating pickups.

Now, i arranged my weapon system like this:

Every weapon has its own prefab (5 weapon levels, 5 different fire rates and 5 patterns). Every weapon level has its own bullet prefab. Weapon X level 1 shoots bullets X level 1, fire rate X, pattern X, weapon X level 2 shoots bullets X level 2, fire rate X, pattern X, etc. You get the idea.

Every bullet prefab has its own heat variable which adds up to the main heat counter (weapon shuts down when it overheats) and damage points variable.

Regarding power-ups, i'm having difficulties of making a concept that would be easiest to work and maintain.

For now, the easiest solution for me with so many prefabs and variables is to simply multiply all the global variables (all are integers) when i pickup double damage or double fire rate power-ups and to seat heat variables of bullets to zero when i pickup the no heating pickup, and revert them back after the timer goes off.

Any ideas on how to do this? Is ia possible to change variables by scripting? I'm also open to other ideas on solving the problem if you have them :D
« Last Edit: September 17, 2016, 10:01:50 AM by krmko »
Available for Playmaker work

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Bulk changing of values of global variables
« Reply #1 on: September 18, 2016, 04:59:56 AM »
Use array/arraylist. Set all the data in the array and then the prefab gets the data from that list.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Bulk changing of values of global variables
« Reply #2 on: September 22, 2016, 08:56:27 AM »
How can i do that? I know how to add the item to the array, but how can i batch edit the array item values?
Available for Playmaker work