PDA

View Full Version : Monster, Level-Experience System?



ricer
April 1st, 2006, 10:31 AM
heya one last question,



i got:


onClipEvent (enterFrame) {
if (_root.moving_mc.hitTest(this)) {
_root.health>0 ? _root.health -= 2 : _root.moving_mc.play();
}
}

as my monster script
but how can i make an "experience" system?


like: 1000 exp = lvl 2

4000 = lvl 3

8000 = lvl 4

anyone that can edit my code with that?

and how should i make the dynamic box then for lvl and exp?

and the "battle" sysy? like fighting with swords


thnx :D


Regards,
Ricer

bombsledder
April 1st, 2006, 01:52 PM
i would make a formula that fits you needs, maybe something like


function getExpToLevel(lvl){
return Math.ceil(100+(10+1.2*Math.pow(lvl,2)))
}
for(i=0;i<20;i++){
trace("Level "+i+" = "+getExpToLevel(i))
}
for(i=50;i<100;i++){
trace("Level "+i+" = "+getExpToLevel(i))
}
//just to get an idea of what it would be in the future levels

not sure what it comes to, but its just an example you might want to expirment untill you find a formula that fits your needs

ricer
April 1st, 2006, 03:41 PM
Ah you're a genious!!!!!

ill just expand this code and ill release it for other RPG makers :)

thnx for this beginning code bro !

thanks alot :D

Nich
April 1st, 2006, 06:04 PM
Ricer, by weapon system do you mean something like this?
(ctrl to use the sword, go through the door to find enemies, needs flash 8 )

bombsledder
April 1st, 2006, 09:19 PM
umm pressing control doesn't work, i'll see if i can't make an example from my tile based engine

Nich
April 1st, 2006, 09:43 PM
Ah wrong file... fixed above.

ricer
April 2nd, 2006, 05:15 AM
Nich thats exacly what i mean yes! :D

ur awsome and bomb thnx for trying to make one 2 :)


thnx guys

Nich
April 2nd, 2006, 10:28 AM
I'm glad you like it :). Still has a lot of work to be done before it's "done", that's early beta at best, but I'm happy with it so far.

ricer
April 2nd, 2006, 11:52 AM
i like it alot too :)


could u send the .fla idd love to help u ;)

Nich
April 2nd, 2006, 12:56 PM
Nah, this is a solo project of mine. Thanks for the offer though

Ravmaster
April 2nd, 2006, 01:29 PM
hey nich do u think you could make a source file or something for that please?
and if you could mx 2004 useable :D

Nich
April 2nd, 2006, 01:46 PM
No, I've done a lot of hard work on that and I'm not comfortable making it open source. Not to mention I'm not finished. If you have any question about how a particular part is done, I'd be happy to try and answer your questions.

ricer
April 2nd, 2006, 02:31 PM
k :) but can u just release the script u made of the monster with the hp and stuff? ^^

Nich
April 2nd, 2006, 03:23 PM
well that's part of my broken buggy ai that I need to change, but I'll explain the gist of it. The health is just done in arrays, so each enemy is given a max health value and a current health value. When the enemy is generated, I make the current health equal the max health. When any given attack hits an enemy, I subtract the damage from the value of their current health. In my ai, I test that the enemy's health is greater then 0, and if it isn't I set a variable, creatively called "dead", to true, which shuts down the whole thing and removes the movie clip. The movement is a simple enemy._x += 1 type thing, and I hitTest the walls to change direction.

bombsledder
April 2nd, 2006, 04:37 PM
im going to release mine later, .swf and .fla, but im going to take out my enemy moving algorithm because well i put alot of hard work into,

Nich
April 2nd, 2006, 04:42 PM
I know exactly what you mean bombsledder. Looking forward to it.

ricer
April 2nd, 2006, 04:42 PM
allright :)



Thnx for helping me (us) with this bomb ;)

ur a great guy ^^ :)

bombsledder
April 2nd, 2006, 06:28 PM
well here it is, note that is not the best and i compiled for flash 6, its very basic and the ugly tile system with not many good benifets and walking is just ugly, but its for the exp and lvling help anyways, to kill things just click on them, and you have to be next to them hehe,

fla is too big

sorry guys =( gotta use rapidshare


http://rapidshare.de/files/17064690/Practice_EXP.fla.html


also you don't die :P

ricer
April 3rd, 2006, 04:26 AM
well that's part of my broken buggy ai that I need to change, but I'll explain the gist of it. The health is just done in arrays, so each enemy is given a max health value and a current health value. When the enemy is generated, I make the current health equal the max health. When any given attack hits an enemy, I subtract the damage from the value of their current health. In my ai, I test that the enemy's health is greater then 0, and if it isn't I set a variable, creatively called "dead", to true, which shuts down the whole thing and removes the movie clip. The movement is a simple enemy._x += 1 type thing, and I hitTest the walls to change direction.


allright but right before u remove the movieclip u must put a line like:
_root.exp += 20; or something and thats how u can variate this stuff

im beginning to understand it i guess :)

Nich
April 3rd, 2006, 07:13 AM
Yes, that's exactly how you do it.

ricer
April 3rd, 2006, 07:28 AM
Aight thnx bro ^^ when i got my "rpg"-demo done i'll post it so u can see it ;) and Nich u'll get credits for it ;)

Nich
April 3rd, 2006, 03:47 PM
That's always appreciated :). Looking forward to it.

WolfRyder
April 5th, 2006, 04:40 AM
ok this is going to sound wierd but i was able to see the swf file before but now all I get is a blank screen with the stats to the left:??

bombsledder
April 5th, 2006, 06:20 AM
whose swf? mine works for me using mozilla

ricer
April 5th, 2006, 03:39 PM
So i now got the Exp sysy but i need to have the thing with the monster killed to GEt the exp


like: i pick up a item wich goes to my inventory (i can)
but someone can explain how to making it fighable when i clikc on the sword that is in my inventory

i know something like hittest on monster so he loses hp but can someone make a script for me (a basic is ok) :)

thnx,

(srry for my noobynisch :p )

bombsledder
April 5th, 2006, 08:12 PM
hehe so do you want something like you click the sword and it attacks? because if you do that it will be a little harder to find out which targets you will actually hit, unless your doing tile-based because there are some easy algorithms for that, well for an easy script

when you dynamicaly create the sword


function createSword(){
var movie=_root.attachMovie("Sword","sword_"+_root.getNextHighestDepth(),_root.getNextHighestD epth())

movie.onRelease=function(){
player.gotoAndPlay("attacksequence")
}
}


then on the attacksequence frame just draw what you want the player to l look like when he is attacking

habes
April 5th, 2006, 11:08 PM
ok this is going to sound wierd but i was able to see the swf file before but now all I get is a blank screen with the stats to the left:??
yeah me 2

ricer
April 6th, 2006, 02:05 AM
hehe so do you want something like you click the sword and it attacks? because if you do that it will be a little harder to find out which targets you will actually hit, unless your doing tile-based because there are some easy algorithms for that, well for an easy script

when you dynamicaly create the sword


function createSword(){
var movie=_root.attachMovie("Sword","sword_"+_root.getNextHighestDepth(),_root.getNextHighestD epth())

movie.onRelease=function(){
player.gotoAndPlay("attacksequence")
}
}

then on the attacksequence frame just draw what you want the player to l look like when he is attacking


thnx for the first script :)

im using a non-tile game but if i attack ill press "space" or something
but i was thinking about a random damage in the sword so if it hitarea of the _root.monster that the monster will loose hp