Aller au contenu

Photo

Make Bloodsong's Creature Work


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

#1
BloodsongVengeance

BloodsongVengeance
  • Members
  • 590 messages
heyas;

   there's a new community contest coming up for mini games -- due oct 24.  so i thought maybe i could port my piggy chase minigame from nwn.  well... not port it exactly, but re-do it for dao.  step number one is... to create a chaseable creature -- in this case, a nug.
   this is the first time ive even looked at dao scripting, but i think i have a handle on it....  i put my custom ai script into a custom nug, and i turned on use custom ai scripting.  (which might be wrong, if i replace the creature_core script, actually.)
   i'm running into a few problems.  what's new?

compiler problems:

E: 13:33:50 - 13t_speednugai.nss - 13t_speednugai.nss(53): Variable defined without type (while compiling vfx_constants_h.nss)

   first off, why the DIP is the compiler getting errors in the vfx constants include?  that thing doesnt even HAVE 53 lines.  in fact, its not included in my includes in this script, so i can only imagine its included in another include.  gah.

SPEEDNUGAI

#include "rules_h"
#include "log_h"
#include "utility_h"
#include "global_objects_h"
#include "ai_main_h_2"
#include "ai_ballista_h"
#include "design_tracking_h"
#include "sys_rewards_h"
#include "sys_autoscale_h"
#include "sys_rubberband_h"
#include "sys_soundset_h"
#include "sys_ambient_h"
#include "sys_treasure_h"
#include "sys_areabalance"
#include "aoe_effects_h"
                          

void RunLikeHell()
{           
    DisplayFloatyMessage(OBJECT_SELF,"Runaway Weeniedog!");
    
    location lLoc = GetRoamLocation(OBJECT_SELF); 
    command cmd = CommandMoveToLocation(lLoc,TRUE,FALSE);
    AddCommand(OBJECT_SELF,cmd,TRUE,FALSE);
    
}              

void CapturePiggy(object oPC)
{
    DisplayFloatyMessage(OBJECT_SELF,"You Got Me!");
    ClearAllCommands(OBJECT_SELF);
    //--then um... do the capture dialogue/cutscene little doohickey thing
}
                                                                          

void MissPiggy(object oPC)
{
    DisplayFloatyMessage(OBJECT_SELF,"MISSED ME!");
    command cAni = CommandPlayAnimation(152, 0, 0, FALSE); 
    ClearAllCommands(oPC);
    AddCommand(oPC,cmd,TRUE,FALSE);
}


