# The basics of an RPG (role-playing game)

**URL:** https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967
**Category:** programming
**Created:** [April 18, 2004, 8:06pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967 "2004-04-18T20:06:08Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![denacioust](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@denacioust](https://forum.kirupa.com/u/denacioust)
#### Post date: [April 18, 2004, 8:06pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/1 "2004-04-18T20:06:08Z")

</div>

The basics of an RPG (role-playing game)  
_Taken from [flashbox.proboards15.com](http://flashbox.proboards15.com) (my site)_

* * *

![](http://mars.walagata.com/w/denacioust/RPGimage.jpg)

Note: This is based on the Stick RPG game but I’ve added in some other stuff too.  
Now bear with me I’m not sure if this will work because I just wrote this all without testing it so please report any errors.

First-of-all what you want to do is decide:

1. Your characters occupation(s) – Start off by deciding what you want your Playable Character to do. Pick a job that blends in with your characters surroundings e.g. it would work well if you had your character being a Mafia Hit man if he/she lived Italy

2. The characters appearance and personality – Decide now what your character should look like and their distinguishing character traits e.g. shifty eyes, giant head, Red, strawberry blonde, hair etc. Now pick a personality to match the look i.e. a person with shifty eyes could be a criminal or a drug dealer etc. And lastly pick a name for your character, a suitable name one which almost gives away the characters personality.

3. Pick your enemies, decide your friends – Your character will definitely need an enemy, pick a reason why and how that person is your enemy. If you’re going to have a no. of enemies you’ll need friends, someone to help you get the job done…

4. The Character’s Background – Lastly what you want to do is to decide the following questions:  
• Where does your character come from?  
• Who does he/she interact with? (Mafia stuff like that)  
• Why is your character in the position they are in? (Unpaid debts to the Mafia etc.)

Now that you’ve got the background it’s time to open up Flash. Open up a new flash document. To start off draw out your character, from a birds-eye-view (from the top), animate it walking in an upward direction, the other directions will be handled in the action script of the game. Label the character “man.”  
With your character done it would be best just to draw the background now and keep all the drawing and animating together. Draw your map; ignore logic when drawing it by showing the front and top of every building so you know what’s going on in each building. Your map should be several times the size of the visible screen in your game so that the map can scroll, the map only will move and not the character. You’ll need to add in some extra frames to show the inside of the buildings.

Now what you need to do is an inventory for your game. At the bottom of the screen draw any number of boxes i.e. these boxes will show up your items when you find them. Give these boxes the instances slot1, slot2 etc. With these boxes you’ll want to put in around five textboxes, one for health, occupation, days into the game, name, strength, charm and intelligence. Give each of the textboxes the variable (not instance name!) of what they are (just the one word.)

Now to start off your game insert a new scene (Insert --\> Scene) above the existing scene(s) name this scene “Setup”. Name the already existing scene “game” This scene will be used to set-up all the variables. Insert an input text-box give it the variable “name.” The user then can input their own name into the textbox. Make sure you click the box labelled “show border around text” and Max. characters to seven, or whatever you want. Insert another input textbox for Days into the game and do the same for that but set the maximum characters to two and the allowed characters to just be numbers. Insert three more dynamic textboxes for Strength, Charm and Intelligence. Now for some action script insert this into the first frame:

```auto
 function randomise () {
_root.strength=random(10)
_root.charm=random(10)
_root.intelligence=random(10)
}  

```

By declaring it as a function it can be used again with a randomising button. Draw a “roll again” button. Give it actions.

```auto
 on (release) { randomise(); } 

```

That will randomise the values by the click of that button. Place another button on the stage with the writing “Go” or “Play” or something to that extent in it. Give the button actions

```auto

on (release) {
	gotoAndStop("Game", 1);

}

```

And for the actual game…  
Go to your “Game” scene and place in your character and the background. Select align (ctrl + k ) and centre your character on stage. Give the background the following actions.

```auto
onClipEvent (load) {
movespeed = 2;
}
onClipEvent (enterFrame) {
	if (Key.isDown(Key.RIGHT)) {
	_x-= movespeed;
	}
	if (Key.isDown(Key.LEFT)) {	
	_x+= movespeed;
	}
	if (Key.isDown(Key.UP)) {	
	_y+= movespeed;
	}
	if (Key.isDown(Key.DOWN)) {	
	_y-= movespeed;
	}
	}

```

And give your character these actions

```auto
onClipEvent (load){movespeed = 0;
}
onClipEvent (enterFrame) {
	if (Key.isDown(Key.RIGHT)) {
		play();
		_rotation = 90;
		_x+= movespeed;
	}
	if (Key.isDown(Key.LEFT)) {
		play();
		_rotation = 270;
		_x-= movespeed;
	}
	if (Key.isDown(Key.UP)) {
		play();
		_rotation = 0;
		_y-= movespeed;
	}
	if (Key.isDown(Key.DOWN)) {
		play();
		_rotation = 180;
		_y+= movespeed;
	}
	if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP)) {
		_rotation = 45;
	}
	if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP)) {
		_rotation = 315;
	}
	if (Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN)) {
		_rotation = 135;
	}
	if (Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN)) {
		_rotation = 225;
	}
}

```

Now place these actions in the frame.

```auto

currentslotnum = 1;
stop ();
function addToslot (item) {
	if (!item.found) {
		item._x = eval ("itemSlot" + currentslotnum)._x;
		item._y = eval ("itemSlot" + currentslotnum)._y;
		item.found = true;
		currentslotnum++;
	}
}

```

And give the items that can be found these actions

```auto

onClipEvent (enterFrame) {
	if (_root.character.hitTest (this)) {
		_root.addToslot (this);
	}
}

```

Now place a button somewhere, it should be one to add on to your intelligence e.g. a study button in a school. Place these actions in the frame that button is placed in:

```auto
if (moneyneeded>=moneyrequired) {
		money=1
	}

```

And give the button these actions

```auto
on (release) {
	strength+=(10*money)
}

```

And that can be used for all the different things required for the game e.g. Buying beer and stuff.

Moving into buildings. Inside the map place a square outside the door with an instance of “step”

```auto
onClipEvent (enterFrame) {
	if (_parent.man.hitTest (this)) {
		_parent.gotoAndStop("insidebuildingframe");

	}
}

```

Thats really all I need to show you without repeating myself or others.  
Here are a few extra tutorials which may help you.

[http://forums.xgenstudios.com/viewtopic.php?t=355](http://forums.xgenstudios.com/viewtopic.php?t=355) - Saving games  
[http://forums.xgenstudios.com/viewtopic.php?t=242](http://forums.xgenstudios.com/viewtopic.php?t=242) - Preloaders  
[http://forums.xgenstudios.com/viewtopic.php?t=7751](http://forums.xgenstudios.com/viewtopic.php?t=7751) - Functions  
[http://forums.xgenstudios.com/viewtopic.php?t=8395](http://forums.xgenstudios.com/viewtopic.php?t=8395) - Actionscript basics

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 13, 2004, 6:13pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/2 "2004-07-13T18:13:49Z")

</div>

how do you make it

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 13, 2004, 10:25pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/3 "2004-07-13T22:25:29Z")

</div>

what do you want

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 14, 2004, 1:40pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/4 "2004-07-14T13:40:23Z")

</div>

Actually it’s on keyup. If you did it on key down it’d play the animation while the character is moving. But, yeah it points in the right direction. On key up (left/right/up/down) you gotoAndStop(theFrameYouNeed).

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 14, 2004, 3:27pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/5 "2004-07-14T15:27:57Z")

</div>

hey lucas92 change you’re footer dude, maximum size allowed is 300x60 !!!

Imagine - your footer on a 800x600 screen takes more than half of the screen !

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 7:21pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/6 "2004-07-27T19:21:55Z")

</div>

Can anyone show me how to use the items

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 13, 2004, 7:53pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/7 "2004-08-13T19:53:39Z")

</div>

Can someone PLEASE finish this and make it work…like christ…when you try to step on a hotspot to go inside a building, nothin happens and those stop moving codes dont work…like omg

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 14, 2004, 9:02pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/8 "2004-08-14T21:02:48Z")

