Aller au contenu

Photo

[Solved] Overriding Creatures Ambient Behaviour


  • Veuillez vous connecter pour répondre
14 réponses à ce sujet

#1
Nattfodd

Nattfodd
  • Members
  • 321 messages
I want to make a custom script to handle the Overriding Ambient Behaviour of creatures of an area, instead of using the "Variables" field in Area Editor.

If i understood well, by default this is handled by the "sys_ambient_h" script.
If i want to handle it by myself where i have to do this? in the starting module script, the area script or something else?
I'm focusing on animations of creatures. I can use only the animations listed in ambient_ai.xls or i can use other animations (such as any .ANI file)?
I read in the wiki that the Ambient Behaviour begins when the player moves within 50m of a creature and ceases when the player remains more than 50m. Could this parameters  be changed? If yes how?
Maybe with the "Ambient_Start()" function described in http://social.biowar...r#sys_ambient_h

Thanks.

Modifié par Nattfodd, 18 janvier 2010 - 07:06 .


#2
hunharibo

hunharibo
  • Members
  • 126 messages
You may extend the ambient_ai.xls with any animation you wish. It is an m2da, just add rows to it with the correct format then save as gda.

Area script would work fine, but you would have to iterate through all objects and test if setting ambient animation is valid on them (e.g. they are not placeables). I have tried ambient_start() myself, and it didnt work, although the description suggests it should. Maybe i did something wrong.

You may easily change the behavior of the ambient system to be "always on" regardless of player distance. For this, set the ambient_system_enabled to 2 instead of 1.



Hope this helps.

#3
Nattfodd

Nattfodd
  • Members
  • 321 messages

hunharibo wrote...

You may extend the ambient_ai.xls with any animation you wish. It is an m2da, just add rows to it with the correct format then save as gda.

Can i create an "ambient_ai_my_anims.gda" to add lines without editing the "ambient_ai.gda"?

Area script would work fine, but you would have to iterate through all objects and test if setting ambient animation is valid on them (e.g. they are not placeables).

So do you suggest that using a dinamic loop to parse all objects in area to test if it is a creature is better than using a direct "GetObjectByTag()"?

You may easily change the behavior of the ambient system to be "always on" regardless of player distance. For this, set the ambient_system_enabled to 2 instead of 1.

Do you mean i can set the local variable AMBIENT_SYSTEM_STATE to 2?

thanks.

Modifié par Nattfodd, 11 janvier 2010 - 05:49 .


#4
hunharibo

hunharibo
  • Members
  • 126 messages
1. You certainly can.

2. I actually just found out that there is a GetCreatureByTag, that way only creatures will get acquired, no need to test if the object in question is in fact a type of creature.

3. Yes. Sorry for the confusion i was at work and didnt remember the local variable's name. Thats the one you are looking for.

#5
Craig Graff

Craig Graff
  • Members
  • 608 messages
The AMBIENT_SYSTEM_STATE should most likely be set to 19 for what you want. The state flags are additive in hexadecimal notation (treated as bit flags), so you add up all the ones you want active
[dascript]
    1 = on
    2 = start on spawn
+16 = always on
------
   19
[/dascript]

Modifié par Craig Graff, 12 janvier 2010 - 02:58 .


#6
Nattfodd

Nattfodd
  • Members
  • 321 messages
Ok, i'll make a try with both values.

Now i'm stuck to understand which rules the ANIM_base.gda uses to refers to .ANI files.

This 2DA has a column called "AnimName" that contains a string that must be the name of the animation, but this name did not match with ANI names into the toolset so i can't see a preview in cutscene editor or animation events tool to evaluate if an animation satisfy my needs.



For example in ANIM_base the "ID" 56 has the description "walk" and in the column "AnimName" there is "walkf". What is the specific animation for this row into the toolset?

#7
hunharibo

hunharibo
  • Members
  • 126 messages
ANIM_base.gda as far as i know incorporates all known animations, so you dont really need to add ros to that.

Add rows to ambient_ai with row IDs referenced from anim_base.



And Craig, thats good to know. I was wondering why putting 4 and 8 didnt work there at all.

#8
Craig Graff

Craig Graff
  • Members
  • 608 messages
I'm pretty certain that there are many animations which are not listed in ANIM_base. Many animations weren't made to be used in the game outside of cutscenes or conversations; there may be many others that are suitable that just weren't included for various reasons.

#9
Nattfodd

Nattfodd
  • Members
  • 321 messages

Craig Graff wrote...

I'm pretty certain that there are many animations which are not listed in ANIM_base. Many animations weren't made to be used in the game outside of cutscenes or conversations; there may be many others that are suitable that just weren't included for various reasons.


Thanks for the answer.

I already known that ANIM_base does not contain all the animations used in in-game, conversation and cutscenes.
My problem is another one: if i want to see in the toolset a preview of the anim referenced by ID 56 in ANIM_base.gda, how i can identify it into the game resources? What is its name?

#10
BioSpirit

BioSpirit
  • Members
  • 261 messages
I have been troubled by the same issue. I just learned that humanoid.anb is containing a list that will map an animation name into a file (resource) name. (Of course if the creature is a humanoid)

I used CommandPlayAnimation(969) to make a NPC to sit on a bench but there seems to be no animation that would make it stand again. It looks like 911 will play "mh.wi_sit_ex" but it's blended with some other animation and it's not usable. Animations 3054 and 3056 are not working at all.

So, I suppose my question is:
How can I add new animation made with the Animation blend tree editor into a ANIM_Base.xls ?

I suppose the easiest solution to the problem would be finding out why 3056 won't work.

