What if you could replace variables like objects in events?

  • Well.. I've been working on a weapon "upgrade" system. So I have a ton of variables... Pistol_Capacity, Pistol_Damage, Pistol_Speed, Pistol_RealoadTime... Then I have Shotgun_Capacity, etc... SMG_Capacity, etc, Rifle, Grenade Launcher, blah blah blah. I create an event sheet for upgrading all of the pistol attributes. Six jillion lines of code later Im done. Now I copy it. I have to go through each line - selecting each variable - and scrolling through the hundreds of variables to replace pistol_[...] with shotgun_[...]. Now if I could highlight the events, right click and select something like "replace variable" - Have one input box to select the variables present in the highlighted events - select the one I want to replace (say... pistol_damage) - and a second input box i can put in "shotgun_damage" - and presto. Do it for each variable and BAM saved myself an hour.

    It's just like replacing sprite. You make a set of events for "enemy1". You duplicate it, replace enemy1 with enemy2. Change a few things - health, movement, etc. It's a lot quicker then manually replacing each reference to enemy1 through out the events. Same as what I'm getting at with variables. Maybe there is a better method (for me at the moment) - using functions and parameters - and referencing parameters to variables? I don't know. Even then, when a single entity is making use of a bunch of variables (and when those variables are only used by this single entity/sprite) and you duplicate that entity and want it to make use of duplicates of the first entities variables I gotta go through and manually change every single variable for entity 2.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well.. I've been working on a weapon "upgrade" system. So I have a ton of variables... Pistol_Capacity, Pistol_Damage, Pistol_Speed, Pistol_RealoadTime... Then I have Shotgun_Capacity, etc... SMG_Capacity, etc, Rifle, Grenade Launcher, blah blah blah. I create an event sheet for upgrading all of the pistol attributes. Six jillion lines of code later Im done. Now I copy it. I have to go through each line - selecting each variable - and scrolling through the hundreds of variables to replace pistol_[...] with shotgun_[...]. Now if I could highlight the events, right click and select something like "replace variable" - Have one input box to select the variables present in the highlighted events - select the one I want to replace (say... pistol_damage) - and a second input box i can put in "shotgun_damage" - and presto. Do it for each variable and BAM saved myself an hour.

    look, if you have Pistol_damage and Shotgun_damage, you have to edit 2 variables, make just weapon_damage..

    When I was making a weapons system where it was possible to select different bullet and upgrade the weapons, I made like 25 variables for one sprite with 20 different animation, where all weapons are.

    for example, in your weapon: Pistol_Capacity, Pistol_Damage, Pistol_Speed, Pistol_RealoadTime...etc you made also variables for shotgun? or bazooka? etc... that will be crazy if you make all variable for all different weapons...you have to make a system like a "class"

    would be easier if you make all variable for all weapons, like: Capacity_weapon, damage_weapon, extra_damace , speed_rate, BullePerShot,reload_time, frame_velocity, reload_frame, type_of_bullet...bla bla

    and with this, I remember I made 4 different weapons in 4 minutes, like an uzi, shotgun, rifle shotgun and rocket rifle, just changing the same variable of the weapons.

    you can also saved the variables into an array, or where you want... and if I miss something, like if I want to add another strange weapon, just add another variable or a boolean for that kind of weapon.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)