- Joined
- Feb 11, 2018
- Messages
- 3
- Reaction score
- 0
- First Language
- English
- Primarily Uses
- RMVXA
Hello there,
So basically I'm new to ruby (and RPGMVXA) and tried to get some Quicktime Events during battle going but still have some issues on typing a script.
So what I'm trying to write is:
A new event is created and called whenever the actor himself or an enemy does an attack or skill but it only happens with a 27% probability. Depending on whoever called the event there are two cases:
- Case 1: The actor. If the actor calls the Quicktime Event, the player has two seconds time to press a random button which will be shown on the screen. If he fails nothing will happen; if he succeeds the damage on the chosen skill will be doubled.
-Case 2: The enemy. If the enemy calls the Quicktime Event, the player has two seconds time to press a random button which will be shown on the screen. If he fails the attack/skill will normally been executed and if he succeeds the damage will be negated.
So far, this is the code I have but it probably has lots of mistakes and I still have some questions ons my Mind.
1.) In which Script can I call a new QTE? I thought about calling it in BattleManager or Game_Battler but I'm not quite sure yet.
2.) How can I show and erase a picture during battle? That's probably the main problem because I have absolutely no idea how to do that since Common Events can't be called during battle....
That's also where I'm trying to implement the "SaveLetter". The letter should also be used for the path where you can find the picture afterwards. For example if @SaveLetter == A it should show the picture wit the name "A.png".
So basically I'm new to ruby (and RPGMVXA) and tried to get some Quicktime Events during battle going but still have some issues on typing a script.
So what I'm trying to write is:
A new event is created and called whenever the actor himself or an enemy does an attack or skill but it only happens with a 27% probability. Depending on whoever called the event there are two cases:
- Case 1: The actor. If the actor calls the Quicktime Event, the player has two seconds time to press a random button which will be shown on the screen. If he fails nothing will happen; if he succeeds the damage on the chosen skill will be doubled.
-Case 2: The enemy. If the enemy calls the Quicktime Event, the player has two seconds time to press a random button which will be shown on the screen. If he fails the attack/skill will normally been executed and if he succeeds the damage will be negated.
So far, this is the code I have but it probably has lots of mistakes and I still have some questions ons my Mind.
Code:
class QuicktimeEvent < Game_Battler;
#Could start at BattleManager StartTurn or Game_Battler
#Initialize
def initialize;
@@SaveLetter = 0;
translate();
run();
end;
#Decision if Enemy: calls Game_BattlerBase
def run();
if(super.actor? == true);
event1();
else if(super.enemy? == true);
event2();
else;
nil;
end;
end;
#Returns if the QuicktimeEvent (with a chance of 27% will be called)
def percent();
x = Random.new(101);
if (x >= 27);
return 1;
else;
return 0;
end;
end;
#Event1 (when run() returns an actor)
def event1();
if(percent() == 1);
#show picturen(missing)
t1 = Time.getlocal + "00:00:02";
if(t1 <= Time.getlocal && Input.press?(:@@SaveLetter) == true);
super.make_damage_value = super.make_damage_value*2;
end;
#remove picture (missing)
end;
end;
#Event2 (when run() returns an enemy)
def event2();
if(percent() == 1);
#Show picture (missing)
t2 = Time.getlocal + "00:00:02";
if(t2 <= Time.getlocal && Input.press?(:@@SaveLetter) == true);
super.make_damage_value = 0;
end;
#remove picture (missing)
end;
end;
#Returns a random Letter (a-z)
def translate();
x = Random.new(27)
case(x != 27);
when x == 1;
@@SaveLetter = A;
when x == 2;
@@SaveLetter = B;
when x == 3;
@@SaveLetter = C;
when x == 4;
@@SaveLetter = D;
when x == 5;
@@SaveLetter = E;
when x == 6;
@@SaveLetter = F;
when x == 7;
@@SaveLetter = G;
when x == 8;
@@SaveLetter = H;
when x == 9;
@@SaveLetter = I;
when x == 10;
@@SaveLetter = J;
when x == 11;
@@SaveLetter = K;
when x == 12;
@@SaveLetter = L;
when x == 13;
@@SaveLetter = M;
when x == 14;
@@SaveLetter = N;
when x == 15;
@@SaveLetter = O;
when x == 16;
@@SaveLetter = P;
when x == 17;
@@SaveLetter = Q;
when x == 18;
@@SaveLetter = R;
when x == 19;
@@SaveLetter = S;
when x == 20;
@@SaveLetter = T;
when x == 21;
@@SaveLetter = U;
when x == 22;
@@SaveLetter = V;
when x == 23;
@@SaveLetter = W;
when x == 24;
@@SaveLetter = X;
when x == 25;
@@SaveLetter = Y;
when x == 26;
@@SaveLetter = Z;
else;
nil;
end;
end;
end;
2.) How can I show and erase a picture during battle? That's probably the main problem because I have absolutely no idea how to do that since Common Events can't be called during battle....

