PDA

View Full Version : Call of Duty 2 Play Animation



croni1012
25th September 2015, 21:26
Hi,

I am trying to develop the Black Ops Zombie mode on Call of Duty 2 and I would like to know if there is possible to play animation on a script_model by script.
Thanks for the answer.

croni1012

php
26th September 2015, 07:21
Short answer; no

Other than that yes,

1) Multiple models and play them using ent setmodel("xmodel/model[1-24]"); where 1-24 is the animation frames in models (it takes up lots of size though the higher the animation frames)
2) Use a player entity/bot or a clone of a player using player cloneplayer(); and use libcod to set the animation legsAnim/torsoAnim.

croni1012
26th September 2015, 12:31
Short answer; no

Other than that yes,

1) Multiple models and play them using ent setmodel("xmodel/model[1-24]"); where 1-24 is the animation frames in models (it takes up lots of size though the higher the animation frames)
2) Use a player entity/bot or a clone of a player using player cloneplayer(); and use libcod to set the animation legsAnim/torsoAnim.

1) How many model I can add to the mod?
2) Can I control the bot player?

Tally
26th September 2015, 13:28
1) How many model I can add to the mod?
2) Can I control the bot player?

You can theoretically precache 1000 xmodels, but you will likely crash the server with the index-model overflow error before you get there, because maps have models in them to start with.

What type of animations are you trying to run? First-person ones? Or world animations?

For world animations, you can force an animation on a player or bot by putting the animation in a weapon file, and forcing the weapon on the player/bot. This is how Meatbot and Pezbot make the bots run, climb, throw a grenade, or shoot. This is very advanced stuff, and you are likely to need someone with experience to do it for you.

For first-person animations, you are pretty much stuck with having to create xanims and put them in a weapon file. Again, you force the weapon on a player/bot, and play the xanim.

croni1012
26th September 2015, 13:51
You can theoretically precache 1000 xmodels, but you will likely crash the server with the index-model overflow error before you get there, because maps have models in them to start with.

What type of animations are you trying to run? First-person ones? Or world animations?

For world animations, you can force an animation on a player or bot by putting the animation in a weapon file, and forcing the weapon on the player/bot. This is how Meatbot and Pezbot make the bots run, climb, throw a grenade, or shoot. This is very advanced stuff, and you are likely to need someone with experience to do it for you.

For first-person animations, you are pretty much stuck with having to create xanims and put them in a weapon file. Again, you force the weapon on a player/bot, and play the xanim.

World animations. I wrote a mod which like Black Ops Zombie bot mod. The zombies are script models with hitbox, and climb into the house where the players are playing. Unfortunatelly, the zombies moving and attacking are 50-60 xmodels, and the climbing is 30. But it would be lot nicer and detailed if I can play anim on them and not need a lot of xmodel...

filthy_freak_
26th September 2015, 14:11
One issue your going to run into if you use custom animations;

If the player joined a previous server before joining yours without relaunching, the playeranim.script file located in the mp folder will not be reloaded. This is bad because for custom animations to load, they need to be added to that file. This isn't fixable even with libcod.

That being said, you can use libcod to do what your describing. See http://killtube.org/showthread.php?2225-player-setAnim(string)
You can move bots with moveTo() (stock function) or you can use http://killtube.org/showthread.php?2241-Player-movement-amp-grenades if you wish to move bots without them clipping through objects.

If you wish to see a bot server currently using the libcod custom animation method - check out 5.9.90.148:28960/199.233.246.208:28960 (1.0) or 5.9.90.148:28962/199.233.246.208:28962 (1.3).

Tally
26th September 2015, 14:25
World animations. I wrote a mod which like Black Ops Zombie bot mod. The zombies are script models with hitbox, and climb into the house where the players are playing. Unfortunatelly, the zombies moving and attacking are 50-60 xmodels, and the climbing is 30. But it would be lot nicer and detailed if I can play anim on them and not need a lot of xmodel...

Do you have the original animations converted to COD2? Because there is no point even talking about this if you haven't.

Tally
26th September 2015, 14:27
One issue your going to run into if you use custom animations;

If the player joined a previous server before joining yours without relaunching, the playeranim.script file located in the mp folder will not be reloaded. This is bad because for custom animations to load, they need to be added to that file. This isn't fixable even with libcod.