void main()
{
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    object oPC = GetEventCreator(ev);

    // If TRUE, we won't redirect to rules core
    int bEventHandled = FALSE;


    switch (nEventType)
    {
        case EVENT_TYPE_SPAWN:
        {                                        
            DisplayFloatyMessage(OBJECT_SELF,"spawned");
            ApplyEffectOnObject(5 /*EFFECT_DURATION_TYPE_INNATE*/, EffectModifyMovementSpeed(3.0), OBJECT_SELF);
            
            float fRoamDistance = GetLocalFloat(OBJECT_SELF,"ROAM_DISTANCE");
            if ( fRoamDistance > 5.0f )
            {
                location lRoamLocation = Location(GetArea(OBJECT_SELF),GetPosition(OBJECT_SELF),0.0f);

                SetRoamLocation(OBJECT_SELF,lRoamLocation);
                SetRoamRadius(OBJECT_SELF,fRoamDistance);
            }           
            
            // Store start location for homing "rubberband" system
            Rubber_SetHome(OBJECT_SELF);
            
            //--this could be interesting
            // -----------------------------------------------------------------
            // Large creatures that can bump smaller ones out of their way
            // -----------------------------------------------------------------
                ApplyKnockbackAoe(OBJECT_SELF);
              
            RunLikeHell();
        }                          
        
        //--let's try these...
        
        case EVENT_TYPE_BLOCKED:
        {
            DisplayFloatyMessage(OBJECT_SELF,"Blocked!");
        }                         
        
        case EVENT_TYPE_CLICK:
        {
            DisplayFloatyMessage(OBJECT_SELF,"clicky!");
        }
        
        case EVENT_TYPE_DIALOGUE:
        {                                        
            DisplayFloatyMessage(OBJECT_SELF,"Dialogue!");
            int nRoll = Random(75) + GetCreatureAttribute(oPC, ATTRIBUTE_DEX);
            
            if(nRoll > 66)
                CapturePiggy(oPC);  
            else
               MissPiggy(oPC);
        }

        
        
        // -----------------------------------------------------------------
        // Damage over time tick event.
        // This is activated from EffectDOT and keeps rescheduling itself
        // while DOTs are in effect on the creature
        // -----------------------------------------------------------------
        //-- since its immortal, but not plot, it CAN be damaged by this.
        
        case EVENT_TYPE_DOT_TICK:
        {
            if (!IsDead() && !IsDying())
            {
                Effects_HandleCreatureDotTickEvent();
            }

            // Event was handled - don't fall through to rules_core
            bEventHandled = TRUE;
            break;
        }

        case EVENT_TYPE_PERCEPTION_APPEAR:
        {                                                 
            DisplayFloatyMessage(OBJECT_SELF,"I See You!");
            object oDisappearer = GetEventObject(ev, 0); //GetEventCreator(ev);
            if (IsPartyMember(oDisappearer))
            {
                RunLikeHell();
            }

            // Event was handled - don't fall through to rules_core
            bEventHandled = TRUE;
            break;
        }

        //----------------------------------------------------------------------
        // EVENT_TYPE_DAMAGED
        //
        //----------------------------------------------------------------------
        //--no special case



        case EVENT_TYPE_REACHED_WAYPOINT:
        {   //--currently trying w/o waypoints
            bEventHandled = Ambient_ReachedWaypoint(ev);
            break;
        }

        case EVENT_TYPE_ROAM_DIST_EXCEEDED:
        {
            DisplayFloatyMessage(OBJECT_SELF,"Roam Maxed!");

            ClearAllCommands(OBJECT_SELF,TRUE);

            location lRoamLocation = GetRoamLocation(OBJECT_SELF);

            command cmd = CommandMoveToLocation(lRoamLocation,TRUE,FALSE);
            AddCommand(OBJECT_SELF,cmd,TRUE,FALSE);
        }

    }

    // -------------------------------------------------------------------------
    // Any event not handled falls through to rules_core:
    // -------------------------------------------------------------------------
    if (!bEventHandled)
    {                              
        DisplayFloatyMessage(OBJECT_SELF,"unidentified event");
       AI_DetermineCombatRound(); 
       // HandleEvent(ev, RESOURCE_SCRIPT_RULES_CORE);
    }

}


  the other problem is.... the nug i painted down in the area doesn't do doodle.  it doesn't run.  it doesn't roam.  i set it to interactive, but clicking on it does nothing.  do i have to set a conversation file in it to have it dialogue-able?  must be.  it isn't showing ANY of that floaty text stuff; not spawn, not perception...





   so then i tried to spawn another nug via trigger.  uhm... when i run into the trigger, nothing happens.  my wild guess is, because i dont know how to tell it a location.
THIS script has THIS error, lord knows why:
E: 13:44:42 - 13t_nugspawner.nss - 13t_nugspawner.nss(46): Unknown error

apparently, the compiler doesnt know why, either.  :/   i used the trigger event template for this script.


NUGSPAWNER
#include "log_h"
#include "utility_h"
#include "wrappers_h" 
#include "events_h"

