Page 1 of 1

Huge Animation Problem (scripting needed?)

Posted: Sun Oct 26, 2008 8:17 pm
by metal_head
The following are two very important for me questions.The demo release date depends on them.

I decided to make walk animations for my weapons,BUT there are several problems which I faced after I made the animations:

1-st: My idle animation is long about 25 seconds (so it's long).ok,the idel animation is playing OK,but the problems is not in te idle animation,but in the idle to walk. What's the problem: When I choose the weapon it starts to play the idle animation while I'm standing still,but when I start walking I expect the animation to change to the walking animation,but nothing happens. Why? Because the walking animation starts to play right after the idle animation is finnished,no matter how long it is.So I have to walk for a really long time in order the weapon to play the walking animation,than when I stop,the same thing happens - the walking animation continues to execute till it's over and then the idle animation starts again.I want when my player walks,the weapong to play the walking animation and when the player is standing still - the idle one.I have no idea why is this happening...for example the shooting animation executes as soon as the player presses the shooting button,no matter the current animation.I know that they are different things,but the player has this in the playersetup.ini:

Code: Select all

; number of seconds in each transition animation
; default is 1 seconds if undefined
;
idletowalktime = 0.1
idletoruntime = 0.1
walktoidletime = 0.5
runtoidletime = 0.5
crawltoidletime = 0.5
idletocrouchtime = 1
crouchtoidletime = 1
swimtotreadtime = 1
treadtoswimtime = 1
idletotreadtime = 1
treadtoidletime = 1
swimtowalktime = 0.2
walktoswimtime = 1
jumptofalltime = 0.2
jumptotreadtime = 1
falltotreadtime = 1
slidetocrouchtime = 0.5
slidetoidletime = 0.5
falltocrawltime = 0.2
falltojumptime = 0.2
falltowalktime = 0.2
walktojumptime = 0.2
walktocrawltime = 0.2
crawltowalktime = 0.2
idletocrawltime = 0.1
Theese are some sort of transmision animations or something. They aren't exactly animations,but time in which for example from running the player returns ti his standing animation.So if something like that could be made for the weapons so that the transmision won't look that bad,but smooth.


2nd: While playing the idle or walking animations,which are being loop,there's that short interval of time between each loop,that the weapon doesn't move :(. And that looks terrible for the walking animation,because the walking animation should be looping without any intervals before the animation has start again.

Will I need to make scripted weapons in order to fix this? And if yes...I don't know what I'm gonna do.

Re: Huge Animation Problem (scripting needed?)

Posted: Sun Oct 26, 2008 9:30 pm
by Juutis
1.) That's just the way RF handles the built-in weapons. I guess apart from digging to the source code and changing it, there's nothing you can do about it.

2.) That's a problem with the animation. I suppose your first and last key frames are the same? Try assigning the content of the frame before the last one to a new key frame and remove the last frame. For example if you have a animation that's 10 frames long and the first and tenth frame are the same so it loops. Remove the 10th frame and set the 9th frame to be the last key frame.

Re: Huge Animation Problem (scripting needed?)

Posted: Sun Oct 26, 2008 10:06 pm
by metal_head
Thanks,I'll delete the last frames,they are the same as the first ones,but if that's the way and I have to change the source code,I won't need to fix the second problem :(.So if I want to make the walking animations right,I'll have to make all my weapons scripted,eh? Actually all I'll need is to make only one script for a weapon and after that to make all the weapons using the same script with a few changes,but the problem is making the script,at first I touhg that it would be easy,but after that....there's so much to be made just for a simple weapon.

Re: Huge Animation Problem (scripting needed?)

Posted: Mon Oct 27, 2008 4:06 pm
by metal_head
Sorry for the double post,but is there somewhere I can download a sample weapon script? I need to make all this really fast,because I want to release the demo this week!

Re: Huge Animation Problem (scripting needed?)

Posted: Mon Oct 27, 2008 4:19 pm
by Juutis
You can take a look at Nirhis' weapons (weapon_primary.s, weapon_secondary.s etc.). Though, I think you have already done that. But apart from that, no, I don't think anyone has released such a script. I have a feeling I've written something about scripted weapons on the forums. You could try to search or something.

I have plans to write a little scripted player/weapons tutorial in the future. Got a ton of things to do, though. So it might take a while. :)

Re: Huge Animation Problem (scripting needed?)

Posted: Mon Oct 27, 2008 5:54 pm
by metal_head
Yeah,I took a look at your weapon scripts,but there were things I couldn't understand :(.
For example this:

Code: Select all