That being said, you can use libcod to do what your describing. See http://killtube.org/showthread.php?2225-player-setAnim(string)
You can move bots with moveTo() (stock function) or you can use http://killtube.org/showthread.php?2241-Player-movement-amp-grenades if you wish to move bots without them clipping through objects.

If you wish to see a bot server currently using the libcod custom animation method - check out 5.9.90.148:28960/199.233.246.208:28960 (1.0) or 5.9.90.148:28962/199.233.246.208:28962 (1.3).

Correct me if I am wrong, but the playeranim.script file is a server file. It is not a client file. The server will use the one on the server - not the one in the client's files. So, it doesn't matter where the client has been before he gets to the server, the server will load its files on the player as soon as he connects.

IzNoGoD
26th September 2015, 14:31
You can only precache 256 xmodels, which is also limited by map models AND trigger use_touch. I found this out the hard way when a certain map with 100 trigger use_touch's crashed my mod

croni1012
26th September 2015, 14:39
Do you have the original animations converted to COD2? Because there is no point even talking about this if you haven't.

Yes, I have.

IzNoGoD
26th September 2015, 14:51
You could even consider just using bot-players instead of xmodels, you CAN play anims on those

croni1012
26th September 2015, 15:49
You could even consider just using bot-players instead of xmodels, you CAN play anims on those

Could you tell me how can I add and control the bot players? And how can I play anims on it?

IzNoGoD
26th September 2015, 18:12
Look at filthyfreak's started threads, theres some info on that there

filthy_freak_
27th September 2015, 07:51
Correct me if I am wrong, but the playeranim.script file is a server file. It is not a client file. The server will use the one on the server - not the one in the client's files. So, it doesn't matter where the client has been before he gets to the server, the server will load its files on the player as soon as he connects.

The playeranim.script might be loaded, but the client does not parse/cache it on rejoin. When a client connects to a server it caches a list of ALL animations the server uses. Death animations, first person animations, world animations are all stored into a client side array. This doesn't get reset/reloaded when joining another server. I can't think of a better way to explain it. If you want to test, run the meatbot mod, join a regular server, chill for a minute and then join the meatbot server. It will kick you and return an error similar to "Unknown token: bot_stand" due to the anim files not being reloaded.

I'v spent some effort attempting to fix it, and even found the source of the problem. Problem is the issue is client-side, so cannot be patched using libcod.

randall
28th September 2015, 19:57
There are two ways to spawn bots:
1.) Use script_models

Advantage:

It is the cheapest solution, you dont have to rent 64-slots server.

Disadvantage:

You have to model and precache every frame of the motion. The max precachable model limit is low.


2.) Or spawn bot players

Advantage:

Less server resource needed.
Better hitbox.

Disadvantage:

It is hard to make good-looking motion.
You must restart the server to free the slots.



In the first case I can recommend you my botmod. Download here (http://www.moddb.com/mods/randall).
If you choose the player bots, search for meatbot on moddb.
Maybe the best solution if you combine the bot players and the libcod. There are many tutorials on the forum how to use the extension (eg. change player's anim, it may be useful in the future).

Tally
28th September 2015, 20:05
The playeranim.script might be loaded, but the client does not parse/cache it on rejoin. When a client connects to a server it caches a list of ALL animations the server uses. Death animations, first person animations, world animations are all stored into a client side array. This doesn't get reset/reloaded when joining another server. I can't think of a better way to explain it. If you want to test, run the meatbot mod, join a regular server, chill for a minute and then join the meatbot server. It will kick you and return an error similar to "Unknown token: bot_stand" due to the anim files not being reloaded.

I'v spent some effort attempting to fix it, and even found the source of the problem. Problem is the issue is client-side, so cannot be patched using libcod.

I didn't know about that. So, thanks for the info. It never ceases to amaze me that even after 10 years of modding, there is still something to learn.

vanfreddy
28th September 2015, 21:10
hi all
another big Disadvantage using Bots ist the problem when the hitboxes are touching each other u cant hit them with weapons, only splash damage works like grenades .i could never fix it only solution i know is let them never touch each other

filthy_freak_
29th September 2015, 01:46
Disadvantage:

You must restart the server to free the slots.



This can be fixed using the free_slot function in libcod.


another big Disadvantage using Bots ist the problem when the hitboxes are touching each other u cant hit them with weapons, only splash damage works like grenades

This can be fixed by disabling player collision using libcod.