Modifié par BioSpirit, 12 janvier 2010 - 09:47 .


#11
Nattfodd

Nattfodd
  • Members
  • 321 messages

BioSpirit wrote...

I have been troubled by the same issue. I just learned that humanoid.anb is containing a list that will map an animation name into a file (resource) name. (Of course if the creature is a humanoid)

I used CommandPlayAnimation(969) to make a NPC to sit on a bench but there seems to be no animation that would make it stand again. It looks like 911 will play "mh.wi_sit_ex" but it's blended with some other animation and it's not usable. Animations 3054 and 3056 are not working at all.

You said that anim 911 plays "mh.wi_sit_ex". It's only your supposition or you are sure of this? If you are sure how do you found tha connection between the number and tha anim name? 

So, I suppose my question is:
How can I add new animation made with the Animation blend tree editor into a ANIM_Base.xls ?

Are you able to use the Animation blend tree editor? Can you teach me some rules on how it works because i can't find tutorials for this argument. If you want.

Thanks.

Modifié par Nattfodd, 13 janvier 2010 - 02:11 .


#12
Craig Graff

Craig Graff
  • Members
  • 608 messages
You can find the .acb files here, in case you haven't already. The easiest way that I've found (not to say that it's particularly easy) to match up the animation is to do a search in humanoid.acb for the value in the AnimName column of ANIM_base.xls. This will take you to the node where you can find the actual animation name. This works in reverse as well, of course.

#13
BioSpirit

BioSpirit
  • Members
  • 261 messages

Nattfodd wrote...
You said that anim 911 plays "mh.wi_sit_ex". It's only your supposition or you are sure of this? If you are sure how do you found tha connection between the number and tha anim name? 

I am sure of it.  Animation Worksheets are now available for download, that's one thing you will need. (social.bioware.com/forum/1/topic/72/index/600433), just open the humanoids.acb in the Toolset. That will bind the animation name listed in ANIM_Base.xls into a file name (*.ani)

I was able to add new animations in ANIM_Base.xls and some of them do work in a game, but not all.

Nattfodd wrote...
Are you able to use the Animation blend tree editor? Can you teach me some rules on how it works because i can't find tutorials for this argument. If you want.


I found the Animation Blend Tree Editor just yesterday so I don't know anything more than you do. But I can outline the method for adding animations.

1. Setup Creature Rig model. (a creature model (NPC) used for previewing animations)
2a. Add new Animation Stream into the worksheet and connect to "humanoid" blender or what ever it is.
2b. Setup the animation file (*.ani) into the properties.
2c. Setup Node Name (That's the name used in ANIM_Base.xls)
3. Select Export->Post to Local. (This will create a humanoid.anb in the export folders)
4. Open ANIM_Base.xls and add a new line in it.
5. Conver to GDA and place in a proper export folders.


I tried to create a blend using the Transition Tool (In a View menu), but it seems to be not working.

If I do like this:

CommandPlayAnimation(911);
CommandPlayAnimation(993);

The game doesn't blend these animations evenif the transition is defined in the Transition tool and the humanoid.tbi is placed in export folders.
One possibility is that I have miss-understood the idea of transitions or the animations aren't properly fed from the command queue into the engine.

#14
Nattfodd

Nattfodd
  • Members
  • 321 messages

BioSpirit wrote...
I am sure of it.  Animation Worksheets are now available for download, that's one thing you will need. (social.bioware.com/forum/1/topic/72/index/600433), just open the humanoids.acb in the Toolset. That will bind the animation name listed in ANIM_Base.xls into a file name (*.ani)

I was able to add new animations in ANIM_Base.xls and some of them do work in a game, but not all.

Oh, well. At last i relized that without original animation worksheet was impossible to understand this "cripted" structure.
With the anim worksheets some things are more clear.

I found the Animation Blend Tree Editor just yesterday so I don't know anything more than you do. But I can outline the method for adding animations.

1. Setup Creature Rig model. (a creature model (NPC) used for previewing animations)
2a. Add new Animation Stream into the worksheet and connect to "humanoid" blender or what ever it is.
2b. Setup the animation file (*.ani) into the properties.
2c. Setup Node Name (That's the name used in ANIM_Base.xls)
3. Select Export->Post to Local. (This will create a humanoid.anb in the export folders)
4. Open ANIM_Base.xls and add a new line in it.
5. Conver to GDA and place in a proper export folders.


I tried to create a blend using the Transition Tool (In a View menu), but it seems to be not working.

If I do like this:

CommandPlayAnimation(911);
CommandPlayAnimation(993);

The game doesn't blend these animations evenif the transition is defined in the Transition tool and the humanoid.tbi is placed in export folders.
One possibility is that I have miss-understood the idea of transitions or the animations aren't properly fed from the command queue into the engine.


Mmm. I don't tried this "Transition tool" and found no docs about it; so i can't help you.
I know that CommandPlayAnimation(); can receive 4 integers as parameters. The last one is "nBlendin"; maybe it says to the function, to blend the start of the animation to be played.
But i'm not sure about that.
Looking into ANIM_base, there is a column named "TransitionTo" that indicates the next animation to play after the end of the main anim referenced in "AnimName" column. I think that the engine knows if these 2 animation must be blended if they are part of a blend tree node associated to the Creature into the APR_base.gda.
But i repeat, this is only my suppositions. The documentation on this argument lacks of informations.

#15
Nattfodd

Nattfodd
  • Members
  • 321 messages
Ok, I managed to create a personalized ambient behaviour pattern. I understood the complex rules of the animations references. Maybe i'll post a tutorial later on.