View Full Version : if you like rpgs

09-20-2002, 02:48 AM
if you like rpgs this is a cool script, the reason for the speed thing is to see how many turns you get, the enemy only gets one. You can edit it for your own porpuses but give me credit if you use it. You have to roll a three or above to attack.

<script language="javascript">
function stats() {
spd = prompt("Please enter your speed", "Enter your speed");
spd0 = spd;
function di() {
var ran_num = Math.round(5*Math.random()) + 1;
document.form1.res.value = ran_num;
if (document.form1.res.value > 3) {
var ran_num0 = Math.round(5*Math.random()) + 1;
document.form1.res0.value = ran_num0}
else document.form1.res0.value = "0";
function di0() {
var ran_num = Math.round(5*Math.random()) + 1;
document.form1.edmg.value = ran_num;
if (document.form1.edmg.value > 3) {
var ran_num0 = Math.round(5*Math.random()) + 1;
document.form1.edmg0.value = ran_num0}
else document.form1.edmg0.value = "0";
function dmg() {
var fh = document.form1.foehealth.value;
document.form1.foehealth.value = fh - document.form1.res0.value;
document.form1.foehealth.value = fh - document.form1.res0.value
if (spd0 <= 0) {
document.form1.res.value = "";
document.form1.res0.value = "";
if (document.form1.foehealth.value <= 0) {
alert("You have won!")}
function dmg0() {
var yh = document.form1.edmg0.value * 2;
var yh0 = document.form1.yhealth.value
document.form1.yhealth.value = yh0 - yh
document.form1.edmg.value = "";
document.form1.edmg0.value = "";
spd0 = spd;
if (document.form1.yhealth.value <= 0) {
alert("You have lost.")};
<body onLoad="stats()">
<form name="form1">
Your Health:<br>
<input type="text" name="yhealth" onfocus="document.form1.hit.focus()" size="12" value="500"><p>
<input type="text" name="res" onfocus="document.form1.hit.focus()"size="2" value="">
Roll to see if you will hit.<br>
<input type="text" name="res0" onfocus="document.form1.hit.focus()" size="2" value="">
You will deal this much damage.<br>
<input type="button" name="put" value="Roll Dice" onClick="di()"><p>
<input type="button" name="hit" value="Attack!" onClick="dmg()"><p><p>
<hr width="25%" align="left">
Enemy's Health:<br>
<input type="text" name="foehealth" onfocus="document.form1.hit.focus()" size="12" value="500"><p>
<input type="text" name="edmg" onfocus="document.form1.hit.focus()" size="2" value="">
Roll to see if the enemy will hit you.<br>
<input type="text" name="edmg0" onfocus="document.form1.hit.focus()" size="2" value="">
The enemy will deal this much damage <b>two times</b>.<br>
<input type="button" name="edi" value="Roll Dice" onClick="di0()"><p>
<input type="button" name="hit0" value="Attack!" onClick="dmg0()">

10-17-2002, 04:09 PM
Just a note that is relevant here only because of similarity in subject.

Have you seen this (http://www.smokymonkeys.com/triglav/index.html)? AFAIK, it's all DHTML. Pretty sweet.

10-18-2002, 10:45 AM
Pity they have no scrollbars at all... hrmm.

Mr J
10-18-2002, 03:52 PM
Scrollbars in the other sections.


11-04-2002, 09:43 AM
Hey all,

I'm presently working on a Javascript (pushing Jscript to it's absolute limits!) role playing game with a PHP/mySQL backend, and I am in need of an artist or artist(s) who are interested in making graphics for the game, including character & monster animations, as well as the game world. (I *suck* at grfx )

The game features a scrolling 2d engine that can handle very large maps (largest i've tried is roughly 400x200 'moves'), seemless map-changes & world interaction, sound effects, seemless 'background' game saves without page reloads or play interuption. Some killer graphics would really do this game some justice.

Also, if you have some ideas for the game, story, a dungeon or otherwise, don't be shy.

If you're interested in helping with the game (NOT money :P), contact me at:

ICQ: 156498445
AOLIM: Fitzbean4


11-12-2002, 05:31 AM
holy jesus, beetle that rpg is in Javascript???!!!?!?!? omg, crazy person who has toooo much time in there hands to script hundreds of pages of javascript. I cant believe that a game of that degree could be done in javascript, It would be superb for even full scale Java applet.

11-12-2002, 05:35 AM
Hehe, ya, kinda hard to believe. Javascript is so commonly used for so many small and simple things, it's easy to overlook the fact that it's a pretty full programming language. I've recently forayed into OOP with javascript (not as easy to do as say, PHP) and I'm surprised at some of the things I can accomplish

11-12-2002, 07:27 AM
Well, it's coming along nicely. Basic monsters and AI is in, as well as items and such. Much of the engine ground work is in and working nicely.

I'll supply private demos at this point to anyone interested in perhaps a little testing and such down the line.. thanks.

11-12-2002, 07:31 AM
I am making a sortov simple game in javascript, sorta like super mario type 2d interface, and Im using div tags, and pictures to make it. But I never imagined that something in javascript, could be so solid and so full as that game. and 3d!! jesus. Only thing better that he could do would be to make a true 3d enviroment that renders the game in the perspective of the player.:eek:

11-12-2002, 01:09 PM
3d? no one said anything about 3d :)

11-12-2002, 09:50 PM
I was talking to beetle about that other game by those japanese people

11-12-2002, 10:10 PM
ah that one. Well, that's 2d as well, but isometric. Ala diablo style.

11-13-2002, 12:44 AM
a guestion,:confused: how do you make the picture scrol around in a frame or layer like that??(such as done the game by those japanese people, and yours)

11-13-2002, 01:20 AM
Don't know what exactly they did, but in my game it's basically a collection of images (that make up a map). As you move the character, the images shift up, down, left or right depending on what direction you press. As the row of images that is scrolling out of the viewable area goes off the screen, the new row is made visible on the oppisite side. All the images have an ID that I can then access the top and left properies via:


of course it's a little more complicated than that, and each map cell has a variety of properies such as graphic to display, triggers, doors, blocked or not, etc. Objects and monsters are layered over the top of the map, with an id corresponding the the block they will start on. If it's a monster, and it moves, it's ID is adjusted to reflect the new location.

11-15-2002, 01:26 AM
i upgraded the script almost entirely but then formatted and forgot to save, still no graphics but this game was just a mock up of a notebook game me and my friends have been playing. I knew stuff like that 3d rpg could be made in javascript, but that is just impressive!

11-16-2002, 01:34 AM
yah thats cool, I started making one like that but I lost it when I got a hardrive failure and I had to reformat and reinstall

But IVe started making one that uses layers that change in property of there left and right position

Its a lot more fluent and more capable of better effects