Город Мастеров
IPB

Здравствуйте, гость ( Вход | Регистрация )

 Правила этого форума ПРАВИЛА РАЗДЕЛА
> Ambient Animation, Иллюзия жизнедеятельности
Лито
сообщение Jun 18 2005, 12:21
Сообщение #1


Level 9
***

Класс: Страж Тьмы
Характер: Chaotic Evil
Раса: Нежить



Как известно эта фича(Ambient Animation - AA) придумана для того чтобы "оживить" NPC. Так сказать создать иллюзию жизнедеятельности.
Так вот прочитав лексикон, изучив кучу настроек AA и не добившись ровным счетом ничего(за небольшим исключением), обращаюсь к вам за помощью. Кто умеет этой БЯКОЙ пользоватся? :this:
Немного данных(могут быть не верными): AA работает только с АИ ХоТУ - XP2. Так же имеется множество настроек, до которых мне как до Китая, типа работы в кузнице или прогулок по городу в дневное время и сном в дому в ночное.

Исключение: у меня получилось сделать так чтобы NPC ходили и разговаривали друг с дружкой, когда я спавнил их через триггер, но ведь не будешь для толпы городских NPC делать триггеры :vava:

По другому вообще никак не получилось - стоят как истуканы и все тут :(
Вернуться в начало страницы
Скопировать ник в поле быстрого ответа
+Ответить с цитированием данного сообщения
 
Открыть новую тему
Ответов
DBColl
сообщение Jun 19 2005, 04:25
Сообщение #2


4-х Кубовый
Иконки Групп

Класс: Некромант
Характер: Lawful Evil
Раса: Человек
NWN: Скриптинг [Sn]
Проклятие Левора



Лито
Посмотри OnSpawn скрипты в Начале Пути. ;) Там в Прокампуре таких перцев отнастроенных, как грязи... А вообще, я переписал тут стандартный OnSpawn... Если не надоест смотреть, то я думаю, это будет полным ответом на твой вопрос. ;)

Neverwinter Script Source
//:://////////////////////////////////////////////////
//:: Copyright © 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 12/11/2002
//:: Modified By: DBColl / WRG!Team 18.06.2005
//:://////////////////////////////////////////////////
//:: Updated 2003-08-20 Georg Zoeller: Added check for variables to active spawn in conditions without changing the spawnscript


#include "x0_i0_anims"
// #include "x0_i0_walkway" - in x0_i0_anims
#include "x0_i0_treasure"

#include "x2_inc_switches"

