Check if object has been activated after campaign map is loaded.

Solu9

You can change this now in User CP.
Reaction score
216
Bad title. I'll explain.

The player can interact with certain objects in each map in the campaign.
Since the player can jump back to maps already played I need to detect if these object have already been activated.

My initial thought was setting a boolean array in the map initialization in each map.
Each of these object is bound to a specific number in the array.
When an object is activated I check the array and set the corresponding number to "true"
This information I'll save in the game cache to carry from map to map.

The con with this method is that I have to set the array manually to each object, and there are like 1500 all in all...

So my question is. Is there an easier/better way to do this?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Hard to say.
You could work on some kind of indexing system (like custom value or something) to make referencing the array positions easier.
Really depends on what you want to do with these dubious "objects".
 

Solu9

You can change this now in User CP.
Reaction score
216
The objects are just structures which, when interacted with, will change color or whatever to indicate they have been activated.
When activated they award the player with 1 Lumber. Used as ability points.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
612
Couldn't you just change the owner of the structure or something?
 

Solu9

You can change this now in User CP.
Reaction score
216
Couldn't you just change the owner of the structure or something?


I could also morph it into a naked woman.
The problem is I need to have the game remember which objects has been interacted with :)
 

DrEvil

FCRI Associate!
Reaction score
111
Are they all the same type of unit?
Can't you just loop and group over all the same type of units and add to the array?
 

Solu9

You can change this now in User CP.
Reaction score
216
Pffft.

And in the second map I do the same. And the third and so on. No need to put all of the towers from all the maps in the same array.
I'll just have a separate array in each map.

Ofc...
 

Solu9

You can change this now in User CP.
Reaction score
216
So what's stopping you from grouping all guard towers and setting the arrays from them?


Seemed like an easy solution. Too easy perhaps.

-I still need to carry the data between maps. It's not like there is 2 or 3 maps to jump between. More like 50-60.
-And how can I make sure it's the same objects that already has been activated, that are activated again.

Object A, B and D is activated in a map.
At some point I come back to this map and I need the exact same 3 objects to already be activated. Not A, B, C or B, C, D.

I can't use the same array for each map, because then the data from the just finished map is gone and all the objects in that map can be activated again.

Am I missing something obvious?
 

DrEvil

FCRI Associate!
Reaction score
111
I'm not quite sure how campaign map loading works.
Does each map have its own separate variables or do they share?

I think I got solutions for both answers! :D

Edit: The reason for gamecache is because variables aren't shared.... -_-

What happens when you switch maps, does everything get removed from a previous map?
Does it all spontaneously combust ?
What happens when you reload a map, what units are on the map?

Are variables kept from previous maps? (When reloaded)
Are they reset to defaults?

Can't you just have a trigger in the first map, that maps each unit to a specific index in an array and a boolean for activation.
Make sure that copying unknown variables creates new variables and just copy the trigger into each map?
 

Solu9

You can change this now in User CP.
Reaction score
216
I haven't actually implemented this yet. I wanted to ask here before I made some stupid ineffective system.

Although I have fizzled with the game cache before.
I had 2 maps. In each map there was a unit, and once killed the game switched to the other map.
I saved:
Life, Mana, Exp and it worked fine.
These were not stored in arrays though. I had a single variable for each unit's life, mana, exp.

All units stayed at their default locations when the map switched, no prob.
All units that was meant to be carried over did so. Got their Life, Mana and Exp set to the stored values

Can't you just have a trigger in the first map, that maps each unit to a specific index in an array and a boolean for activation.
Make sure that copying unknown variables creates new variables and just copy the trigger into each map?

Let me see if I understand exactly what you mean.

Unit array - Set in map initialization.
uTower [1] = Tower 0001
uTower [2] = Tower 0002
uTower [3] = Tower 0003
...
uTower [500] = Tower 0500

When a tower is activated set the corresponding boolean to true, and change color.

Boolean array:
booTower [1] = true
booTower [2] = false
booTower [3] = false
...
booTower [500] = false

This information is kept in the game cache.
When this map is loaded again I run this third trigger to check if a tower has already been activated.

From interger (A) 1 to 500
Loop:
If - booTower [integer A] = true
Then - Change color of uTower [integer A]
Else -
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top