Help a new guy

I'm trying to utilize an Attribute's Boolean function in a randomized way.
I.E. Say I'm making an enemy encounter and I want to say 'talk into joining' or something. They join based on the attribute being true or false. How do I make this attribute randomize with an encounter?


If I understand you correctly...

If 'enemy' has flag name 'joinable' then, If Random chance 50%, Then run scripts to have enemy join, Else run scripts that occur when the enemy does not join, Else print message (or run scripts) that happen when that enemy cannot join. This would be a "nested" If.

If you are forming a team of companions, there is a whole different can of worms. If you are doing this, I have suggested that the player, if successfully joining the group message you 'glad to join' (or whatever) and they leave the room and show up in a lobby or hideout or wherever the group meets. Then you could switch characters If they appear in that room. Just a thought.

Let me know if this answers your question.


since you're asking for the randomization of only two states/choices/outcomes... (dualism)... there's really not too much randomization involved to begin with... lol...

thus, this is all you need:

(there's no reason to have a permanent Attribute, as it's randomized anyways)

(okay... now that I'm thinking about this, if you want to have an Attribute to store the randomly selected value, so you're not doing the randomizing operations over and over, than that's a reason for having an Attribute... but you're likely to not be doing the randomization operations with such frequency/quantity to cause any noticable slow down... if you do... then do the randomization operation once by storing it's value into an Attribute, and just use that Attribute whenever you need to. Though, this means that your 'RNG: random number generator: randomization operation' value doesn't ever change/"re-seed"... which you may want... meh. I'm getting too much into the game design weeds now, lol)

if (RandomChance (50)) {
  // scripting for success/TRUE (the enemy joins you)
} else {
  // scripting for failure/FALSE (the enemy does NOT join you)
}

// or (different algorithm used as different Function used, though might be more or less effcient to use than the other Function/s, ... if the micro level actually matters/becomes-significant-performance/speed-wise for you/game, lol):

number = GetRandomInt (0,1) // you can use any two numbers next to each other (a range of 1 number difference): (3,4), (99,100), (1,2), etc etc etc
if (number = 0) {
  // scripting for success/TRUE (the enemy joins you)
} else { // we don't even need to use an 'else if'
  // scripting for failure/FALSE (the enemy does NOT join you)
}

I'll let XanMag (or whoever) help you with how to do this through the GUI/Editor, as I'm lazy, lol.


Thanks man. This does seem to make more sense than what I was trying to do. Well sorta. I can't code to save my life. xD


if you can understand/follow this (it is a bit coding heavy, but I do show how you do the stuff with the GUI/Editor), you can take a look at it:

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk

if you can learn Attributes and the 'if' Script usage, you can do 90% of everything that you want to do for/with your game making!

also... here's a GUI/Editor step by step walkthrough guide demo game that you can create yourself, which will teach you the basics of Attribute usage (including statusattributes):

http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help#37375

ask if you got any questions, and/or need any help with anything


P.S.

if you're interested in learning to code...

I, myself, knew ZERO about game making and programming/coding, when I found quest 5 years ago...

through quest, I've learned to program, and am now currently taking programming classes at college (slowly working towards a degree in programming/coding and beyond: computer science, is what it is called, but I just like to say programming/coding as people understand that)

you can see my own slow process of trying to learn to code (I was so confused by all of the terms, after I went through the tutorial and tried to do stuff on my own in trying to make my own game, like a lot of people for their first time too):

http://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread

I've come quite a long ways, though it has not been easy and it has taken some time to learn (unless you're uber smart, coding is NOT easy to learn, it takes time and patience, and a lot of migraines/head-aches and head-bashings-into the desk/table, laughs)


learning quest software (and optionally it's coding) and game making:

  1. first, you got to learn the basics of using the GUI/Editor via through the tutorial: http://docs.textadventures.co.uk/quest/#Tutorial

  2. however, there's still a big jump/gap/ between the tutorial and trying to do stuff on your own for your own game / game making. As even if you never use/learn coding, you still got to learn its (if) logic, to do the game making (to do the stuff you want to do in/for your game). XanMag as created a tutorial 2 game, to help bridge this gap: http://textadventures.co.uk/forum/games/topic/5940/quest-tutorials-and-templates-published, and also 'onimike' created you tube help videos for quest, but I don't know the links/url/location for them... (sorry).

As for the (if) logic you need to learn... it takes time and patience to train your brain to think in this way, it's not natural!

maybe, the best way to learn it, is to look at people's code (the scripting), as you're directly looking at the logic you need to learn and train your brain in thinking in that way.

a simple way of describing the 'if' logic:

instead of 'should I do this or should I do that', it's: 'if I do this or if I do that', this is a simple way to start to get your brain thinking towards the logic required.

here's a greater look/example at the logic you need to learn and get your brain trained at:

if (animal = deer) {
  msg ("Ah, what a cute deer! You watch the deer in complete safety, no danger to yourself, as the deer's harm-less") // well, actually deers are NOT harmless... but this is just an example, so let's just pretend that deers are harmless, lol
} else if (animal = lion) {
  msg ("OH $hit, you HOPE that you're faster than your buddy... as you run for your life, as that lion is very hungry and you don't want to be the one torn to shreds and getting gobbled up by it!")
}

// ------------

animal = deer

if (animal = deer) {
  msg ("Ah, what a cute deer! You watch the deer in complete safety, no danger to yourself, as the deer's harm-less") // well, actually deers are NOT harmless... but this is just an example, so let's just pretend that deers are harmless, lol
} else if (animal = lion) {
  msg ("OH $hit, you HOPE that you're faster than your buddy... as you run for your life, as that lion is very hungry and you don't want to be the one torn to shreds and getting gobbled up by it!")
}

what's the output?

answer: Ah, what a cute deer! You watch the deer in complete safety, no danger to yourself, as the deer's harm-less

// --------------------------

animal = lion

if (animal = deer) {
  msg ("Ah, what a cute deer! You watch the deer in complete safety, no danger to yourself, as the deer's harm-less") // well, actually deers are NOT harmless... but this is just an example, so let's just pretend that deers are harmless, lol
} else if (animal = lion) {
  msg ("OH $hit, you HOPE that you're faster than your buddy... as you run for your life, as that lion is very hungry and you don't want to be the one torn to shreds and getting gobbled up by it!")
}

what's the output?

answer: OH $hit, you HOPE that you're faster than your buddy... as you run for your life, as that lion is very hungry and you don't want to be the one torn to shreds and getting gobbled up by it!
  1. while, learning the basics of using the GUI/editor/quest allows you to make a game, it's a very limited game... To truly open up the game making, you got to learn Attributes and the 'if' Script usage (which needs/uses/requires the 'if' logic for it, which is why learning this code-if logic is especially needed to make a much much more cool game). This is a huge jump, but if you can do it, it opens up 90% of everything that you'd want to do for/with (put into) your game / game making! So, you do get greatly rewarded for the effort of taking this next step of learning it.

  2. after you open up 90% of the game making with Attributes and the 'if' script (and logic), to open up the remaining 5 to 9% of game making is to learn the more advanced Attributes: List Attributes and Dictionary Attributes.

  3. the remaining 5% or 1% of game making, is all the other advanced/"beyond" and extra stuff you can learn... but as you can see... we're having "diminishing returns" with #4 and #5, lol.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums