The Daily Click ::. Forums ::. Klik Coding Help ::. "IF" help
 

Post Reply  Post Oekaki 
 

Posted By Message

zharkman



Registered
  01/03/2009
Points
  27
1st March, 2009 at 04:47:54 -

hi there! im new with this product and all, but yet, i cant find a double conditional form... lets put it this way, i want my character to shoot, but, to do that he needs to pick up the gun, so it will be like this:
if "player" flag "1" is "on"
THEN:
---if "X" pressed
---THEN:
-----shoot "bullet"
---ELSE
ELSE:
nothing
or.. sumthing like this... can any1 tell a good way for this to work? it shoulf be considered that you can use different weapons too, and switch between them with "A" or "S"(if u can also help me on this one i would love you! )

 
none

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
1st March, 2009 at 04:58:03 -

Rather then building up multiple loops like that, MMF's event editor allows you to add multiple conditions that need to all fire before the actions in the line are actually activated. So in this example, you would probably do something like:
* X Pressed
+ Flag 1 is ON
>>Shoot "Bullet"

Copy and paste event as needed.

Nothing from this point down matters, don't read if you don't care.

The order of the conditions GENERALLY don't matter, however when you get into more complex scenarios, it's important to play them out in your head, especially if you want to avoid impacting either performance or you want more complex scenarios to actually play out in a controlled manner. For example, in this case, if we check to see if X is pressed before we check to see if the Flag is on, then we will save MMF from having to check to see if the Flag is on every time, before then checking to see if X is pressed. If it checks to see if X is pressed first, and it's not, then it can just skip over the event right then and there, which can speed the process up.

The listed order of conditions is usually one of the main reasons why people accuse MMF of having glitches, so it's important to make sure you play around with the order of conditions and actions and even events as a whole, before you jump to the conclusion that MMF is glitched. The problem may lie more so in your lack of respect to the flow of MMF, rather then MMF's misinterpretation of what you're telling it to do.


Edited by Silveraura

 
http://www.facebook.com/truediamondgame

zharkman



Registered
  01/03/2009
Points
  27
1st March, 2009 at 05:17:54 -

i think i understand what you mean, but the switching between events, is kinda confusing too, so it makes it kinda harder for me to think twice the programming (which is what i do to understand my own coding)
i will try that tomorrow and tell you how it came out, okay? thank you!

 
none

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  374

VIP MemberCardboard BoxThe Cake is a Lie
1st March, 2009 at 05:27:37 -

It was abit confusing, but I think what your overall goal is to have two different weapons that shoot different ammo types, right?

You're gonna need a counter and a different flag for each weapon.

The counter is used to change weapons if you have more than one weapon, and the flags are to make sure you can use a certain weapon. If they're off you can't, and if they're on you can(Or vice versa).

So, when you pick up a certain weapon (in this case, a gun), set it's flag on. <This makes sure you can use the weapon when you DO have it.>

Weapon select

•<Whatever triggers this event. Let's take •User presses "1" for example.>
+<Flag assigned to certain weapon> is on
-Set counter to 1

•Counter equals 1
-Change animation of Gun to pistol

<Here's what you've done. When you pressed 1 while a certain flag was on, you set the counter to one. When the counter equals 1, your gun's animation changed to a pistol. You can do this over and over again until you have applied this to all of your weapons. All you need to do for the top event is change the key that's pressed, a different flag, and what the counter is set to. And in the bottom event just change "•Counter equals 1" to •Counter equals 2(or whatever other number you want), then change the animation to your desired weapon.>


Firing

•Upon pressing "X"
+animation "pistol" of gun is playing
-fire pistol bullets

<Now what you've done here is simple. When you pressed X and a certain animation is playing, your gun shot a certain ammo type. Remember, if you have more than one weapon just repeat this process, only change •animation "pistol" of gun is playing to a different animation, then change the bullet type to whatever the type of bullet the gun fires.>

Hoped this helped.

 
An old and washed up once-kid

Bibin

At least 9001

Registered
  01/07/2005
Points
  308

Silver Cup WinnerGOTW Winner!Has Donated, Thank You!VIP Member
1st March, 2009 at 05:41:52 -

In essence, he's saying that your THEN condition will have two conditions in it:

If Player 1 Flag 1 is on & X is pressed
THEN
--shoot "bullet"

See? To add a second condition (the &), right click the event and click add new condition.

 
n/a

zharkman



Registered
  01/03/2009
Points
  27
1st March, 2009 at 06:18:19 -


Originally Posted by Bibin
In essence, he's saying that your THEN condition will have two conditions in it:

If Player 1 Flag 1 is on & X is pressed
THEN
--shoot "bullet"

See? To add a second condition (the &), right click the event and click add new condition.


yah thats more like what i ment, i tried every other option but it didnt work for me thank you all for your help, i found diferent uses for your scripts thank you again!

 
none
   

Post Reply



 



Advertisement

Worth A Click