void main()
{
    // ***** Spawn-In Conditions ***** //

    // * REMOVE COMMENTS (// ) before the "Set..." functions to activate
    // * them. Do NOT touch lines commented out with // *, those are
    // * real comments for information.

    // * This causes the creature to say a one-line greeting in their
    // * conversation file upon perceiving the player. Put [NW_D2_GenCheck]
    // * in the "Text Seen When" field of the greeting in the conversation
    // * file. Don't attach any player responses.
    // *
    // SetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION);

    // * Same as above, but for hostile creatures to make them say
    // * a line before attacking.
    // *
    // SetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION);

    // * This NPC will attack when its allies call for help
    // *

    if (GetLocalInt(OBJECT_SELF, "ST_SHOUT_ATTACK") == TRUE)
    {
        SetSpawnInCondition(NW_FLAG_SHOUT_ATTACK_MY_TARGET);
    }

    //--------------------------------------------------------------------------
    // Enable stealth mode by setting a variable on the creature
    // Great for ambushes
    // See x2_inc_switches for more information about this
    //--------------------------------------------------------------------------
    // * If the NPC has the Hide skill they will go into stealth mode
    // * while doing WalkWayPoints().
    // *
    if (GetLocalInt(OBJECT_SELF, "ST_STEALTH") == TRUE)
    {
        SetSpawnInCondition(NW_FLAG_STEALTH);
    }

    // * Same, but for Search mode
    //--------------------------------------------------------------------------
    // Make creature enter search mode after spawning by setting a variable
    // Great for guards, etc
    // See x2_inc_switches for more information about this
    //--------------------------------------------------------------------------
    if (GetLocalInt(OBJECT_SELF, "ST_SEARCH") == TRUE)
    {
        SetSpawnInCondition(NW_FLAG_SEARCH);
    }
    // * This will set the NPC to give a warning to non-enemies
    // * before attacking.
    // * NN -- no clue what this really does yet
    // *
    if (GetLocalInt(OBJECT_SELF, "ST_WARNINGS") == TRUE)
    {
        SetSpawnInCondition(NW_FLAG_SET_WARNINGS);
    }
    // * Separate the NPC's waypoints into day & night.
    // * See comment on WalkWayPoints() for use.
    // *
    if (GetLocalInt(OBJECT_SELF, "ST_DAY_NIGHT_POSTING") == TRUE)
    {
        SetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING);
    }

    // * If this is set, the NPC will appear using the "EffectAppear"
    // * animation instead of fading in, *IF* SetListeningPatterns()
    // * is called below.
    // *
    if (GetLocalInt(OBJECT_SELF, "ST_APPEAR") == TRUE)
    {
        SetSpawnInCondition(NW_FLAG_APPEAR_SPAWN_IN_ANIMATION);
    }
    // * This will cause an NPC to use common animations it possesses,
    // * and use social ones to any other nearby friendly NPCs.
    // *
    // SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS);

    //--------------------------------------------------------------------------
    // Enable immobile ambient animations by setting a variable
    // See x2_inc_switches for more information about this
    //--------------------------------------------------------------------------
    if (GetLocalInt(OBJECT_SELF, "ST_IMMOBILE_AMBIENT") == TRUE)
    {
        SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS);
    }
    // * Same as above, except NPC will wander randomly around the
    // * area.
    // *
    // SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS);


    //--------------------------------------------------------------------------
    // Enable mobile ambient animations by setting a variable
    // See x2_inc_switches for more information about this
    //--------------------------------------------------------------------------
    if (GetLocalInt(OBJECT_SELF, "ST_AMBIENT") == TRUE)
    {
        SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS);
    }
    // **** Animation Conditions **** //
    // * These are extra conditions you can put on creatures with ambient
    // * animations.

    // * Civilized creatures interact with placeables in
    // * their area that have the tag "NW_INTERACTIVE"
    // * and "talk" to each other.
    // *
    // * Humanoid races are civilized by default, so only
    // * set this flag for monster races that you want to
    // * behave the same way.

    if (GetLocalInt(OBJECT_SELF, "ST_ANIM_CIVILIZED") == TRUE)
    {
        SetAnimationCondition(NW_ANIM_FLAG_IS_CIVILIZED);
    }
    // * If this flag is set, this creature will constantly
    // * be acting. Otherwise, creatures will only start
    // * performing their ambient animations when they
    // * first perceive a player, and they will stop when
    // * the player moves away.
    if (GetLocalInt(OBJECT_SELF, "ST_ANIM_CONSTANT") == TRUE)
    {
        SetAnimationCondition(NW_ANIM_FLAG_CONSTANT);
    }
    // * Civilized creatures with this flag set will
    // * randomly use a few voicechats. It's a good
    // * idea to avoid putting this on multiple
    // * creatures using the same voiceset.
    // SetAnimationCondition(NW_ANIM_FLAG_CHATTER);

    // * Creatures with _immobile_ ambient animations
    // * can have this flag set to make them mobile in a
    // * close range. They will never leave their immediate
    // * area, but will move around in it, frequently
    // * returning to their starting point.
    // *
    // * Note that creatures spawned inside interior areas
    // * that contain a waypoint with one of the tags
    // * "NW_HOME", "NW_TAVERN", "NW_SHOP" will automatically
    // * have this condition set.
    if (GetLocalInt(OBJECT_SELF, "ST_ANIM_MOBILE_CLOSE_RANGE") == TRUE)
    {
        SetAnimationCondition(NW_ANIM_FLAG_IS_MOBILE_CLOSE_RANGE);
    }

    // **** Special Combat Tactics *****//
    // * These are special flags that can be set on creatures to
    // * make them follow certain specialized combat tactics.
    // * NOTE: ONLY ONE OF THESE SHOULD BE SET ON A SINGLE CREATURE.

    // * Ranged attacker
    // * Will attempt to stay at ranged distance from their
    // * target.
    if (GetLocalInt(OBJECT_SELF, "ST_COMBAT_RANGED") == TRUE)
    {
        SetCombatCondition(X0_COMBAT_FLAG_RANGED);
    }
    // * Defensive attacker
    // * Will use defensive combat feats and parry
    if (GetLocalInt(OBJECT_SELF, "ST_COMBAT_DEFENSIVE") == TRUE)
    {
        SetCombatCondition(X0_COMBAT_FLAG_DEFENSIVE);
    }
    // * Ambusher
    // * Will go stealthy/invisible and attack, then
    // * run away and try to go stealthy again before
    // * attacking anew.
    if (GetLocalInt(OBJECT_SELF, "ST_COMBAT_AMBUSHER") == TRUE)
    {
        SetCombatCondition(X0_COMBAT_FLAG_AMBUSHER);
    }
    // * Cowardly
    // * Cowardly creatures will attempt to flee
    // * attackers.
    if (GetLocalInt(OBJECT_SELF, "ST_COMBAT_COWARDLY") == TRUE)
    {
        SetCombatCondition(X0_COMBAT_FLAG_COWARDLY);
    }

    // **** Escape Commands ***** //
    // * NOTE: ONLY ONE OF THE FOLLOWING SHOULD EVER BE SET AT ONE TIME.
    // * NOTE2: Not clear that these actually work. -- NN

    // * Flee to a way point and return a short time later.
    // *
    // SetSpawnInCondition(NW_FLAG_ESCAPE_RETURN);

    // * Flee to a way point and do not return.
    // *
    // SetSpawnInCondition(NW_FLAG_ESCAPE_LEAVE);

    // * Teleport to safety and do not return.
    // *
    // SetSpawnInCondition(NW_FLAG_TELEPORT_LEAVE);

    // * Teleport to safety and return a short time later.
    // *
    // SetSpawnInCondition(NW_FLAG_TELEPORT_RETURN);



    // ***** CUSTOM USER DEFINED EVENTS ***** /


    /*
      If you uncomment any of these conditions, the creature will fire
      a specific user-defined event number on each event. That will then
      allow you to write custom code in the "OnUserDefinedEvent" handler
      script to go on top of the default NPC behaviors for that event.

      Example: I want to add some custom behavior to my NPC when they
      are damaged. I uncomment the "NW_FLAG_DAMAGED_EVENT", then create
      a new user-defined script that has something like this in it:

      if (GetUserDefinedEventNumber() == 1006) {
          // Custom code for my NPC to execute when it's damaged
      }

      These user-defined events are in the range 1001-1010.
    */


    // * Fire User Defined Event 1001 in the OnHeartbeat
    // *
    SetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT);

    // * Fire User Defined Event 1002
    // *
    SetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT);

    // * Fire User Defined Event 1003
    // *
    SetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT);

    // * Fire User Defined Event 1004
    // *
    SetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT);

    // * Fire User Defined Event 1005
    // *
    SetSpawnInCondition(NW_FLAG_ATTACK_EVENT);

    // * Fire User Defined Event 1006
    // *
    SetSpawnInCondition(NW_FLAG_DAMAGED_EVENT);

    // * Fire User Defined Event 1007
    // *
    SetSpawnInCondition(NW_FLAG_DEATH_EVENT);

    // * Fire User Defined Event 1008
    // *
    SetSpawnInCondition(NW_FLAG_DISTURBED_EVENT);

    // * Fire User Defined Event 1009
    // *
    SetSpawnInCondition(NW_FLAG_SPELL_CAST_AT_EVENT);

    // * Fire User Defined Event 1010
    // *
    SetSpawnInCondition(NW_FLAG_RESTED_EVENT);


    // ***** DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ***** //

    // * Goes through and sets up which shouts the NPC will listen to.
    // *
    SetListeningPatterns();

    // * Walk among a set of waypoints.
    // * 1. Find waypoints with the tag "WP_" + NPC TAG + "_##" and walk
    // *    among them in order.
    // * 2. If the tag of the Way Point is "POST_" + NPC TAG, stay there
    // *    and return to it after combat.
    //
    // * Optional Parameters:
    // * void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)
    //
    // * If "NW_FLAG_DAY_NIGHT_POSTING" is set above, you can also
    // * create waypoints with the tags "WN_" + NPC Tag + "_##"
    // * and those will be walked at night. (The standard waypoints
    // * will be walked during the day.)
    // * The night "posting" waypoint tag is simply "NIGHT_" + NPC tag.
    WalkWayPoints();

    //* Create a small amount of treasure on the creature
    //if ((GetLocalInt(GetModule(), "X2_L_NOTREASURE") == FALSE)  &&
    //    (GetLocalInt(OBJECT_SELF, "X2_L_NOTREASURE") == FALSE)  )
    //{
    //    CTG_GenerateNPCTreasure(TREASURE_TYPE_MONSTER, OBJECT_SELF);
    //}


    // ***** ADD ANY SPECIAL ON-SPAWN CODE HERE ***** //

    // * If Incorporeal, apply changes
    if (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_IS_INCORPOREAL) == TRUE)
    {
        effect eConceal = EffectConcealment(50, MISS_CHANCE_TYPE_NORMAL);
        eConceal = ExtraordinaryEffect(eConceal);
        effect eGhost = EffectCutsceneGhost();
        eGhost = ExtraordinaryEffect(eGhost);
        ApplyEffectToObject(DURATION_TYPE_PERMANENT, eConceal, OBJECT_SELF);
        ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, OBJECT_SELF);

    }

