Jump to content

Animation and script troubles.


Jojash

Recommended Posts

So recently, I've been trying to write a script that will make an NPC change their weapon when a key is pressed. So far, this is what I've got:

 

		If IsControlPressed 18
			If InventoryCounter != 1
				Set InventoryCounter to 1
			Endif
		Elseif InventoryCounter
			If DrawCounter == 1
				TapControl 7
				Return
			Endif
			Set ItemCounter to ListGetCount EmbeddedWeapons + 1
			Set RobotItem to 0
			Set EquipCounter to ListGetFormIndex EmbeddedWeapons RobotWeapon
			Label 20
			Set ItemCounter to ItemCounter - 1
			Set RobotItem to ListGetNthForm EmbeddedWeapons ItemCounter
			If ItemCounter > EquipCounter
				GoTo 20
			Else
				If RobotPosition.GetItemCount RobotItem <= 0
					If ItemCounter == 1
						Set EquipCounter to ListGetCount EmbeddedWeapons
						Set ItemCounter to ListGetCount EmbeddedWeapons + 1
					Endif
					GoTo 20
				Else
					RobotPosition.UnequipItem RobotWeapon
					Set EquipCounter to ItemCounter
					Set RobotWeapon to RobotItem
					RobotPosition.EquipItem RobotWeapon
				Endif
			Set InventoryCounter to 0
			TapControl 7
			Return
		Endif

 

However, when I test this, the NPC it's called on just seems to freeze. I'm must admit, I'm rather stumped as to what I've done wrongly here...

 

My second issue, is to do with animations. I've been trying to get an NPC to fire their weapon when a key is pressed, which they will do, but instead of firing in front of them, as you might expect, the projectiles will instead fire into the ground directly below the NPC. From what little information I've been able to gather, I think this has something to do with the "Equip" anim group. Here's the script dealing with that, it's rather long, so I've put it in a spoiler tag:

 

 

  Reveal hidden contents

 

 

Any help would be greatly appreciated! :)

Link to comment
Share on other sites

Hi Jojash,

I expected there would be major problems with the attack procedure. I hope I will have some time during the weekend to run some tests myself and see if I can help you work this out. In the meantime, if you haven't already, you might want to look into using FireWeapon while playing the attack animation.

Link to comment
Share on other sites

I'm actually already using that, as I've said, I can get the weapon to fire... just not in the right direction. I'm pretty certain that it's got something to do with the "Projectile Node". Anyway, I shall look forward to the weekend, then! :)

Link to comment
Share on other sites

  • 5 weeks later...

That weekend is long passed, and I haven't been around for quite a while.

I think I have a pretty good and workable solution for your problem. That is, if you're still looking.

Link to comment
Share on other sites

I am indeed still looking! I've not been working on it recently, but it only has a couple of things left to do anyway, including the firing. Thank you for getting back to me! :smile:

Edited by Jojash
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...