A Rather Embarrassing Problem

Hi, guys. Its been about two seconds since my last thread… :o

So I thought I would make a tutorial on doing combo attacks for the community because every one is asking about how to do them. So I am almost done with this tutorial, but the script doesn't work! :o:o:o:o:o:o

Sorry. This is embarrassing because I am trying to teach others, but need to be taught how to do so first!

Alright. So I have a nice little script that…

better yet, just check out the file. It is all explained in there. My problem is that it doesn’t play the second animation and when it plays the first one, it doesn’t play the right frames of it!

So here is the blend! I hope you guys can check it out so I may complete my tutorial! :o -YA

The script as well -

#imports GameLogic (duh)

import GameLogic



#Gives the controller that runs the script a name

cont = GameLogic.getCurrentController()



#Gives the object that owns the script a name

own = cont.owner



#Defines which sensor to look for when player wants to attack

attack = cont.sensors["A"]



#If the attack button is pressed

if attack.positive:

	

	#If the timer is past the preffered interval time

	if own["Timer"] > 0.700:

		

		#Set next played animation to part 1

		own["attacknum"] = 1

		

		#If sequence is at part 1

		if own["attacknum"] == 1:

			

			#Make swishing noise

			cont.activate("MakeSwish")

			

			#Play first part of attack animation

			cont.activate("Attack1")

			

			#Set the next played animation to part 2

			own["attacknum"] = 2

			

			#Set the timer back to 0

			own["Timer"] = 0.000

			

			#If the timer is at or below the preffered interval time

	if own["Timer"] <= 0.700:

		

		#If sequence is at part 2

		if own["attacknum"] == 2:

			

			#Make swishing noise

			cont.activate("MakeSwish")

			

			#Play second part of attack animation

			cont.activate("Attack2")

			

			#Set the next played animation to part 3

			own["attacknum"] = own["attacknum"] + 1

			

			#Set the timer back to zero

			own["Timer"] = 0.000

		

		

		#If sequence is at part 3 (elif to make script run faster)

		if own["attacknum"] == 3:

			

			#Make swishing noise

			cont.activate("MakeSwish")

			

			#Play third part of attack animation	

			cont.activate("Attack3")

			

			#Set next played animation to part 1

			own["attacknum"] = 1

			

			#Set timer back to 0

			own["Timer"] = 0.000

		

Attachments

comboattack.blend (726 KB)

Here you go, btw you don’t need to import GameLogic unless your importing it as a different term like I did in this version.

I learnt something from your script as well, I didn’t know you could activate actuators without calling them :slight_smile:

Nice animations :slight_smile:

Attachments

comboattack.blend (724 KB)

Thank you! So where did I go wrong with this?

From memory when you pressed “A” it did the first attack correctly, but then it set “attacknum” to “2” and “own[“Timer”]” to “0”. Straight after the first attack code, a another “if” command came up seeing if “own[“Timer”]” was lower then 0.7 and if “attacknum” was equal to “2” which it was because of the first attack setting the values before to make it true.

This is where it bugged because it you were actually running 2 attacks in 1 script run.