/////// *************************** DBColl's customs... ***********************
/////// *************************** DBColl's customs... ***********************
/////// *************************** DBColl's customs... ***********************
/////// *************************** DBColl's customs... ***********************
/////// *************************** DBColl's customs... ***********************
//:: ************************************************************** Каспер :)))
    if (GetLocalInt(OBJECT_SELF, "ST_GHOST") == TRUE)
    {
        effect eGhost = EffectCutsceneGhost();
        eGhost = ExtraordinaryEffect(eGhost);
        ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, OBJECT_SELF);
    }

//:: ******************************************************** Умертвляем непися

    if (GetLocalInt(OBJECT_SELF, "ST_DEAD") == TRUE)
    {
        if (GetLocalInt(OBJECT_SELF, "ST_DEAD") == 1) // "Не поднимаемый" некросом труп
            SetIsDestroyable(FALSE, FALSE, FALSE);
        if (GetLocalInt(OBJECT_SELF, "ST_DEAD") == 2) // "Поднимаемый" некросом труп
            SetIsDestroyable(FALSE, TRUE, FALSE);
        if (GetLocalInt(OBJECT_SELF, "ST_DEAD") == 3) // "Не поднимаемый" некросом труп
        {                                            //        с кровью под пузом
            SetIsDestroyable(FALSE, FALSE, FALSE);
            CreateObject(OBJECT_TYPE_PLACEABLE, "plc_bloodstain", GetLocation(OBJECT_SELF));
        }
        if (GetLocalInt(OBJECT_SELF, "ST_DEAD") == 4) // "Поднимаемый" некросом труп
        {                                            //        с кровью под пузом
            SetIsDestroyable(FALSE, TRUE, FALSE);
            CreateObject(OBJECT_TYPE_PLACEABLE, "plc_bloodstain", GetLocation(OBJECT_SELF));
        }
        ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(TRUE), OBJECT_SELF);
    }