wait[ ()
	{
		self.ThinkTime = 0.1;
		PawnRender(false);

		if(GetEventState("InInventory"))
		{
			ModifyAttribute(ammoattribute,bullets,"Player");
			bullets = 0;
			self.think = "ininventory";
			return 0;
		}
So what does this order do?

Code: Select all

if(GetEventState("InInventory"))
Sooo,this is when the weapon is in the inventory,right?

But why there's that:

Code: Select all

ModifyAttribute(ammoattribute,bullets,"Player");
That's just a simple thing I don't get,there are a lot more.

Maybe I can edit your script (make it more simple). And maybe I can add an alt fire command.

The thing I don't understand is why your weapons don't have animations and hands,and in the game they have...
All the weapons I saw in your weapon folder were not animated and didn't have hands. In my game each gun model is animated and has hands.

Re: Huge Animation Problem (scripting needed?)

Posted: Mon Oct 27, 2008 6:32 pm
by Juutis
Alright, my system is a bit different from yours. The biggest difference is that I'm using the primary-secondary-melee system. Basically one pawn acts as ALL of the primary weapons, one as the secondary weapons and one as the melee ones. Only one is active at a time. The pawn itself is the hands and it attaches the weapon (defined in pawn.ini) to itself. So if you look at hands.act, you can see the hands and the weapon actors are only the weapons (also, they're pretty messed up since they share the same skeleton).

So basically your system is a bit simpler. You need only one pawn, and your weapons are armed with the 0-9 keys instead of an inventory. You only have to check if one of the keys is pressed and then remove the current weapon, add a new weapon and start using it (play the arming animation, play the idle animation and shoot).


Code: Select all

wait[ ()
   {
      self.ThinkTime = 0.1;
      PawnRender(false);

      if(GetEventState("InInventory"))
      {
         ModifyAttribute(ammoattribute,bullets,"Player");
         bullets = 0;
         self.think = "ininventory";
         return 0;
      }
'wait' is the order where the weapon pawn is waiting for something to happen (the player opens the inventory or arms the weapon). When the player opens up the inventory, the weapon pawn puts the ammo it has taken from the player attributes back to prevent loss of ammunition, and goes to the order 'ininventory'.

You don't need any of this in your system since you don't have an inventory like that.


The thing I don't understand is why your weapons don't have animations and hands,and in the game they have...
All the weapons I saw in your weapon folder were not animated and didn't have hands. In my game each gun model is animated and has hands.
That's the thing I described earlier. The weapon actors are just weapons and need no animations. The hands actor holds all the animations.


I really hope I'm making at least a tiny bit sense here. I'm having hard time putting all my thoughts into words. :?

Re: Huge Animation Problem (scripting needed?)

Posted: Mon Oct 27, 2008 7:04 pm
by metal_head
Creepy :shock: :D ! OK,I think that maybe I can make something,but I don't know about the reloading function of a weapon. In my game some weapons need to be reloaded and some don't.
I have no idea how to make this. In my game the HUD shows the ammo in the clip and in the magazine,so the player can see how much ammo he has before the next reload and how much ammo he has in the magazine.I don't know how would I make this with the scripted weapon.

And also how do I position the weapon,you told me in a simmilar post,but I couldn't understand really well (not asking for exmplanation,just saying).

Re: Huge Animation Problem (scripting needed?)

Posted: Mon Oct 27, 2008 7:20 pm
by Juutis
I don't know about the reloading function of a weapon. In my game some weapons need to be reloaded and some don't.
Well, you're gonna have a variable holding the amount of ammo the weapon has left, right? Or maybe an attribute. The reloading is nothing else than playing the animation during which you can't shoot, and then increasing the weapon's ammo variable. In the weapons that don't need to be reloaded you can work directly with the player attribute that holds the amount of total ammo the weapon has, making the thing even simpler.
In my game the HUD shows the ammo in the clip and in the magazine,so the player can see how much ammo he has before the next reload and how much ammo he has in the magazine.I don't know how would I make this with the scripted weapon.
Sorry, I don't quite follow you. 'Ammo in the clip and in the magazine'? A clip and a magazine are virtually the same thing: The structure holding the rounds in a firearm. Or do you mean like the rounds left in the weapon and the total rounds? You could have two different player attributes. One for the total rounds and one for the rounds left in the gun, and then draw them on the HUD. That's how I did it in Nirhis.
And also how do I position the weapon,you told me in a simmilar post,but I couldn't understand really well (not asking for exmplanation,just saying).
The command PositionToPawn() (or PositionToPlayer()) does that. It moves the weapon pawn to the origin of another pawn (or the player). You can also define a Y-offset to set the weapon to the same height with the camera.

Re: Huge Animation Problem (scripting needed?)

Posted: Mon Oct 27, 2008 7:32 pm
by metal_head
Or do you mean like the rounds left in the weapon and the total rounds?
Yeah,that's what I ment :oops:

It's definetely gonna be a lot of work.
I still don't have an idea how I'm gonna make the weapon reload.So I'll have to make two attributes for a weapon,one for the ammo in the weapon and one for the total ammo.And when fireing a projectile,I'll have to make both of the attributes to modify,right?

Re: Huge Animation Problem (scripting needed?)

Posted: Mon Oct 27, 2008 7:53 pm
by Juutis
metal_head wrote:It's definetely gonna be a lot of work.
I still don't have an idea how I'm gonna make the weapon reload.So I'll have to make two attributes for a weapon,one for the ammo in the weapon and one for the total ammo.And when fireing a projectile,I'll have to make both of the attributes to modify,right?
Yes, that would be the safe way. You could also reduce the total ammo every time you reload the weapon and only reduce the ammo in the magazine when firing. But then you'd have to be careful not to lose any ammo in the transitions.

And yes, it's a lot of work. It's complicated but once you get the basics done it's a breeze to add new stuff, such as secondary fire, iron sights, inaccuracy, semi-automatic weapons etc.

Re: Huge Animation Problem (scripting needed?)

Posted: Tue Oct 28, 2008 5:11 pm
by metal_head
Well,one's for sure,the demo won't have scripted weapons,because I'm planning to release it this week,but I'll work on a scripted weapon system for sure! Let's just leave this question away,and when I need help with the scripting,I'll just write here.



So this topic is not closed or the question solved,but just for a few time not active,but when the time comes (arround christmas :D ) I'll bring itback to life :D