![]() |
![]() ![]() ![]() ![]() ![]()
|
Author | Topic: Random Values |
Corlen Belspar |
![]() I am making an RPG text adventure, and I need to know the string for random values so the enemies will do different damage when they attack. |
Computer Whizz |
![]() Right - to get a random number then you need to know 2 things: 1) The lowest random number you want to be chosen, 2) The highest random number you want to be chosen. With these you then type this: Computer Whizz |
Corlen Belspar |
![]() Ok, I got that to work, but now I need to know how to mkae a conditional event that if hitormiss = 1 then to show the damage done else if it is 0, it says you missed. |
Computer Whizz |
![]() Well: if (hitormiss = 1) then { Should do it - so in QDK you'd have a conditional with "hitormiss = 1", and the actions you want to happen in the "then" part - and ANOTHER conditional in the "else" part of this conditional, with the actions in THAT "then". Computer Whizz |
carlii |
![]() Can someone tell me how to use these hit/miss and random values in QDK? I really don't know how to use code all that well. ^_^ |
Tyrant |
![]() This is something I use a lot in my RPG battle system. Carlii, in QDK, make a numeric variable called "attack" (or whatever you want), then give it the random value: Numeric Name: attack This means that attack will have a random value of either 1, 2, 3, or 4. You could set any numbers you want. If you only want two random damage values, just set 1;2 for the random instead of 1;4. Anyway, when the time comes, make a condition. If %attack% equals 1, then deal 5 damage. If %attack% equals 2, then deal 6 damage. And so on.... I noticed that random values are very important in making a game fresh. |
carlii |
![]() If I wanted to specify certain numbers would I do this in QDK: Numeric Name: attack ??? Instead of using a RANGE (2;16) Thanks for your help BTW that really clears it up for me! :P |
Computer Whizz |
![]() Why would you want to do that? Anyway, you would do it by doing this (or at least I would ;) ) var1; $rand(1;4)$ If (var1 = 1) then { NOTE:: This is NOT proper code, and might be understandable by you.... What I did was create 4 "If"'s and have the random number pick ONE of them (in a way). Then have the If say which number you want.... sure a "select case #" might have been easier here ;) (nudges Alex) but we'll just have to wait for that function! Computer Whizz |