send mouseUp to button "buttonxy" with random chance
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
send mouseUp to button "buttonxy" with random chance
Hello,
I am trying to implement an old pokemon game with live code. I can attack the enemy but he can't attack me.
I have a button "Attack1" which attacks the enemy and subtracts 45 from his lifebar.
I tried to implement it so, that i have "send mouseUp to button "bossAttack1" in the script of "Attack1". This works. I attack the enemy and then he attacks me back.
Now the thing is, that it is always the same attacks and same order. Therefore I want to implement it so, that when i click my "Attack1" and damage the enemy
the "send mouseUp to button "bossAttack1" should be with a random chance, for example 33,3% and maybe with a 33,3% change to call "bossAttack2" or "bossAttack3".
But I don't know how to implement it that way.
I hope I could describe my problem well and that you can help me.
Best
Mark
I am trying to implement an old pokemon game with live code. I can attack the enemy but he can't attack me.
I have a button "Attack1" which attacks the enemy and subtracts 45 from his lifebar.
I tried to implement it so, that i have "send mouseUp to button "bossAttack1" in the script of "Attack1". This works. I attack the enemy and then he attacks me back.
Now the thing is, that it is always the same attacks and same order. Therefore I want to implement it so, that when i click my "Attack1" and damage the enemy
the "send mouseUp to button "bossAttack1" should be with a random chance, for example 33,3% and maybe with a 33,3% change to call "bossAttack2" or "bossAttack3".
But I don't know how to implement it that way.
I hope I could describe my problem well and that you can help me.
Best
Mark
Re: send mouseUp to button "buttonxy" with random chance
Hi Mark,
Best regards
Jean-Marc
33,3% change to call "bossAttack2" or "bossAttack3".
Code: Select all
put "bossAttack" & random(3) into tBtn
send "mouseUp" to btn tBtn
Jean-Marc
https://alternatic.ch
Re: send mouseUp to button "buttonxy" with random chance
Thank you very much. It works now! you guys are amazing 

Re: send mouseUp to button "buttonxy" with random chance
Can I ask another question?
Now I have the case that when the boss defeats me, it shows game over and "click to continue"
if i press the continue button I want the same card to start again.
I tried it with "on mouseUp go to card 6 (the card i want to restart)" but it didn't work.
Is there an easy way to restart a card with a button click?
Best regards
Mark
Now I have the case that when the boss defeats me, it shows game over and "click to continue"
if i press the continue button I want the same card to start again.
I tried it with "on mouseUp go to card 6 (the card i want to restart)" but it didn't work.
Is there an easy way to restart a card with a button click?
Best regards
Mark
Re: send mouseUp to button "buttonxy" with random chance
Hi Mark,
how/where does your game start? In an "opencard" script?
If yes put this into your button "Restart":
If you mean something else, please explain.
Best
Klaus
how/where does your game start? In an "opencard" script?
If yes put this into your button "Restart":
Code: Select all
on mouseup
opencard
end mouseup

If you mean something else, please explain.
Best
Klaus
Re: send mouseUp to button "buttonxy" with random chance
Hey,
Dah I am sorry, I just wanted to edit my reply that I found a way but you guys are too fast!
Yes I actually tried it with "call preOpencard" and " call openCard" and it worked
Thank you
Best regards
Mark
Dah I am sorry, I just wanted to edit my reply that I found a way but you guys are too fast!

Yes I actually tried it with "call preOpencard" and " call openCard" and it worked

Thank you
Best regards
Mark
Re: send mouseUp to button "buttonxy" with random chance
No need to "call" the handler, as long as it is in the current "message hierarchy" path*!
* Here a VERY good read about his feature:
http://fourthworld.com/embassy/articles ... _path.html
* Here a VERY good read about his feature:
http://fourthworld.com/embassy/articles ... _path.html
Re: send mouseUp to button "buttonxy" with random chance
Okay. Thanks a lot