Hello all, Last time i asked a question how to save the location of a players current X,Y position in this topic: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=44123.0
Now that it's time to set up a random battle room I can]t seem to figure out some key things to make fully universal for the game. I know if I can get help to get this working all of my RPG problems are over seeing how this is that last part.
Here are some of the things I am trying to do
- Enemies
-In the random battle room there is a object which will be used for the enemy. There is only one target in a battle at a time. I have this code in my before room loads section.
function room_Load()
{
battleBG.SetPosition(0, 0);//Incase I end up moving it on an accident in the editor
battleBG.Clickable = false;//To ensure that the player can't click on it.
if(player.PreviousRoom == 23){//Checks for the last room the player came from
battleBG.Graphic = 296;//Change the randomroom background so that it fits the setting of the previous room.
//
//
//
//
//
}
}
I would like to make a randomized selection so that a random so that the game will choose a sprite that ranges from 104 - 107. Those two numbers a examples of sprites in the game that contain a Monster Graphic.
- Attacks
-I have a separate script to hold each monster attack. I would like to make each attack into a script command so that I could just have the game check for the current sprite slot on the obj so that it performs the attack based on the graphic(monster).
battleBG.Graphic = Random(3) + 104;
To get the graphic of an object in the global script, use the object array. If your monster object's ID is 2, use
object[2].
function Attack() {
int og = object[2].Graphic;
if (og == 23) {
...
}
else if (og == 24) {
...
}
...
}
(oh, and: really? after all this time, you still ask simple, basic questions like this...?)
Quoteif I can get help to get this working all of my RPG problems are over
I'll believe that when I see it.
Simple yes but I once I learn it then I won't ask it anymore.
Maybe I should post the code of a different battle room. It is where I will be getting everything from so i can past most it into the 1 random battle room.
function jkboss_UseInv()
{
if (playerHP <=0) {
playerMP += 2;
if(playerMP <= baseMp){
playerMP = baseMp;
}
}
if (cEgo.ActiveInventory == card1){
dennis.Say("Heavy attack!");
dennis.Walk(259, 192, eBlock, eAnywhere);
dennis.Walk(265, 192, eBlock, eAnywhere);
ShakeScreen(1);
Label17.Text = String.Format("-%d", Stealedge);
HP_indicator.Transparency = 100;
HP_indicator.SetPosition(55, 124);
HP_indicator.TweenTransparency(0.2, 0, eLinearTween, eNoBlockTween);
HP_indicator.TweenPosition(0.6, 55, 120, eLinearTween, eBlockTween);
HP_indicator.TweenTransparency(0.2, 100, eLinearTween, eBlockTween);
BossHp -= Stealedge;
GiveScore(1);
PlayerEXP += 1;
//Start building Soul Limit
}
if (cEgo.ActiveInventory == card17){
//create list of Soul limits [X]
//create GUI with list [X]
//Have game check which limit is selected
//Start limit animation & say name of limit
if(SLgraphic.NormalGraphic == 91){//Checks for the current sprite slot on the soul limit board.
dennis.Say("Triple Blade!");
dennis.Walk(259, 192, eBlock, eAnywhere);
dennis.Walk(265, 192, eBlock, eAnywhere);
dennis.Walk(259, 192, eBlock, eAnywhere);
dennis.Walk(265, 192, eBlock, eAnywhere);
dennis.Walk(259, 192, eBlock, eAnywhere);
dennis.Walk(265, 192, eBlock, eAnywhere);
Label17.Text = String.Format("-%d", tripleblade);
HP_indicator.Transparency = 100;
HP_indicator.SetPosition(55, 124);
HP_indicator.TweenTransparency(0.2, 0, eLinearTween, eNoBlockTween);
HP_indicator.TweenPosition(0.6, 55, 120, eLinearTween, eBlockTween);
HP_indicator.TweenTransparency(0.2, 100, eLinearTween, eBlockTween);
BossHp -= tripleblade;
GiveScore(3);
PlayerEXP += 3;
ATBbar.Animate(9, 1, 2, eRepeat);
SetTimer(1, 50);
}
cEgo.LoseInventory(card17);
}
if(BossHp <=0){
mouse.Visible = false;
mouse.DisableMode(eModeUseinv);
mouse.EnableMode(eModeWalkto);
gStatusline.Visible = true;
HUD.TweenTransparency(0.5, 100);
HUD.Visible = false;
gGui2.TweenTransparency(0.5, 100);
gGui2.Visible = false;
gStatusline.TweenTransparency(0.5, 100);
gStatusline.Visible = false;
Winlogo.Transparency = 100;
Winlogo.Visible = true;
EpicWin.Play(eAudioPriorityHigh);
Winlogo.TweenTransparency(0.5, 0);
Wait(240);
Winlogo.TweenTransparency(0.5, 100);
if(PlayerEXP >= BaseEXP){
LV_up_show.Visible = true;
playerHP += 5;
playerMP += 5;
Stealedge +=1;
BaseEXP += 17;
landkills += 1;
totalkills += 1;
}
else {
LV_up_show.Visible = false;
}
Winlogo.Visible = false;
jk.ChangeRoom(4, 107, 197);
jk.Say("You think this is over Dennis?");
jk.Say("Well think again, You have courage but your spirit is not strong enough.");
dennis.Say("Yes it is! I just...");
jk.Say("Need more training? Well I have you coverd with that part.");
jk.Say("As you spirit gets stronger so will you Dennis.");
dennis.Say("I-I don't need a stronger spirit, I can do this myself.");
jk.Say("We will see if the time comes.");
jk.Say("Meet me in the center of the blue mist.");
TweenSoundVolume(0.5, 100, 0, eLinearTween, eNoBlockTween);
ATBbar.Animate(9, 1, 2, eRepeat);
mouse.Mode = eModeWalkto;
SetTimer(1, 50);
white.Visible = true;
white.TweenTransparency(0.7, 0);
black.Transparency = 0;
black.Visible = true;
dennis.SetAsPlayer();
dennis.ChangeRoom(5, 108, 130);
white.TweenTransparency(0.5, 100);
white.Visible = false;
Wait(40);
}
if(BossHp >=1){
if (Game.DoOnceOnly("Let's get it started.")){
jk.ChangeRoom(4, 107, 197);
jk.Say("Let's get this fight going, Shall we?");
jk.Say("Embrace my smooth strike!");
jk.ChangeRoom(4, 0, 0);
}
jkboss.Move(78, 197, 3, eBlock, eAnywhere);
jkboss.Move(73, 197, 3, eBlock, eAnywhere);
ShakeScreen(1);
Label17.Text = "-2";
HP_indicator.Transparency = 100;
HP_indicator.SetPosition(230, 124);
HP_indicator.TweenTransparency(0.2, 0, eLinearTween, eNoBlockTween);
HP_indicator.TweenPosition(0.6, 230, 120, eLinearTween, eBlockTween);
HP_indicator.TweenTransparency(0.2, 100, eLinearTween, eBlockTween);
playerHP -= 2;
//playerHP -= 2;
}
if(playerHP <=0){
dennis.Say("I have failed you master...");
dennis.TweenTransparency(0.5, 100, eEaseInTween, eBlockTween);
dennis.ChangeRoom(0, 0, 0);
}
I just noticed that I that I have to change cego to Dennis and not only that but at the end of the battle I have to give Dennis the same commands that ego had.
}
Also I think I found away around the monster attack. There are only two types(land and flying).
I think I got it
// room script file
int enemyset0;
function room_Load()
{
battleBG.SetPosition(0, 0);
battleBG.Clickable = false;
if(player.PreviousRoom == 23){
battleBG.Graphic = 296;
//Selection of enemy
enemyset0=Random(3);
if (enemyset0==0){
enemy.Graphic = ;
}
else if (enemyset0==1){
enemy.Graphic = ;
}
else if (enemyset0==2){
enemy.Graphic = ;
}
else if (enemyset0==3){
enemy.Graphic = ;
}
}
[/code