UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

[FUNCTIONS] Animation functions for script_models

broken avatar :(
Created 8 years ago
by WhiteDevil
0 Members and 1 Guest are viewing this topic.
4,202 views
broken avatar :(
×
broken avatar :(
Location: nlNederland
Date Registered: 14 August 2013
Last active: 7 years ago
Posts
50
Respect
Forum Rank
Rotting Walker
Primary Group
Member
Personal Quote
Wassaaap
Signature
×
WhiteDevil's Groups
WhiteDevil's Contact & Social Links
4 Functions for managing Animations on a script_model.

When using this script it's expected you already have the following things:
 - xmodel with bones.
 - xanim that can be played on the xmodel.
 - animtree that contains the xanims that can be played on the xmodel.
 - All of these (xmodel, xanim and animtree) should be included in your mod.

Documentation
Spoiler: click to open...
play_anim_looped
  • @Name: play_anim_looped
  • @Summary: An looped animation will be played on an entity. That's currently not playing a animation.
  • @CalledOn: <entity>: A script_model with bones.
  • @MandatoryArg: <anim>: The animation that should be played(This name should be in your Animtree).
  • @Example: xmodelEntity play_anim_looped(%banana_peel);


stop_anim_looped
  • @Name: stop_anim_looped
  • @Summary: An looped animation will be stopped.
  • @CalledOn: <entity>: A script_model with bones that is currently playing a looped animation.
  • @Example: xmodelEntity stop_anim_looped();


play_anim_once
  • @Name: play_anim_once
  • @Summary: An animation will be played once on a entity.
  • @CalledOn: <entity>: A script_model with bones. That's currently not playing a animation.
  • @MandatoryArg: <anim>: The animation that should be played(This name should be in your Animtree).
  • @OptionalArg: <string>: The notify to send. When undefined a random value will be created(This value is returned by the function!);
  • @Return: <string>: The notify to send.
  • @Example: xmodelEntity play_anim_once(%banana_peel, "banana_peeling");


stop_anim_once
  • @Name: stop_anim_once
  • @Summary: An entity that's currently playing a one time animation will be stopped.
  • @CalledOn: <entity>: A script_model with bones that is currently playing a one time animation.
  • @Example: xmodelEntity stop_anim_once();

Setup

    1) Download the script: https://mega.nz/#!rEcXxIRL!Hlzq9LDFxY27vo5QzhS-upvwReL0x08SKo8eJfqIsv8
    2) Copy the script to MODNAME/maps/_easyAnimation.gsc
    3) Open MODNAME/maps/_easyAnimation.gsc you just pasted, and go to line 5. Change  ANIMTREE to the animtree your are using
Code Snippet
Plaintext
//Define the animtree you are using.
#using_animtree( "ANIMTREE" );
    4) You can change the other settings if you want they are one line 12, 14 and 16.
Code Snippet
Plaintext
//
// Note: If you are publishing your map, you should set them all to false.
//
//Errors are shown by default, change it to false to suppress them.
level.show_anim_errors = true;
//Warnings are shown by default, change it to false to suppress them.
level.show_anim_warnings = true;
//Information is hidden by default, change it to true to show them.
level.show_anim_info = false;
    5) Don't forget to include it in your launcher!, make sure you checked the script like this:
Spoiler: click to open...



Usage
 1) Include _easyAnimation.gsc in your script, after that define your animtree again.

Example Script
Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;
#include maps\_loadout;

//Inludes _easyAnimation.gsc
#include maps\_easyAnimation;
//Your animtree
#using_animtree( "cube" );
//This animtree contains the animation used below: %viewmodel_cube_rotate

main(){
wait(10);
//Get the script model
cube = GetEnt("cube", "targetname");

//Plays a looped Animation on the script model
cube play_anim_looped( %viewmodel_cube_rotate );
wait(5.0);
//The looped animation will be stopped.
cube stop_anim_looped();

wait(10);
//Plays a Animation only once on the script model
cube play_anim_once( %viewmodel_cube_rotate );
}





Important
  • It doesn't matter wether your xanim is looped or not in asset manager it only plays once when play_anim_once is used.
  • Animation that are not looped in asset manager don't loop when play_anim_looped is used...


Having problems with including your xanim / animtree? Read this!
Spoiler: click to open...
Follow the following steps.
  • In asset manager export the XANIM with the following settings:
    • Use Bones = true
    • Type = Relative
    • Looping = true / false (depends on what you want)
  • Create / modify an existing animtree
    • Go to raw/animtrees and create/modify the desired animtree and add your xanim to it.
  • in your mod.csv add the created animtree and xanim. The XANIM must be included before the animtree! else it wont work...
    • xanim,XANIMNAME
    • rawfile,animtrees/ANIMTREENAME.atr



I hope this will help some people!  :) If you use this script don't forget to add me to the credits  ;)
Last Edit: November 24, 2015, 01:19:35 pm by WhiteDevil
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Cool share man.  ;D You may, or may not, up to you, want to add to compile the maps patch when changing or adding animtrees. At least I have to. I do things similar but use arrays in my main and thread functions for each set of models, with #using_animtree( "ANIMTREE" ); before the function for each... I've always put the animtree at the end, by chance, but had no clue that it mattered, lol, that is good to know.
Last Edit: November 24, 2015, 02:14:19 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: nlNederland
Date Registered: 14 August 2013
Last active: 7 years ago
Posts
50
Respect
Forum Rank
Rotting Walker
Primary Group
Member
Personal Quote
Wassaaap
×
WhiteDevil's Groups
WhiteDevil's Contact & Social Links
Cool share man.  ;D You may, or may not, up to you, want to add to compile the maps patch when changing or adding animtrees. At least I have to. I do things similar but use arrays in my main and thread functions for each set of models, with #using_animtree( "ANIMTREE" ); before the function for each... I've always put the animtree at the end, by chance, but had no clue that it mattered, lol, that is good to know.

