So basically I'm making a game where city life exists and I want the players to be able to interact with individual units. I can't think of a way to track several instances of the same type of unit efficiently. I want to track them so you can tell the difference between units.
These units will have to be able to move, as I want a kind of city life going on even if players are not present. Please Help!!
None.
Roughly how much of the same unit do you want on at a time? If there's only going to be around 3-5 the most easiest and obvious choice is different players.
If they will never touch each other, you could have a small locations for each unit that constantly centers on them.
Otherwise the only other method I can think of is very EUD and trigger intensive and may not even be worth it, but if you can't use the above two then I could attempt to explain it.
None.
You could use a 1x1 pixel location to track each unit individually provided that it can't escape it. This will cost you a location per unit, though. You also could try splitting the units between several computer players if that is possible, but the limit is that the number of units of each type you can have is the number of players you are willing to spare.
Long story short, it's really not worth doing it just for an aesthetical touch.
None.
The game is multiplayer and I was hoping to be able to do at least 20. I'm all up for intense triggers as long as it doesn't wear out all of my resources.
None.
I'm not entirely sure how I would keep the unit from escaping the location if it ran into its own type of unit that happened to be a unit that was destined to die. I really want this to work because I want relationships in the game to be possible.
None.
Then just get the rest of the map done and if you have locations to spare at the end, use them for this.
None.
Now that I think of it there shouldn't be a problem with the small locations constantly centering if you're using a slow unit like a marine. With units like vultures, maybe. Anyways this should be your first method to attempt. In the marine's case, you'd have 1x1 locations constantly centering onto their respective marines, then you'd move a larger location onto each 1x1 location and detect if the player's unit is there.
None.
So if I just set a 1x1 location to center on the unit already placed within it, it should stay on them?
None.
Alright I'm going to test it out real quick
None.
Don't even bother with tracking the units at all. If you want to be able to interact with them you can just find their unit index number when you need it.
For instance, say the player does whatever he is supposed to to 'talk' to a unit. You could then just center a location on his Hero and modify health of all the unit types that you could talk to in that location to 0%. Then just detect which unit indexes have a health of 1 and thats the unit that you are interacting with. Its fairly easy.
To clarify, all units in the game have a unique index number.
None.
O.O Where can i read this tutorial
None.
I order you to forgive yourself!
If they are all the same is there a reason you can't just do a randomization of what they say or do to interact with the player?
If it's a city, you can just divide it into sections and the units would always move in a predefined location that way it makes your life easier.
Don't even bother with tracking the units at all. If you want to be able to interact with them you can just find their unit index number when you need it.
For instance, say the player does whatever he is supposed to to 'talk' to a unit. You could then just center a location on his Hero and modify health of all the unit types that you could talk to in that location to 0%. Then just detect which unit indexes have a health of 1 and thats the unit that you are interacting with. Its fairly easy.
To clarify, all units in the game have a unique index number.
That would work if he didn't want to keep the unit's HP easily. Well it depends, but with HP in the hundreds it could cause way too much triggers.
What I was thinking of was moving nearby units one by one to a static area whose coordinates is known, then have a series of triggers detecting which 'unit index' has the current coordinate of that area. Couldn't work so well for stacked air units though, or maybe a similar effect could be achieved with unit order coordinates.
None.
O.O Where can i read this tutorial
There is no such tutorial. I'm trying to remember off the top of my head, but I believe the EUDs for detecting health being 1 is:
Player 8 has suffered At most 256 deaths of [13478 - (Index#-1)*7]
You can find the index number of a unit by going into properties of a unit in the latest version of Scmdraft under the index column.
None.
-.- I have no idea how to detect or use the unit whatchamacallit. Although combined with what you said yoonkwun it sounds like exactly what I want to be using.
None.
That would work if he didn't want to keep the unit's HP easily.
What I was thinking of was moving nearby units one by one to a static area whose coordinates is known, then have a series of triggers detecting which 'unit index' has the current coordinate of that area. Couldn't work so well for stacked air units though, or maybe a similar effect could be achieved with unit order coordinates.
This would work too.
But if you don't care about retaining these units' healths then you may as well use health detection.
None.
I order you to forgive yourself!
sounds like if I want to add it, it would be near the end since only SCMDRAFT uses it and I'm not to fond of the program. Thanks anyway, I'll be heading over to concept ideas to see if anyone can stir up a way to handle in game relationships.
None.
I order you to forgive yourself!
If someone tries to talk to one of your units, just display a random message and it should work. (Make enough so the same message doesn't show to often. (This should be even better than tracking the units since you get the same amount of message as you wanted but less repetitively.)
Post has been edited 1 time(s), last time on Mar 24 2010, 1:08 am by apos. Reason: Double posted so I edited the wrong post
I'm not sure who that was directed at, but I consider my method far superior and more simple than yours.
sounds like if I want to add it, it would be near the end since only SCMDRAFT uses it and I'm not to fond of the program. Thanks anyway, I'll be heading over to concept ideas to see if anyone can stir up a way to handle in game relationships.
99% of SEN the userbase uses Scmdraft, and with good reason. What are you using if not Scmdraft?
None.