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.





Retour en haut







