Does anyone know the battle script for bots4? Im thinking of making a text based rpg for myself so im wondering if i can base my game on that
thanks
2011-08-27 00:30:44
[13 years, 93 days ago] |
Does anyone know the battle script for bots4? Im thinking of making a text based rpg for myself so im wondering if i can base my game on that thanks |
2011-08-27 01:26:24
[13 years, 93 days ago] |
its all JS. pretty basic shit. just make sure u verify it server-side |
2011-08-27 01:32:34
[13 years, 93 days ago] |
JS? |
2011-08-27 01:34:57
[13 years, 93 days ago] |
JavaScript. |
2011-08-27 02:01:09
[13 years, 93 days ago] |
learn some programming languages before developing a game (at least PHP, HTML, CSS, JS) |
2011-08-27 03:09:29
[13 years, 92 days ago] |
The javascript part is not what you want to run your game on. Here is a basic battle code if(your_hitchance > rand(0,100)) { if(their_block < rand(0,100)) { damage = rand(your_min,your_max) thier_hp -= damage "You hit for ".damage." dmg"; } else { "they blocked!"; } } else { "You missed!"; } then, check if they have a shield/your second hit. and repeat for the next person. I could go into more detail, but that's no fun for you :) -Alan |
2011-08-27 03:16:28
[13 years, 92 days ago] |
u are mistaking = for == |
2011-08-27 03:17:51
[13 years, 92 days ago] |
I have no conditions in there that require '=='. I only used '=' twice, once for declaration of a the "damage" variable and one to minus the "damage" off of "their_hp". |
2011-08-27 03:22:25
[13 years, 92 days ago] |
hang on, ill write something up |
2011-08-27 03:28:02
[13 years, 92 days ago] |
this would be better <?php function attack($min, $max, $chance, $block, $theirhp) { if($chance > rand(0,100)) { if($block < rand(0,100)) { $damagehit == rand($min,$max); $hpleft - damage; echo "You hit for $damage dmg. They have $hpleft HP left."; } else { echo 'you where blocked!'; } } } echo attack(150, 500, 74, 12, 750); ?> |
2011-08-27 03:35:07
[13 years, 92 days ago] |
$damage == ? Huh? Also, that would work if you had it all set up in a loop and crap. That is hard though to figure out the winner if you are switching names for the "attacker" and "defender" for code space. I mean, I know PHP, I was just giving a rough sketch haha. |
2011-08-27 03:38:18
[13 years, 92 days ago] |
yeah, my code wouldn't return anything. but its a ruff idea on using a function |
2011-08-27 03:41:12
[13 years, 92 days ago] |
working code: http://codepad.org/GAnlwrf7 |
2011-08-27 03:48:06
[13 years, 92 days ago] |
Well im 13 and a beginner i know basic javascript, (arrays, loops, functions etc) and i use html im currently trying to learn more javascript |
2011-08-27 03:52:14
[13 years, 92 days ago] |
Try to make some "games" with javascript first. Like, Hangman, Tic-tac-toe, maybe even a basic map that you can "walk" around on. Then, head onto PHP + MySQL. They will become your best friends. |
2011-08-27 03:54:39
[13 years, 92 days ago] |
make a JS guessing game. input is in a form. u click submit and it tells you if your too high/too low |
2011-08-27 03:57:15
[13 years, 92 days ago] |
This is how my path went
|
2011-08-27 03:58:33
[13 years, 92 days ago] |
http://codepad.org/AwcXAzCc <-- alerts if you miss |
2011-08-27 03:59:33
[13 years, 92 days ago] |
@Alan JS password protection do not work. |
2011-08-27 04:00:42
[13 years, 92 days ago] |
^ Duh. haha.... That was just my first JS thing. |
2011-08-27 04:03:24
[13 years, 92 days ago] |
i started with cryptography and bash scripts (linux shell <3) then got into html and other markup languages. then php, loved php and stuck with it. never really bothered with JS but i know basics. now PHP security/hacking(white hat) is a hobby. i have gotten into many areas with JS password protection. |
2011-08-27 04:05:10
[13 years, 92 days ago] |
crap this involves patience... |
2011-08-27 04:07:16
[13 years, 92 days ago] |
patience is good |
2011-08-27 04:12:55
[13 years, 92 days ago] |
Im a teenager i dont understand patience xD |
2011-08-27 04:14:58
[13 years, 92 days ago] |
All good things are worth waiting for ;) I'm more of a stand-alone language guy C++, C#, Perl, Ruby, python Isn't worth a damn though xD |
2011-08-27 04:15:08
[13 years, 92 days ago] |
shit happens |
dracula [20] 2011-08-27 04:17:25
[13 years, 92 days ago] |
don't swear !!!!!!!! |
2011-08-27 04:19:30
[13 years, 92 days ago] |
COME AT ME BRO!!! |
2011-08-27 04:19:54
[13 years, 92 days ago] |
haha |
Administrator 2011-08-27 08:59:14
[13 years, 92 days ago] |
Here's the main bots4 battle code: This is obviously just one way of doing it. I don't claim it to be the best or anything, but I'm a fan of object-oriented programming so that's the way I write. Note that it's not complete in that it relies on other classes that aren't shown, but you should be able to get the main idea of what's involved. |
Metal [26] 2011-08-31 03:00:43
[13 years, 88 days ago] |
Very useful thread |
2014-10-04 07:50:58
[10 years, 53 days ago] |
o.o Oh thanks guys, unfortunately I stopped playing before seeing the rest of the thread replies. I ended up familiarising myself with most of the languages mentioned above and ended up making a few crappy text based games in my spare time. The only problem with them was (well, the only problem besides my interesting CSS) the game formulas. I considered using some of bots' formulas, but don't really want to copy them :s. If I were to create my own formulas, are there any guidelines I should follow? I really dont know where to start... atm, I have crazy exponentials that dont match up with the shop prices or anything else at all :p. |
Administrator 2014-10-04 10:23:10
[10 years, 53 days ago] |
Don't worry about borrowing formulas/ideas from other games. I certainly had no qualms. :) If you really want to make your own formulas, I like to create a spreadsheet to graph it and see how various tweaks affect it. Some basic math knowledge helps, e.g. knowing the difference between how linear and exponential formulas scale for larger values. In general I find it more of a guess-and-check art than a well defined science. Also, that code I posted is a total clusterfuck and should not be looked to for inspiration. :\ |
2014-10-05 02:35:13
[10 years, 53 days ago] |
Ah ok, I figured that it would be a guess and check process. Knowing my patience, I'll probably end up borrowing some formulas :p |
Administrator 2014-10-05 06:50:50
[10 years, 52 days ago] |
I've found that as a programmer, you're always looking back at code you wrote even just 6 months ago and wondering what the hell you were doing. It's a neverending learning process and you'll be continuously iterating on the way you approach problems and design solutions. I've been doing this for around a decade now (several years professionally) and that's always been a constant. |
<Apex>
2014-10-05 07:40:07
[10 years, 52 days ago] |
It's always best if you're continually improving your skill. How boring would work be if you weren't trying to pick something out that you learned and then apply it. |
2014-10-05 22:46:45
[10 years, 52 days ago] |
Hmm, I can definitely relate to that. Figuring out different ways to do things really adds fun to programming (heh, for me anyway). Although, I thought that eventually you would reach a point where you just stick to certain ways of doing things because they just work so well, but I guess that isn't really the case >> (Right?). |
Administrator 2014-10-07 00:43:37
[10 years, 51 days ago] |
If that does eventually happen, it hasn't happened to me yet. :) |