Hello everyone, I ripped and edited this code from PICCETA, but the only reason I edited it is because it didnt work right when I first put it in, so the editing is ok I guess but I want it to rely on the Stats of the hero and I haven't gotten an idea on how to have it hit the hero, if someone can help me fix this code to work perfectly (for all enemys made) I would be very grateful. Also for those stuck for storylines, I'm good at making storylines come to life.
Common Events Name: Battle
Trigger: Parallel Process
Trigger Switch: Battle
Variable Oper: [HeroATK] Set, Hero Attack
Variable Oper: [HeroDEF] Set, Hero Attack
Variable Oper: [HeroEVD] Set, Hero Attack
Variable Oper: [HeroMAG] Set, Hero Attack
Variable Oper: [HeroX] Set, Hero Attack
Variable Oper: [HeroY] Set, Hero Attack
Variable Oper: [EnemyX] Set, Hero Attack
Variable Oper: [EnemyY] Set, Hero Attack
Variable Oper: [EnemyATK] Set, [Blank]
Variable Oper: [EnemyDEF] Set, [Blank]
Variable Oper: [EnemyMAG] Set, [Blank]
Branch if Hero Up Facing
Branch if Var [HeroX] is [EnemyX] Equal
Variable Oper: [Temp] Set, Var [HeroY]
Wait 0.1 Sec
Variable Oper: [Temp] - , Var [EnemyY] Value
Branch if Var [Temp] is 2 Less
Variable Oper [Temp] Set, Var [HeroX] Value
Wait 0.1 Sec
Variable Oper: [EnemyY] - , Var [Temp] Value
Branch if Var [Temp] is 2 less
Flash Sprite: <Enemy>, 0.5 Sec
Variable Oper: [Enemy1hp] - , 2
Message Display Options: Transp, Bottom, Fixed, Processes Continue
Message: Enemy HP:[ \v[Enemy1hp] ]
Move Event: <Enemy> Lock Facing, Move Away from Hero, Unlock Facing\
Branch if Var [enemy1hp] is 0 less
Switch Operation: [enemy1die] ON
Message: Battle Won
<b>code needed: <EXP> Gained </b>
:End
Wait: Until Key Pressed
:End
:End
:End
:End
Branch if Hero Down Facing
Branch if Var [HeroX] is [EnemyX] Equal
Variable Oper: [Temp] Set, Var [HeroY]
Wait 0.1 Sec
Variable Oper: [Temp] - , Var [EnemyY] Value
Branch if Var [Temp] is 2 Less
Variable Oper [Temp] Set, Var [HeroX] Value
Wait 0.1 Sec
Variable Oper: [EnemyY] - , Var [Temp] Value
Branch if Var [Temp] is 2 less
Flash Sprite: <Enemy>, 0.5 Sec
Variable Oper: [Enemy1hp] - , 2
Message Display Options: Transp, Bottom, Fixed, Processes Continue
Message: Enemy HP:[ \v[Enemy1hp] ]
Move Event: <Enemy> Lock Facing, Move Away from Hero, Unlock Facing\
Branch if Var [enemy1hp] is 0 less
Switch Operation: [enemy1die] ON
Message: Battle Won
<b>code needed: <EXP> Gained </b>
:End
Wait: Until Key Pressed
:End
:End
:End
:End
Branch if Hero Right Facing
Branch if Var [HeroY] is [EnemyY] Equal
Variable Oper: [Temp] Set, Var [HeroX]
Wait 0.1 Sec
Variable Oper: [Temp] - , Var [EnemyX] Value
Branch if Var [Temp] is 2 Less
Variable Oper [Temp] Set, Var [HeroY] Value
Wait 0.1 Sec
Variable Oper: [EnemyX] - , Var [Temp] Value
Branch if Var [Temp] is 2 less
Flash Sprite: <Enemy>, 0.5 Sec
Variable Oper: [Enemy1hp] - , 2
Message Display Options: Transp, Bottom, Fixed, Processes Continue
Message: Enemy HP:[ \v[Enemy1hp] ]
Move Event: <Enemy> Lock Facing, Move Away from Hero, Unlock Facing\
Branch if Var [enemy1hp] is 0 less
Switch Operation: [enemy1die] ON
Message: Battle Won
<b>code needed: <EXP> Gained </b>
:End
Wait: Until Key Pressed
:End
:End
:End
:End
Branch if Hero Left Facing
Branch if Var [HeroY] is [EnemyY] Equal
Variable Oper: [Temp] Set, Var [HeroX]
Wait 0.1 Sec
Variable Oper: [Temp] - , Var [EnemyX] Value
Branch if Var [Temp] is 2 Less
Variable Oper [Temp] Set, Var [HeroY] Value
Wait 0.1 Sec
Variable Oper: [EnemyX] - , Var [Temp] Value
Branch if Var [Temp] is 2 less
Flash Sprite: <Enemy>, 0.5 Sec
Variable Oper: [Enemy1hp] - , 2
Message Display Options: Transp, Bottom, Fixed, Processes Continue
Message: Enemy HP:[ \v[Enemy1hp] ]
Move Event: <Enemy> Lock Facing, Move Away from Hero, Unlock Facing\
Branch if Var [enemy1hp] is 0 less
Switch Operation: [enemy1die] ON
Message: Battle Won
<b>code needed: <EXP> Gained </b>
:End
Wait: Until Key Pressed
:End
:End
:End
:End
-------------------------
Enemy Char: <name>
Trigger: Touched By Hero
Event layer: Same as Hero
Branch if Switch [enemy1die] is ON
Switch Operation: [Battle] OFF
Erase Event
:Else Handler
Variable Oper: [enemy1hp] Set, Rnd[<depends on enemy>]
Variable Oper: [EnemyATK] Set, Rnd[<depends on enemy>]
Variable Oper: [EnemyDEF] Set, Rnd[<depends on enemy>]
Variable Oper: [EnemyMAG] Set, Rnd[<depends on enemy>]
Switch Operation: [Battle] ON
<b>I think I need more coding here but not sure</b>
:End
Please any help will be appreticed.
WOW! This really goes over my head as an eventing abs, however, usually, when you rip something and you miss something it's because ,
A) you didn't notice something else somewhere else (like in the common events data base) that help make this work.
b)you declared a var wrong,
I don't get why you set hero atk to so many vars. (but if the other guy did it, and it worked it must be right)It also may be how you are setting up your events too. check the other persons events by (moment type, collision vs touch by hero, and the level (same, below, above,) and see if that makes a difference, sorry if this does not help much, but ripping something does require you understand it first before you can even know where you may went wrong.
Yes, I understand vars and switches and I did do that the correct way, I just think they missed something and I can't get it to do every enemy, because of the event I believe
check his events, is it different vars for each enemy?
yeah... each enemys even should have different stats, but i got to get the first one working before i set the other ones.
"Stats of the hero and I haven't gotten an idea on how to have it hit the hero"
Do you mean enemy dmg?
it set mine up in an else statement and then i have everything else on a con branch.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi220.photobucket.com%2Falbums%2Fdd81%2FKattscomics%2Fabs1a.jpg&hash=7593703b29e6f6e894c396cc2aafe5ea7167c4d1)