Thanks man  :).

When adding it to your mod.csv(The .csv your launcher uses in the build mod section) you don't have to compile your map or map_patch, building your map is good enough. If you add it to your MODNAME.csv or MODNAME_patch.csv then yes you have to compile your map or map_patch depends on wicht csv youh have used.

When i was testing with this i didn't understand why it didn't work when i include first the xanim and then the animtree in my csv everything went fine. I'm not sure why this is.. :-\
Last Edit: November 24, 2015, 02:37:21 pm by WhiteDevil
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Thanks man  :).

When adding it to your mod.csv you don't have to compile your map or map_patch, building your map is good enough. If you add it to your MODNAME.csv or MODNAME_patch.csv then yes you have to compile your map or map_patch depends on wicht csv youh have used.

When i was testing with this i didn't understand why it didn't work when i include first the xanim and then the animtree in my csv everything went fine. I'm not sure why this is.. :-\

Oh, so when I
Code Snippet
Plaintext
include,robots
in my mod.csv for my csv in zone_source that has the model, xanim, and animtrees inlcuded in it, (cause that is how I do things), that is what is causing me to compile my patch...? Interesting. I thought it was just always needed. Takes a second, I think I will still do it that way to be organized and it makes adding to other maps easier for me, lol. Thanks for the info though.
Last Edit: November 24, 2015, 02:46:26 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: nlNederland
Date Registered: 14 August 2013
Last active: 7 years ago
Posts
50
Respect
Forum Rank
Rotting Walker
Primary Group
Member
Personal Quote
Wassaaap
×
WhiteDevil's Groups
WhiteDevil's Contact & Social Links
My english isn't very good, so i don't quite understand what you are saying but it works like this:

Almost every mod created with script_placer has 3 .csv files:
  • CODAWROOT/zone_source/MAPNAME.csv
  • CODAWROOT/zone_source/MAPNAME_patch.csv
  • CODAWROOT/mods/MODNAME/mod.csv

When you are compiling your MAP or MAP_patch and you have the option build fastfile selected the content of the .csv will be added to your fastfile of your mod.

This is how your fastfiles get updated from each .csv file:
  • Compiling your MAP with build fastfile selected will add the contents from CODAWROOT/zone_source/MAPNAME.csv to your CODAWROOT/mods/MODNAME/MAP.ff
  • Compiling your MAP_patch with build fastfile selected will add the contents from CODAWROOT/zone_source/MAPNAME_patch.csv to your CODAWROOT[/b]/mods/MODNAME/MAP_patch.ff
  • Building your MOD with build mod.ff selected will add the contents from CODAWROOT/mods/MODNAME/mod.csv to your CODAWROOT/mods/MODNAME/mod.ff

So when you're working on your map, and you don't edit your MAP_patch.csv there is no need for compiling your MAP_patch.

Same goes for when you are working on your map in radiant and you have changed something in radiant for example you added a wall or something. You only have to compile your MAP and not your MAP_patch or build your mod.

You only build your mod when you have made changes to included files that are in you CODAWROOT/mods/MODNAME/mod.csv. Or the files that are in your IWD File List.


I hope you understand this :P
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
That is great info, you should put that in another tut really, cause lot of people wonder why they are checking each box and what is happening when you do.

I create csvs for everything myself, and perhaps that is why I have to do things the way I have to, not sure. I've talked to others that run into the same issues that don't do things my way, but who knows. Half the time I think if I pat my belly and rub my head, then spin around, it works, when it didn't 3 seconds ago, lol. When I add csvs that include atrs, I have to at least compile patch... unless I am miss-remembering and I have to compile the whole map. And anytime I add a anim to generic_human.atr or something like that, I have to compile  :-\  I guess I am wrong though and maybe I have just formed a habit, lol, I don't know.

Spoiler: click to open...
What I do is create separate csvs for everything, weapons, animations, fx, or anything I want to group together like my perk system assets or ammo counters. Then to add a feature to a map, all I do in mod.csv is include, thatfeaturescsv and I now have that feature without having to add all the things individually and figure things out again... But that is really unrelated, I just thought it may be causing me to have to compile.

Love the name btw, makes me laugh every time I see it, Equinsu Ocha, lol.
broken avatar :(
×
broken avatar :(
Location: nlNederland
Date Registered: 14 August 2013
Last active: 7 years ago
Posts
50
Respect
Forum Rank
Rotting Walker
Primary Group
Member
Personal Quote
Wassaaap
×
WhiteDevil's Groups
WhiteDevil's Contact & Social Links
If you include all your csv's in your mod.csv the only thing you have to is build your mod. No need for compiling.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 4 years ago
Posts
6,877
Respect
1,004Add +1
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social Links[email protected]HarryBo21HarryBo000
That is great info, you should put that in another tut really, cause lot of people wonder why they are checking each box and what is happening when you do.
Its in my memory management tut. Explains what csvs are compiled and when / how

Quote
If you include all your csv's in your mod.csv the only thing you have to is build your mod. No need for compiling.
This is good / preferable - or just calling those csvs "from" mod.csv. Be aware tho that impact FX do not work here ( for... um... reasons...? Never worked out why, but they "must" go in mapname.csv )
Last Edit: January 09, 2016, 03:57:21 am by Harry Bo21

 
Loading ...