April 19, 2024, 03:18:31

Author Topic: Activating/deactivating animations through script?  (Read 6521 times)

Offline DreamorCZ

  • Petty Officer
  • **
  • Posts: 110
  • Karma: 1
    • View Profile
    • Czech Gaming Nexus
Activating/deactivating animations through script?
« on: February 01, 2011, 11:47:07 »
Here is a simple question about difficult matter: Can be animations like #anim attacked# or #anim def# activated/deactivated through script?

For what?: Jump in/out animations (Destiny engine charging, Galactica's docks etc.). In-game cinematic without need of CGIs for simple animations. And other things you can think off.
Editor in Chief at http://www.cgnexus.eu/

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
Re: Activating/deactivating animations through script?
« Reply #1 on: February 01, 2011, 12:37:38 »
Yep, there are two commands available:

AnimateShip(ship, animate)
... for starting or stopping the default animation loop (#anim def x y#)

PlayShipAnim(ship, anim_name, backward)
... for playing back any other named animation (#anim <name> x y#)

Set "backward" to something non-zero for reverse playback, so as to revert to the original state before the animation.

Offline DreamorCZ

  • Petty Officer
  • **
  • Posts: 110
  • Karma: 1
    • View Profile
    • Czech Gaming Nexus
Re: Activating/deactivating animations through script?
« Reply #2 on: February 01, 2011, 15:31:14 »
That's more than great, actually. This way might be possible to create any animation we need by adding these commands as include to the mission folder. Theoretically we should be able to easily add weapon fire animation and jump animation with help of some conditional scripts.

I would do some testing of this theory myself but my scripting knowledge is too much basic for this. So, would someone here be willing to spare some of his/her time to create a script for weapon animation for me or even test it right away?
Editor in Chief at http://www.cgnexus.eu/

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
Re: Activating/deactivating animations through script?
« Reply #3 on: February 01, 2011, 19:56:19 »
I don't think fire animations will work that way. The animation would need to be create in the turret's model file, which is then ingame attached to the ship (possibly multiple times for different weapon slots) - I don't know if you can play back any turret animations by using PlayShipAnim().

If the turret is directly modelled into the ship's mesh, you could create a firing animation for each of these turrets (#anim turretFire1#, #anim turretFire2#, etc.) and play them back (maximum of only 10 animations available, though, it seems). The problem is, that you'd have to choose the correct animation depending on what weapon slot currently fires... and I don't know a way to actually find this piece of information with scripting.

Sure, you can request a Fired event for all weapon systems and then get the firing weapon in E.location ... but how do you get the actual weapon slot? How do you know what of your X fire animations to play?

Jumping animations surely are possible, although you'd have to add that animation to all models separately in order to support jumping animations for all of your ships.

Offline DreamorCZ

  • Petty Officer
  • **
  • Posts: 110
  • Karma: 1
    • View Profile
    • Czech Gaming Nexus
Re: Activating/deactivating animations through script?
« Reply #4 on: February 01, 2011, 21:03:38 »
True, there is more then one problem. I'm not entirely sure but I think there can be added script witch can denote what happens when player activates certain device.

Well, I'm going to learn much more about scripting soon and then I will try these impossible things myself and maybe will find some solutions.

Anyway, thank you Arparso.
Editor in Chief at http://www.cgnexus.eu/