void main()
{
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    string sDebug;       
    object oPC = GetHero();
    object oParty = GetParty(oPC); 
    int nEventHandled = FALSE; 

    switch(nEventType)
    {
        ////////////////////////////////////////////////////////////////////////
        // Sent by: The engine
        // When: The object spawns into the game. This can happen only once,
        //       regardless of save games.
        ////////////////////////////////////////////////////////////////////////
        case EVENT_TYPE_SPAWN:
        {
            break;
        }
        ////////////////////////////////////////////////////////////////////////
        // Sent by: The engine
        // When: A creature enters the trigger
        ////////////////////////////////////////////////////////////////////////
        case EVENT_TYPE_ENTER:
        {
            object oCreature = GetEventCreator(ev);
             CreateObject(OBJECT_TYPE_CREATURE, R"13t_speednug.utc", GetLocation(oCreature));
            break;  //--<<<<<< THIS IS LINE 46, FYI
        }
        ////////////////////////////////////////////////////////////////////////
        // Sent by: The engine
        // When: A creature exits the trigger
        ////////////////////////////////////////////////////////////////////////
        case EVENT_TYPE_EXIT:
        {
            object oCreature = GetEventCreator(ev);

            break;
        }
        
    }                                         
    if (!nEventHandled)
    {
        HandleEvent(ev, RESOURCE_SCRIPT_TRIGGER_CORE);
    }
}


  hmm... looking at that, spawning a nug at the pc's location in the trigger will trigger the nug to spawn a nug and.... ad infinitum.  well, besides that.... :X   i can't figure it out.

#2
TimelordDC

TimelordDC
  • Members
  • 923 messages
The first one has the command misnamed in MissPiggy.



The second one is fine. I tested it and it compiles without errors for me.

#3
BloodsongVengeance

BloodsongVengeance
  • Members
  • 590 messages
thanks dc!



okay, the creature is not running around with its roam stuff set (and turned on in the variables). also, its perception event is not firing. i'm going to guess creatures only perceive other creatures hostile to them. on click event apparently doesnt work for creatures. on dialogue doesn't work (not even a talk bubble icon) unless you define a dialogue for it. (not sure if it needs to have text in it,but i put it in.)

i can't tell if the spawn event is firing, i dont see the floaty message for it. but that could be because i, myself am spawning at the time the message is displaying.



the on dialogue works as i expect it to. (point for me!) the capture piggy and miss piggy functions are working now.



i dont know how else to get this sucker to start roaming around, so i'm going to switch to sending it to random waypoints.



im still getting variable defined without type in the vfx include on the trigger script. and (though i fixed that little infinite loop danger), it still aint spawning the suckers.




#4
TimelordDC

TimelordDC
  • Members
  • 923 messages
The problem with the spawning could be that the creature is being spawned on the same location as the player. Try spawning it on a location other than the player location by adding a vector to it or spawn it on a defined waypoint and see if it works.



Dunno about the roam stuff as I haven't worked with it yet. You could try setting the script to creature_core and seeing if it runs around and then, cross-check and see what you are missing.

#5
BloodsongVengeance

BloodsongVengeance
  • Members
  • 590 messages
heyas;



okay, i figured out the compile errors in vfx_constants and whatever else not. what it REALLY means is, there's a bloody error in MY script that i have to find.



i gave up on roam and went to going to random waypoints. works MUCH better!



here's another one... is there any way i can reverse look up a constant? the speednug keeps firing event 1024, and i dont know what that is. heartbeat?? it doesnt really matter, but i was curious.



other than not firing some evets i expect it to (blocked and perception), it's working a treat! :)


#6
Sakaslan

Sakaslan
  • Members
  • 18 messages
event 1024 is EVENT_TYPE_PLAYER_LEVELUP.



You can find them in the various 2DA .xls files in [GameInstallPath]\\DragonAge\\tools\\Source\\2DA\\ or by looking in the various scripts in the toolset. For events that would be in the _Core Includes folder\\events_h.nss



And yeah, it's telling you to look at line 53 of your script for the improperly defined variable.

#7
BloodsongVengeance

BloodsongVengeance
  • Members
  • 590 messages
heyas;



which 2da would i be looking for? oh, wait, okay. look in the include where they're defined. that would be easier, thanks!


#8
Sakaslan

Sakaslan
  • Members
  • 18 messages
Oh, there's a 2dA called events.xls.