</div>

Liek OMG try do it yourself I was only givin you a basis to work off of

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 14, 2004, 10:10pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/9 "2004-08-14T22:10:27Z")

</div>

“Give someone an inch, and they’ll beat the other mile out of you with it.”

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 27, 2004, 8:55pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/10 "2004-08-27T20:55:33Z")

</div>

Hi

hey i tryed that anti walking through walls thing on my guy, but it didn’t work. Do u know what i may have done wrong???  
and i jave my own map, do i have to do extra script for each building.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 27, 2004, 10:17pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/11 "2004-08-27T22:17:03Z")

</div>

Oh god, this is full of people who really do not know what they are doing.

Anyway… just use an “else” after whatever function you use for movement… eg,  
if(Key.isDown(_whatever key_\<LEFT\>)){  
//movement stuffs  
} else {  
char.gotoAndStop(1);  
}

Simple stuff.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 27, 2004, 10:30pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/12 "2004-08-27T22:30:33Z")

</div>

It’s not so much that they don’t know what they’re doing, but that it seems like they don’t really want to know - they want to copy off someone else’s homework…  
or worse, they just want to click, enter a word or two, and then be done, and call it their own.  
Its a plague of Mac Users.

j/k 😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 27, 2004, 11:44pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/13 "2004-08-27T23:44:07Z")

