Be a Supporter!

As3 Character Generator Help

  • 406 Views
  • 4 Replies
New Topic Respond to this Topic
Lynkusu
Lynkusu
  • Member since: Aug. 27, 2009
  • Offline.
Forum Stats
Member
Level 06
Programmer
As3 Character Generator Help 2012-03-24 12:42:41 Reply

I'm trying to make a random character generator that I'll eventually develop into a bigger game. I've got it randomly generating the gender, name, likes, dislikes, blah blah blah. I've written out the personality traits and have made it so it can't repeat traits, but I need a way to make it so that if it picks a certain trait (e.g. "Friendly") it cannot pick other, conflicting traits (e.g. "Unfriendly"). I haven't searched much about this problem because really, I have no idea what to search. Does anyone have any suggestions as to how to go about this? Thanks.


Intellectually Questionable? You decide.

caseymacneil
caseymacneil
  • Member since: Nov. 19, 2008
  • Offline.
Forum Stats
Member
Level 06
Programmer
Response to As3 Character Generator Help 2012-03-24 12:47:39 Reply

At 3/24/12 12:42 PM, Lynkusu wrote: I'm trying to make a random character generator that I'll eventually develop into a bigger game. I've got it randomly generating the gender, name, likes, dislikes, blah blah blah. I've written out the personality traits and have made it so it can't repeat traits, but I need a way to make it so that if it picks a certain trait (e.g. "Friendly") it cannot pick other, conflicting traits (e.g. "Unfriendly"). I haven't searched much about this problem because really, I have no idea what to search. Does anyone have any suggestions as to how to go about this? Thanks.

i would go about doing it like this, unless theres a shit ton of traits to pick from, then you could figure something out similar.

if (trait == unfriendly){
            canPickFriendly = false
}

P.S. that's probably not your actual variable names so switch it about if thats even what your looking for.

Lynkusu
Lynkusu
  • Member since: Aug. 27, 2009
  • Offline.
Forum Stats
Member
Level 06
Programmer
Response to As3 Character Generator Help 2012-03-24 12:57:51 Reply

At 3/24/12 12:47 PM, caseymacneil wrote: i would go about doing it like this, unless theres a shit ton of traits to pick from, then you could figure something out similar.

if (trait == unfriendly){
canPickFriendly = false
}

P.S. that's probably not your actual variable names so switch it about if thats even what your looking for.

Hmm, yeah, there is a shit ton of them. xP I was hoping there'd be a less tedious way, but if this works, I'll make myself do it. Thanks. xD


Intellectually Questionable? You decide.

ProfessorFlash
ProfessorFlash
  • Member since: Oct. 6, 2007
  • Offline.
Forum Stats
Member
Level 32
Programmer
Response to As3 Character Generator Help 2012-03-24 13:43:42 Reply

Use groups for the traits and pick only one trait from the group. Set conflicting traits in the same group. You can have several groups, more than you the amount of traits you pick. Like you can have 9 groups, but only pick one trait from 3 groups. This will take some organizing from you, but definitely better idea than what the previous guy suggested with the booleans.


You can solve pretty much any problem you may have with AS3 by consulting the AS3 Language reference.

Lynkusu
Lynkusu
  • Member since: Aug. 27, 2009
  • Offline.
Forum Stats
Member
Level 06
Programmer
Response to As3 Character Generator Help 2012-03-24 14:00:10 Reply

At 3/24/12 01:43 PM, ProfessorFlash wrote: Use groups for the traits and pick only one trait from the group. Set conflicting traits in the same group. You can have several groups, more than you the amount of traits you pick. Like you can have 9 groups, but only pick one trait from 3 groups. This will take some organizing from you, but definitely better idea than what the previous guy suggested with the booleans.

Oh damn, that's a really good idea. I'll just make an array for each group. Thanks! :)


Intellectually Questionable? You decide.