//:: ***************************************************************************
//:: ***************************************************** Садим непися на стул
    if (GetLocalInt(OBJECT_SELF, "ST_SIT_CHAIR") == TRUE)
        ActionSit(GetNearestObjectByTag("STOOL"));
    if (GetLocalInt(OBJECT_SELF, "ST_SIT_CHAIR") == 2) // примораживаем к стулу
        SetCommandable(FALSE);

//:: ***************************************************************************
//:: **************************************************** Садим непися на землю
    if (GetLocalInt(OBJECT_SELF, "ST_SIT_CROSS") == TRUE)
        ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS, 1.0, 99999.9);

}






CODE
SPAWN-КОНСТАНТЫ.

Использование: инициализируем на неписе следующие переменные.

ST_DEAD – будет мертвый
1 – невоскрешаемый труп
2 – воскрешаемый
3 - невоскрешаемый труп с кровью
4 - воскрешаемый труп с кровью
ST_STEALTH – ходит скрытно, когда выполняется WalkWaypoints(). Хорошо для убийц.
ST_SEARCH – то же самое, только в режиме поиска. Хорошо для стражи.
ST_WARNING – поднимет тревогу.
ST_DAY_NIGHT_POSTING – дневные/ночные вейпоинты.
ST_SHOUT_ATTACK – прибежит на тревогу к союзникам, если позовут.
ST_APPEAR – «свалится с неба».
ST_IMMOBILE_AMBIENT – стоячая анимация.
ST_AMBIENT – бродячая анимация.
ST_ANIM_CIVILIZED - Civilized creatures interact with placeables in their area that have the tag "NW_INTERACTIVE" and "talk" to each other. Humanoid races are civilized by default, so only set this flag for monster races that you want to behave the same way.
ST_ANIM_CONSTANT - If this flag is set, this creature will constantly be acting. Otherwise, creatures will only start performing their ambient animations when they first perceive a player, and they will stop when the player moves away.
ST_ANIM_MOBILE_CLOSE_RANGE - Creatures with _immobile_ ambient animations can have this flag set to make them mobile in a close range. They will never leave their immediate area, but will move around in it, frequently returning to their starting point. Note that creatures spawned inside interior areas that contain a waypoint with one of the tags "NW_HOME", "NW_TAVERN", "NW_SHOP" will automatically have this condition set.
----------------------------------------------------------------------------------------------------------------------------------