</div>

thats how mos of us started i mean seifer did yuo look at the actionscripit dictionary and just look at the words not what they do and go hey bet this works (if yuo did sorry)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 28, 2004, 12:45am UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/14 "2004-08-28T00:45:19Z")

</div>

> [@signifer123](#):
>
> thats how mos of us started i mean seifer did yuo look at the actionscripit dictionary and just look at the words not what they do and go hey bet this works (if yuo did sorry)

Well said. what I do, is I take the code (copy it), then study it and figure out how it works. It’s a very good way to do things ;).

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 28, 2004, 6:33am UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/15 "2004-08-28T06:33:16Z")

</div>

yeah i agree…open source to me is better than any tut file. i learn mostly from open source. some times other ppl help me out too (This forum…heh)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 28, 2004, 7:55am UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/16 "2004-08-28T07:55:08Z")

</div>

> [@Bahamutzero](#):
>
> > Originally Posted by **signifer123**  
> > _thats how mos of us started i mean seifer did yuo look at the actionscripit dictionary and just look at the words not what they do and go hey bet this works (if yuo did sorry)_
> 
> yeah i agree…open source to me is better than any tut file. i learn mostly from open source. some times other ppl help me out too (This forum…heh)

SeiferTim wasnt talking about learning off the code, he was talking about people wanting full source FLA files to change a few things and say its theres. And i think you will find that most good actionscripters DID infact read and learn from the actionscript dictionary, if your not willing to do that then you wont be learning actionscript for a while because the dictionary tells u things that sum tutorials dont.

And how can open source be better than a tut. The tut supplys what your finished product should look like, an explanation of what the code means, where u can use it, where to put it and other stuff that a person that is new to actionscript wouldnt understand.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 28, 2004, 1:29pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/17 "2004-08-28T13:29:42Z")

</div>

no what i ment was i bet he didn’t learn purley on his own no extra source, i think everone should use the actionscript dictionary

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 29, 2004, 4:22pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/18 "2004-08-29T16:22:19Z")

</div>

Hey i agree with all these guys.  
i had flash for about 2 weeks i can’t do a single thing, so yeah i am pretty useless but where did u start, making a puppy that nodded it’s head??

cause i have never used a animation beofre, while u lot ave probably been using it for years.

hey but at the end of the day u gotta learn from somewhere right.  
i mean u can’t guss action script 😛

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 29, 2004, 4:53pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/19 "2004-08-29T16:53:56Z")

</div>

> [@signifer123](#):
>
> no what i ment was i bet he didn’t learn purley on his own no extra source, i think everone should use the actionscript dictionary

yeh i know what u meant, but did u read seifers post properly? He is talking about people who just want to copy and paste the code. Its all well and good to ask for help with actionscript but u cant just keep asking people how to do stuff. You have to take the initiative and learn it. And open source is not the best way because u are not told what the code does.

Once you are fluent in basic/intermediate actionscript then FLA’s are good because u can evaluate the code and see how people do things. But right now u would just copy and paste without knowing wot it duz, and then u would end up coming back to the person for help again.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 29, 2004, 9:26pm UTC](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967/20 "2004-08-29T21:26:10Z")

</div>

hey you lot are claerly more expeoreced at me than this.  
so does anyone know where to go to get utterly basic help.  
like blh blah blah does this and this does this.  
I mean if i get a problem i don’t have a clue whats wrong.

I’m just going round blind on this one.  
so if anyone has any really basic action scripts sites could yah gimmie a post. thanks.

[Next page](https://forum.kirupa.com/t/the-basics-of-an-rpg-role-playing-game/48967.md?page=2)
