ID:152728
 
I'm in need of dire help. A board game I am trying to make is in great danger because of the way I am currently making it. There are a whole mess of variables for what unit you are making, what unit you have selected, what action you are taking, all the nasty things of that sort. There are no set Player 1 and Player 2, and because of that, the attacking, moving, not even ending your turn works. So, I am asking of your help! How would you fabricate the game? I've thought of this:

- Mobs for Player 1 and Player 2

- Use something different to build units and selected unit instead of variables

- I still have no idea on how to make the units attack and the like except for making procs at their sub-level (/mob/Units/UnitHere) and acessing them when their owner click attack. But that would bring us back to having to use variables for the selected unit. So, any ideas for me? Thank you in advance!
for varibles:
var/unitmake = 0 // 1= <insert unit here> 2= <insert other unit here ect

then in your making proc
if(unitmake == 1)
//make unit 1
if(unitmake == 2)
//make unit 2
if(unitmake == 560794)
//make unit 560794

this is assuming your doing this:
var/unit1make = 0
var/unit2make = 0
var/unit3make = 0
var/unit4make = 0

ect
oh and for player 1 and 2
var/player1
var/player2
proc/ifplayer(play)
if(play == 1)
for(var/mob/M in world)
if(M.key == player1)
world << "[M] is player 1"
else if(play == 2)
for(var/mob/M in world)
if(M.key == player2)
world << "[M] is player 2"

Lotho wrote:
I'm in need of dire help. A board game I am trying to make is in great danger because of the way I am currently making it. There are a whole mess of variables for what unit you are making, what unit you have selected, what action you are taking, all the nasty things of that sort.

Let's see some of that mess. I'm sure there are ways to streamline it.

There are no set Player 1 and Player 2, and because of that, the attacking, moving, not even ending your turn works.

Au contraire, you should not have set vars like player1 and player2. It is not flexible, it is not extensible, and it usually leads to repeating the same code.

So, I am asking of your help! How would you fabricate the game? I've thought of this:

- Mobs for Player 1 and Player 2

Not a good idea.

- Use something different to build units and selected unit instead of variables

It sounds like you just need better organization for the vars you have.

- I still have no idea on how to make the units attack and the like except for making procs at their sub-level (/mob/Units/UnitHere) and acessing them when their owner click attack. But that would bring us back to having to use variables for the selected unit.

Well, you should have a var indicating the selected unit. Or better yet, a list, if you want to be able to do multiple selection.

Lummox JR
In response to Rky_nick
I'm really not sure what you're suggesting here except that it's horrifyingly wrong. There are simpler ways to approach variable organization, and player1/2 thing is just a bad idea all around (albeit not yours).

Best to wait to see what Lotho's working with right now.

Lummox JR