These are special flags that can be set on creatures to make them follow certain specialized combat tactics.
NOTE: ONLY ONE OF THESE SHOULD BE SET ON A SINGLE CREATURE.

ST_COMBAT_RANGED – старается атаковать издалека
ST_COMBAT_DEFENSIVE – использует защитные фиты и Parry.
ST_COMBAT_AMBUSHER - Will go stealthy/invisible and attack, then run away and try to go stealthy again before attacking anew.
ST_COMBAT_COWARDLY – будет стараться убегать от нападающего.

ST_SIT_CHAIR – садится на ближайший стул с тэгом STOOL. (требуется поддержка в HEARTBEAT’е)
2 – «примораживаем» (SetCommandable(FALSE))
ST_SIT_CROSS – сажаем на пол (требуется поддержка в HEARTBEAT’е).
2 – «примораживаем» (SetCommandable(FALSE))


Кстати, вот эти константы ты должен будешь просто установить в Variables существа, в его свойствах. ;) Как поставишь, так и будет себя вести.
Вот и все... Читай, разбирайся ;).
Добавлено в [mergetime]1119144609[/mergetime]
Да! Чуть не забыл! Скопируй этот мой спавн скрипт и запиши его себе в модуль под именем nw_c2_default9. Потом пробуй предустановленными переменными настраивать. ;)
Вернуться в начало страницы
Скопировать ник в поле быстрого ответа
+Ответить с цитированием данного сообщения

Сообщений в этой теме
- Лито   Ambient Animation   Jun 18 2005, 12:21
- - Dik Morris   Советую прочитать статьи Лекса, "Aurora Tools...   Jun 18 2005, 12:49
- - Лито   Насколько я помню, у него там не про ту анимацию, ...   Jun 18 2005, 13:34
- - Aiwan   Стандартный скрипт на спавн посомтри.   Jun 18 2005, 14:17
- - DBColl   Лито Посмотри OnSpawn скрипты в Начале Пути. Та...   Jun 19 2005, 04:25
- - Мефистофель   DBCool, очень полезный скрипт. Я не могу понять, к...   Jun 19 2005, 04:58
- - Лито   DBColl, опа! Грейтс енк   Jun 19 2005, 10:16
- - DBColl   QUOTE (Мефистофель @ Jun 19 2005, 04:58)DBCo...   Jun 27 2005, 15:10
- - -fenix-   Он наверное имеет в виду, как сделать воскрешаемый...   Jun 27 2005, 19:30
- - Лито   Мефистофель Если ставишь на НПС переменную ...   Jul 2 2005, 19:53
- - Сайрус   может я чего не пойму , но мне кажется там в кон...   Dec 11 2006, 03:50
- - Aiwan   Сай, твоя лошадь.. мм мягко скажем поздно скачет. ...   Dec 11 2006, 18:14
- - Сайрус   Ну фик его знает.. Кстати не пойму зачем в этом ск...   Dec 12 2006, 03:01
- - -fenix-   QUOTE(Сайрус @ Dec 12 2006, 03:01) 100283...   Dec 12 2006, 11:21
- - Lex   коменты не влияют ни на что, при компиляции они пр...   Dec 12 2006, 12:58
- - -fenix-   QUOTE(Lex @ Dec 12 2006, 12:58) 100301мож...   Dec 12 2006, 13:05
- - Epsilon   Мне плевать на давность, для меня появилось новое ...   Jun 11 2007, 03:21
- - Aiwan   Лучше почитай тему скриптов новоичков. Там я настр...   Jun 11 2007, 09:10


Ответить в эту темуОткрыть новую тему
2 чел. читают эту тему (гостей: 2, скрытых пользователей: 0)
Пользователей: 0

 



Текстовая версия Сейчас: 28th April 2025 - 02:56