Global Action - Neverwinter Vaultneverwintervault.org/sites/neverwintervault.org/files/... · Web...

Preview:

Citation preview

Global Action

114

Table of contents

iTable of contents

1Global Action

249Global Artificial Intellegence

299Global Being (Creature)

415Global Conditional

487Global Door

488Global Dungeon Master

499Global Group

504Global Include

794Global Placeables

811Global Reports

858Global Trigger

862Graphical User Interace

900Apendix

NWN2 Stock scripts

VOL I

Main Scripts

presented by

Gamemaster x

&

The knights of the charred table

www.kalifornica.com

kalifornica@gmail.com

Foreword

Hi, Gamemaster X here. I was peeking up the games skirt and looking at all its private parts and it occurred to me it would be nice to have all the stock scripts in an e-book format. What you have here is VOL 1 of a three part series of Neverwinter Nights 2 Stock scripts (the ones that install with the game).

VOL 1 concentrates on Main Scripts or those scripts not specific to spells or a specific area. My intention is for the final series to be laid out as follows.

VOL I Main Scripts

VOL II Spell Scripts

VOl III Area Scripts

Vol IV 2da

Global Action

// ga_alignment

/*

This changes the player's alignment

nActType = From a scale from +3 (Saintly/Paragon) to -3 (Fiendish/Anarchic),

how much the act affects alignment

bLawChaosAxis = 0 means adjust Good/Evil axis, 1 means adjust Law/Chaos axis

*/

// FAB 10/5

// EPF 6/6/05 chose different variable name for second parameter

// ChazM 4/3/06 - Added conversion functions to maintain the functionality of this script, calibrated to the 101 point scale being used.

// DBR 4/13/6 - Adjustment was being converted as if it was a final value instead of a delta.

// DBR 4/18/6 - forgot to adjust for good/lawful as well.

// ChazM 5/3/06 - complete rewrite - simplified to no longer be context sensitive to current alignment.

// ChazM 5/3/06 - changed adjustment for 1-point acts, added "incarnate" acts

// EPF 7/10/06 - added debug strings for balance testing

// EPF 7/20/06 - dampened adjustment values for 1-3. Previous values made it too difficult to

// remain neutral, which makes it just about impossible to play a druid.

// ChazM 8/31/06 - Changed debug display to values instead of alignment constants; removed old commented code

#include "ginc_debug"

const int ACT_EVIL_INCARNATE = -4;

const int ACT_EVIL_FIENDISH = -3;

const int ACT_EVIL_MALEVOLENT = -2;

const int ACT_EVIL_IMPISH = -1;

const int ACT_GOOD_KINDLY = 1;

const int ACT_GOOD_BENEVOLENT = 2;

const int ACT_GOOD_SAINTLY = 3;

const int ACT_GOOD_INCARNATE = 4;

const int ACT_CHAOTIC_INCARNATE = -4;

const int ACT_CHAOTIC_ANARCHIC = -3;

const int ACT_CHAOTIC_FEY = -2;

const int ACT_CHAOTIC_WILD = -1;

const int ACT_LAWFUL_HONEST = 1;

const int ACT_LAWFUL_ORDERLY = 2;

const int ACT_LAWFUL_PARAGON = 3;

const int ACT_LAWFUL_INCARNATE = 4;

// Adjust Alignment notes:

// Alignment is not treated as a continuous scale running from 0 to 100, but in three bands running from 0 to 30, 31 to 69 and 70 to 100.

// Whenever a call to AdjustAlignment takes you over one of these boundaries,

// your characters alignment is automatically placed at the middle of the new band, ie 15, 50 or 85.

int LawChaosAxisAdjustment(object oPC, int iLawChaosActType)

{

int iAdjustment = 0;

switch ( iLawChaosActType )

{

case ACT_CHAOTIC_INCARNATE:

iAdjustment = -70;

break;

case ACT_CHAOTIC_ANARCHIC:

iAdjustment = -10;

break;

case ACT_CHAOTIC_FEY:

iAdjustment = -3;

break;

case ACT_CHAOTIC_WILD:

iAdjustment = -1;

break;

case 0: // Neutral acts not currently tracked

iAdjustment = 0;

break;

case ACT_LAWFUL_HONEST:

iAdjustment = 1;

break;

case ACT_LAWFUL_ORDERLY:

iAdjustment = 3;

break;

case ACT_LAWFUL_PARAGON:

iAdjustment = 10;

break;

case ACT_LAWFUL_INCARNATE:

iAdjustment = 70;

break;

}

if (iAdjustment > 0)

AdjustAlignment(oPC, ALIGNMENT_LAWFUL, iAdjustment);

else

AdjustAlignment(oPC, ALIGNMENT_CHAOTIC, -iAdjustment);

return (iAdjustment);

}

int GoodEvilAxisAdjustment(object oPC, int iGoodEvilActType)

{

int iAdjustment = 0;

switch ( iGoodEvilActType )

{

case ACT_EVIL_INCARNATE:

iAdjustment = -70;

break;

case ACT_EVIL_FIENDISH:

iAdjustment = -10;

break;

case ACT_EVIL_MALEVOLENT:

iAdjustment = -3;

break;

case ACT_EVIL_IMPISH:

iAdjustment = -1;

break;

case 0: // Neutral acts not currently tracked

iAdjustment = 0;

break;

case ACT_GOOD_KINDLY:

iAdjustment = 1;

break;

case ACT_GOOD_BENEVOLENT:

iAdjustment = 3;

break;

case ACT_GOOD_SAINTLY:

iAdjustment = 10;

break;

case ACT_GOOD_INCARNATE:

iAdjustment = 70;

break;

}

if (iAdjustment > 0)

AdjustAlignment(oPC, ALIGNMENT_GOOD, iAdjustment);

else

AdjustAlignment(oPC, ALIGNMENT_EVIL, -iAdjustment);

return (iAdjustment);

}

void main(int iActType, int bLawChaosAxis)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

int nAdjustment;

if (bLawChaosAxis == 0)

{

nAdjustment = GoodEvilAxisAdjustment(oPC, iActType);

PrettyMessage("Alignment shifted on Good-Evil Axis by " + IntToString(nAdjustment));

PrettyMessage("Overall Alignment on this axis = " + IntToString(GetGoodEvilValue(oPC)));

}

else

{

nAdjustment = LawChaosAxisAdjustment(oPC, iActType);

PrettyMessage("Alignment shifted on Law-Chaos Axis by " + IntToString(nAdjustment));

PrettyMessage("Overall Alignment on this axis = " + IntToString(GetLawChaosValue(oPC)));

}

}

// ga_attack

/*

This script makes the sAttacker attack the PC. It should be placed on an [END DIALOG] node.

Parameters:

string sAttacker = Tag of attacker whom will attack the PC. Default is OWNER.

*/

// FAB 10/7

// ChazM 4/26

#include "ginc_param_const"

#include "ginc_actions"

void main(string sAttacker)

{

object oAttacker = GetTarget(sAttacker, TARGET_OWNER);

object oTarget = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

StandardAttack(oAttacker, oTarget);

}

// ga_attack_target

/*

This script makes the sAttacker attack the sTarget. It should be placed on an [END DIALOG] node.

Parameters:

string sAttacker = Tag of attacker. Default is OWNER.

string sTarget = Tag of Target. Default is PC.

*/

// FAB 10/7

// ChazM 4/26

#include "ginc_param_const"

#include "ginc_actions"

void main(string sAttacker, string sTarget)

{

object oAttacker = GetTarget(sAttacker, TARGET_OWNER);

object oTarget = GetTarget(sTarget, TARGET_PC);

StandardAttack(oAttacker, oTarget);

}

// ga_blackout

//

// wrapper function for FadeToBlackParty() to instantly make screen black. Useful for the

// first node of conversations.

// CGaw & BMa 2/13/06 - Created.

#include "ginc_cutscene"

void main()

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

FadeToBlackParty(oPC, 1, 0.0);

}

// ga_camera_facing_point_party

/*

Point the cameras of all PCs' in the Speaker's party to target sTarget.

Camera will be fDistance meters away from the PC, and

pitched at fPitch degrees.

-fDistance can be between 1 and 25. At least 5 is advisable in most cases.

0 = use distance of current camera value

-fPitch can be between 1 and 89. 89 is nearly parallel to the ground.

1 is almost directly overhead. 60-70 is usually a reasonable default.

0 = use pitch of current camera value

- nTransitionType can be 0 or between 1 and 100. The higher the number, the faster the transition.

0 = snap to new facing, no transition.

*/

// EPF 9/14/06

// ChazM 9/15/06 - added defaults for current cam, moved funcs to ginc_cutscene

#include "ginc_param_const"

#include "x0_i0_position"

#include "ginc_cutscene"

#include "ginc_math"

void main(string sTarget, float fDistance, float fPitch, int nTransitionType)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

if(!GetIsObjectValid(oPC))

{

return; //if there's no PC speaker, there's no point in setting the cam anyway.

}

// SetCameraFacing() uses -1.0 to use current camera default, we'll use 0.0 as well.

if (IsFloatNearInt(fDistance, 0))

fDistance = -1.0f;

if (IsFloatNearInt(fPitch, 0))

fPitch = -1.0f;

object oTarget = GetTarget(sTarget);

if(GetIsObjectValid(oTarget))

{

SetCameraFacingPointParty(oPC, oTarget, fDistance, fPitch, nTransitionType);

}

}

// ga_clear_comp()

/*

Removes all roster members from the PC party. Removed roster members are not despawned.

*/

// BMA-OEI 7/20/05

// EPF 1/9/06 -- added RemoveAllCompanions call.

// TDE 3/23/06 -- Replaced entire script with DespawnAllCompanions.

// BMA-OEI 5/23/06 -- replaced w/ RemoveRosterMembersFromParty(), updated comment

#include "ginc_companion"

void main()

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

RemoveRosterMembersFromParty(oPC, FALSE, FALSE);

}

//ga_commandable

/*

Set's target's commandable state.

0 = action stack can not be modified

1 = action stack can be modified

*/

//ChazM 6/28/06

#include "ginc_param_const"

void main(string sTarget, int iCommandable)

{

object oTarget = GetTarget(sTarget);

AssignCommand(oTarget, SetCommandable(iCommandable));

int iCommandable = GetCommandable(oTarget);

PrettyDebug(GetName(oTarget) + " commandable state is " + IntToString(iCommandable));

}

// ga_compshift

/*

This is the companion shift script that adjusts a companion's

reaction to the PC

nCompanion = This is the integer value of the companion in question

nChange = This is the amount their reaction is adjusted

nOverride = If this isn't equal to 0, the companions reaction is

set to this amount. Use with caution.

*/

// FAB 10/4

void main(int nGP, int nAllPCs)

{

/*

This is a temp script - a real script will be added later

nCompanion

1: Khelgar

nChange

-3: Strong negative change

-2: Medium negative change

-1: Small negative change

+1: Small positive change

+2: Medium positive change

+3: Strong positive change

*/

}

// ga_conversation_self

/*

start a conversation file with yourself.

Parameters:

string sConversation = Conversation file to start.

*/

// ChazM 2/25/06

// #include "ginc_param_const"

void main(string sConversation)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

AssignCommand(oPC, ActionStartConversation(oPC, sConversation, TRUE, FALSE));

}

// ga_create_obj(string sObjectType, string sTemplate, string sLocationTag, int bUseAppearAnimation, string sNewTag, float fDelay)

/*

Wrapper for CreateObject() with optional delay.

Parameters:

string sObjectType = Object type. The following are allowed:

C - CREATURE

P - PLACEABLE

I - ITEM

W - WAYPOINT

S - STORE

string sTemplate = Name of the template to create.

string sLocationTag = Tag of the waypoint at which to create the object.

int bUseAppearAnimation = If =1, object will use appear animation.

string sNewTag = Optional new tag for created object.

float fDelay = Delay, in seconds, before creating the object.

*/

// TDE 3/9/05

// ChazM 3/11/05

// BMA-OEI 1/11/06 removed default params

#include "ginc_param_const"

#include "ginc_actions"

void main(string sObjectType, string sTemplate, string sLocationTag, int bUseAppearAnimation, string sNewTag, float fDelay)

{

object oLocation = GetObjectByTag(sLocationTag);

location lLocation = GetLocation(oLocation);

int iObjType = GetObjectTypes(sObjectType);

DelayCommand(fDelay, ActionCreateObject(iObjType, sTemplate, lLocation, bUseAppearAnimation, sNewTag));

}

// ga_cutscene_move

//

// Move and delay the advancing of the conversation for a maximum of nMilliseconds.

// Conversation will also advance if the move completes.

// "" for sMoverTag -> OBJECT_SELF

#include "ginc_misc"

void main(string sWPTag, int nMilliseconds, int bRun, string sMoverTag)

{

object oTarget;

if(sMoverTag == "")

{

oTarget = OBJECT_SELF;

}

else

{

oTarget = GetTarget(sMoverTag);

}

ActionPauseCutscene(nMilliseconds);

AssignCutsceneActionToObject(oTarget, ActionMoveToObject(GetTarget(sWPTag), bRun));

}

// ga_date_advance

/*

Advance date by amount indicated

nYear - Number of years to advance.

nMonth - Number of months to advance.

nDay - Number of days to advance.

*/

// ChazM 6/27/06

void main(int nYear, int nMonth, int nDay)

{

nYear = GetCalendarYear() + nYear;

nMonth = GetCalendarMonth() + nMonth;

nDay = GetCalendarDay() + nDay;

// Set the new date

SetCalendar(nYear, nMonth, nDay);

}

// ga_date_set

/*

Advance date by amount indicated

nYear - Specific year to set calendar to from 1340 to 32001.

nMonth - Specific month to set calendar from 1 to 12.

nDay - Specific day to set calendar to from 1 to 28.

*/

// ChazM 6/27/06

void main(int nYear, int nMonth, int nDay)

{

// Set the new date

SetCalendar(nYear, nMonth, nDay);

}

// ga_death

/*

This script makes objects appear dead

sTag = The tag(s) of the object(s) to make dead. You can pass multiple

tags, seperated by commas (NO SPACES) to make multiple objects dead

(ie. "Object1,Object2,Object3")

iInstance = The instance of the object(s) to make dead. Pass -1 to make

all instances dead.

*/

// TDE 3/7/05

// BMA-OEI 1/11/06 removed default param

// TDE 8/3/06 - Set Immortal and Plot flags to FALSE, Added some debug strings

// TDE 8/28/06 - Changed SetIsDestroyable to (FALSE, FALSE, TRUE) so that the corpses can be looted

#include "ginc_debug"

void Death(string sTagString, int iInstance = 0)

{

PrettyDebug("Applying Death Effect To: " + sTagString + " Instance = " + IntToString(iInstance));

if (iInstance == -1)

{

int iInst;

object oObject;

while (GetIsObjectValid(GetObjectByTag(sTagString, iInst)))

{

oObject = GetObjectByTag(sTagString, iInst);

AssignCommand(oObject, SetIsDestroyable( FALSE,FALSE,TRUE ));

SetImmortal( oObject, FALSE );

SetPlotFlag( oObject, FALSE );

effect eFX = EffectDeath();

PrettyDebug("Name of oObject = " + GetName(oObject));

ApplyEffectToObject( DURATION_TYPE_INSTANT,eFX,oObject );

iInst ++;

}

}

else

{

object oObject = GetObjectByTag(sTagString, iInstance);

AssignCommand(oObject, SetIsDestroyable( FALSE,FALSE,TRUE ));

SetImmortal( oObject, FALSE );

SetPlotFlag( oObject, FALSE );

effect eFX = EffectDeath();

PrettyDebug("Name of oObject = " + GetName(oObject));

ApplyEffectToObject( DURATION_TYPE_INSTANT,eFX,oObject );

}

}

void main(string sTagString, int iInstance)

{

string newString = sTagString;

int iLen = GetStringLength(sTagString);

//find first comma

int CommaPos = FindSubString( newString, "," );

while(CommaPos != -1)

{

string tempString = GetSubString(newString, 0, CommaPos);

Death(tempString, iInstance);

newString = GetSubString(newString, CommaPos + 1, iLen);

iLen = GetStringLength(newString);

CommaPos = FindSubString( newString, "," );

}

//newString is equal to last tag to destroy

Death(newString, iInstance);

}

// ga_destroy

/*

This script destroys objects

sTag = The tag(s) of the object(s) to destroy. You can pass multiple

tags, seperated by commas (NO SPACES) to destroy multiple objects

(ie. "Object1,Object2,Object3")

NOTE: There may eventually be a function to eat white space

(See Mantis 3296), but for now do not put spaces in the string.

iInstance = The instance of the object to destroy. Pass -1 to destroy

all instances. Pass 0 to destroy the first instance.

fDelay = The delay before destroying the object(s)

*/

// TDE 3/7/05

// ChazM 3/8/05 - commented and tweaked.

// ChazM 6/7/05 - fixed bug, modified comment

// BMA-OEI 1/11/06 removed default param

// detroy all objects (iInstance=-1) or a specific instance of object

void Destroy(string sTagString, int iInstance = 0, float fDelay = 0.0)

{

if (iInstance == -1)

{ // delete all objects

int iInst = 0;

object oObject = GetObjectByTag(sTagString, iInst);

while (GetIsObjectValid(oObject))

{

DestroyObject (oObject, fDelay);

iInst ++;

oObject = GetObjectByTag(sTagString, iInst);

}

}

else

{ // delete a specific instance of object

DestroyObject (GetObjectByTag(sTagString, iInstance), fDelay);

}

}

void main(string sTagString, int iInstance, float fDelay)

{

string sNewString = sTagString;

int iLen = GetStringLength(sTagString);

int iCommaPos = FindSubString( sNewString, "," ); //find first comma

while(iCommaPos != -1)

{

// get first tag and destroy it

string sTempString = GetSubString(sNewString , 0, iCommaPos);

Destroy(sTempString, iInstance, fDelay);

// drop first tag and comma

sNewString = GetSubString(sNewString, iCommaPos + 1, iLen);

// determine new length

iLen = GetStringLength(sNewString);

// get next comma position (returns -1 if not found)

iCommaPos = FindSubString(sNewString, "," );

}

//sNewString is equal to last tag to destroy

Destroy(sNewString, iInstance, fDelay);

}

// ga_destroy_item

/*

This takes an item from a player

sItemTag = This is the string name of the item's tag

nQuantity = The number of items to destroy. -1 is all of the Player's items of that tag.

nPCFaction = Take from the whole PC faction

*/

// FAB 9/30

// DBR 8/10/6

#include "nw_i0_plot"

void DestroyItems(object oTarget,string sItem,int nNumItems)

{

int nCount = 0;

object oItem = GetFirstItemInInventory(oTarget);

while (GetIsObjectValid(oItem) == TRUE && nCount < nNumItems)

{

if (GetTag(oItem) == sItem)

{

//ActionTakeItem(oItem,oTarget);

DestroyObject(oItem,0.1f);

nCount++;

}

oItem = GetNextItemInInventory(oTarget);

}

return;

}

void main(string sItemTag,int nQuantity,int bPCFaction)

{

int nTotalItem;

object oPCF,oPC = (GetPCSpeaker()==OBJECT_INVALID?GetFirstPC():GetPCSpeaker());

object oItem; // Items in inventory

if ( bPCFaction == 0 )

{

if ( nQuantity < 0 ) // Destroy all instances of the item

{

nTotalItem = GetNumItems( oPC,sItemTag );

DestroyItems( oPC,sItemTag,nTotalItem );

}

else

{

DestroyItems( oPC,sItemTag,nQuantity );

}

}

else // For multiple players

{

oPCF = GetFirstFactionMember(oPC,FALSE);

while (( GetIsObjectValid(oPCF) )&&(nQuantity!=0))

{

if ( nQuantity < 0 ) // Destroy all instances of the item

{

nTotalItem = GetNumItems( oPCF,sItemTag );

DestroyItems( oPCF,sItemTag,nTotalItem );

}

else

{

nTotalItem = GetNumItems( oPCF,sItemTag );

nQuantity -= nTotalItem;

if (nQuantity<0)

{

nTotalItem+=nQuantity;

nQuantity=0;

}

DestroyItems( oPCF,sItemTag,nTotalItem );

}

oPCF = GetNextFactionMember(oPC,FALSE);

}

}

}

// ga_destroy_party_henchmen

/*

Destroy all henchmen in the entire party

*/

// ChazM 12/5/05

// ChazM 1/26/05 - Bug fix

// ChazM 3/8/06 - funcs moved to ginc_henchman

#include "ginc_henchman"

#include "ginc_debug"

/*

int GetNumHenchmen(object oMaster=OBJECT_SELF)

{

int i = 1;

object oHenchman = GetHenchman(oMaster, i);

while (GetIsObjectValid(oHenchman))

{

i++;

//PrettyDebug ("GetNumHenchmen() - found: " + GetName(oHenchman));

oHenchman = GetHenchman(oMaster, i);

}

i = i-1;

//PrettyDebug ("GetNumHenchmen() - Total found = " + IntToString(i));

return (i);

}

// Destroy a henchman

// Note: won't be destroyed if has been set as undestroyable

void DestroyHenchman(object oHenchman)

{

//PrettyDebug ("Removing " + GetName(oHenchman));

RemoveHenchman(GetMaster(oHenchman), oHenchman);

SetPlotFlag(oHenchman, FALSE);

DestroyObject(oHenchman);

}

// Destroy all the henchmen of this master

void DestroyAllHenchmen(object oMaster=OBJECT_SELF)

{

int i;

object oHenchman;

// destroy them backwards to avoid problems w/ removeing henchmen causing re-indexing

int iNumHenchmen = GetNumHenchmen(oMaster);

for (i = iNumHenchmen; i>=1; i--)

{

oHenchman = GetHenchman(oMaster, i);

//PrettyDebug ("Removing " + GetName(oHenchman));

//RemoveHenchman(oMaster, oHenchman);

//SetPlotFlag(oHenchman, FALSE);

DelayCommand(0.5f, DestroyHenchman(oHenchman)); // delay destructions so we have time to iterate through party properly

}

}

// Destroy every henchman in the entire party

void DestroyAllHenchmenInParty(object oPartyMember)

{

object oFM = GetFirstFactionMember(oPartyMember, FALSE);

while(GetIsObjectValid(oFM))

{

//PrettyDebug ("Examining " + GetName(oFM) + " for henchmen.");

DestroyAllHenchmen(oFM);

oFM = GetNextFactionMember(oPartyMember, FALSE);

}

}

*/

void main()

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

DestroyAllHenchmenInParty(oPC);

}

// ga_disable_scripts

/*

saves and clears the event handlers

*/

// ChazM 12/21/05

//

#include "ginc_param_const"

#include "ginc_event_handlers"

void main(string sTarget)

{

object oTarget = GetTarget(sTarget);

SaveEventHandlers(oTarget);

ClearEventHandlers(oTarget);

}

// ga_donothing.nss

/*

Do nothing, really.

*/

// BMA-OEI 8/17/05

// BMA-OEI 1/11/06 removed default param

#include "ginc_debug"

void main(string sDebugMessage)

{

if (sDebugMessage == "") sDebugMessage = "this is a placeholder script";

PrettyMessage("ga_donothing: rly " + sDebugMessage);

}

// ga_door_close

/*

This closes a door

sTag = The tag of the door to close

nLock = Set to 1 if you want to lock the door after it closes

*/

// FAB 10/11

void main(string sTag, int nLock)

{

object oDoor = GetObjectByTag( sTag );

DelayCommand ( 0.1, AssignCommand( oDoor, ActionCloseDoor( oDoor ) ) );

if ( nLock == 1 ) SetLocked( oDoor, TRUE );

}

// ga_door_open

/*

This opens a door

sTag = The tag of the door to open

*/

// FAB 10/11

void main(string sTag)

{

object oDoor = GetObjectByTag( sTag );

SetLocked( oDoor, FALSE );

DelayCommand ( 0.1, AssignCommand( oDoor, ActionOpenDoor( oDoor ) ) );

}

// ga_effect

/*

Does an effect on the specified target. This function takes 5 params:

string sEffect - one of the below effects

string sParams - comma delimited list of needed params

string sDuration - I - Instant (default), P - Permanent, or T, - Temporary w/ specified duration

ex: temporay 30 seconds would be "T,30.0f"

int iVisualEffect - -1=no visual, 0 = standard visual, or supply your own from visualeffects.2da (will be applied as an instant)

string sTarget - Uses the standard GetTarget() function - default is the PC Speaker

*** Effects and Paramaters ***

AbilityIncrease - nAbility , nModifyBy -- Abilities: Str=0, Dex=1, Con=2, Int=3, Wis=4, Cha=5

AbilityDecrease - nAbility, nModifyBy

Blindness - no params

Damage - nDamageAmount, nDamageType, nDamagePower -- Types: Bludgeon=1, acid=16, fire=256, etc.; Powers: Normal=0, PlusThree=3, etc.

Death - no params

Disease - nDiseaseType -- (0-16) see DISEASE_* constants in nwscript.nss

Heal - nDamageToHeal

Paralyze - no params

Poison - nPoisonType -- (0-43) see POISON_* constants in nwscript.nss

Raise - no params

Visual - nVisualEffectId -- see visualeffects.2da for param options

Example 1:

This action script will heal the PC Speaker 100hp in a conversation

ga_effect ("Heal", "100", "", 0, "")

Example 2:

This action script will permanently give the PC Speaker in a conversation increased strength (+2)

ga_effect ("AbilityIncrease", "0,2", "P", 0, "")

*/

// ChazM 4/11/05

// ChazM 11/6/06 - fixed params to be 0 based instead of 1 based (Bug found by robertharris).

// Added a few more effects, added support for linked duration visual effects, edited description.

// ChazM 11/6/06 fixed some visual effects, other minor changes.

#include "ginc_param_const"

void DoEffect(string sEffect, string sParams, string sDuration, int iVisualEffect, object oTarget);

void main(string sEffect, string sParams, string sDuration, int iVisualEffect, string sTarget)

{

object oTarget = GetTarget(sTarget, "$PC");

DoEffect(sEffect, sParams, sDuration, iVisualEffect, oTarget);

}

void DoEffect(string sEffect, string sParams, string sDuration, int iVisualEffect, object oTarget)

{

int iDurationType = GetDurationType(GetStringParam(sDuration, 0));

float fDuration = 0.0f;

if (iDurationType == DURATION_TYPE_TEMPORARY)

fDuration = GetFloatParam(sDuration, 1);

sEffect = GetStringLowerCase(sEffect);

effect eEffect;

int iVis = 0;

int iVisType = DURATION_TYPE_INSTANT;

if(sEffect == "abilitydecrease"){

eEffect = EffectAbilityDecrease(GetIntParam(sParams, 0), GetIntParam(sParams, 1));

iVis = VFX_IMP_REDUCE_ABILITY_SCORE;

} else

if(sEffect == "abilityincrease"){

eEffect = EffectAbilityIncrease(GetIntParam(sParams, 0), GetIntParam(sParams, 1));

iVis = VFX_IMP_IMPROVE_ABILITY_SCORE;

} else

if(sEffect == "blindness"){

eEffect = EffectBlindness();

iVis = VFX_IMP_BLIND_DEAF_M ;

} else

if(sEffect == "damage"){

eEffect = EffectDamage(GetIntParam(sParams, 0), GetIntParam(sParams, 1), GetIntParam(sParams, 2));

// iVis should be based on type

iVis = VFX_IMP_FLAME_M;

} else

if(sEffect == "death"){

eEffect = EffectDeath();

iVis = VFX_IMP_DISEASE_S;

} else

if(sEffect == "disease"){

eEffect = EffectDisease(GetIntParam(sParams, 0));

iVis = VFX_IMP_DEATH;

} else

if(sEffect == "haste"){

eEffect = EffectHaste();

iVis = VFX_IMP_HASTE;

} else

if(sEffect == "heal"){

eEffect = EffectHeal(GetIntParam(sParams, 0));

iVis = VFX_IMP_HEALING_G;

} else

if(sEffect == "paralyze"){

eEffect = EffectParalyze();

iVisType = DURATION_TYPE_TEMPORARY;

iVis = VFX_DUR_PARALYZED;

} else

if(sEffect == "poison"){

eEffect = EffectPoison(GetIntParam(sParams, 0));

iVis = VFX_IMP_POISON_L;

} else

if((sEffect == "resurrection") || (sEffect == "raise")){

eEffect = EffectResurrection();

iVis = VFX_IMP_HEALING_G;

} else

if(sEffect == "visual"){

eEffect = EffectVisualEffect(GetIntParam(sParams, 0));

} else

{

PrintString ("effect not defined: " + sEffect);

return;

}

if (iVisualEffect >= 0)

{

if (iVisualEffect == 0)

iVisualEffect = iVis;

effect eVis = EffectVisualEffect(iVisualEffect);

// Apply the visual effect to the target

if (iVisType == DURATION_TYPE_INSTANT)

{

ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);

}

else if (iVisType == DURATION_TYPE_TEMPORARY)

{

// link temporary visual effects to the actual effect.

eEffect = EffectLinkEffects(eEffect, eVis);

}

}

ApplyEffectToObject(iDurationType, eEffect, oTarget, fDuration);

PrintString ("Applied " + sEffect + " effect to " + GetName(oTarget) + " with Duration " + IntToString(iDurationType) + " " + FloatToString(fDuration));

}

// ga_enable_scripts

/*

restores the saved event handlers

*/

// ChazM 12/21/05

//

#include "ginc_param_const"

#include "ginc_event_handlers"

void main(string sTarget)

{

object oTarget = GetTarget(sTarget);

RestoreEventHandlers(oTarget);

DeleteSavedEventHandlers(oTarget);

}

// ga_end_game( string sEndMovie )

void main( string sEndMovie )

{

EndGame( sEndMovie );

}

// ga_face_target(string sFacer, string sTarget, int bLockOrientation)

/*

This script commands sFacer to face sTarget.

Parameters:

string sFacer = Tag of object that will do the facing. Default is OWNER

string sTarget = Tag of object that sFacer will orient towards.

int bLockOrientation = If =1, dialog manager will stop adjusting sFacer's facing for the active dialog.

*/

// BMA-OEI 1/09/06

// EPF 6/22/06 second parameter now uses GetTarget so param constants can be specified for both parameters.

#include "ginc_actions"

#include "ginc_param_const"

void main(string sFacer, string sTarget, int bLockOrientation)

{

object oFacer = GetTarget(sFacer, TARGET_OWNER);

object oTarget = GetTarget(sTarget);

vector vTarget = GetPosition(oTarget);

AssignCommand(oFacer, ActionDoCommand(SetFacingPoint(vTarget, bLockOrientation)));

AssignCommand(oFacer, ActionWait(0.5f));

}

// ga_faction_join

/*

This script makes sTarget join a new faction.

sTarget - The target who's faction will change (see Target's note).

sTargetFaction - Either one of the 4 standard factions $COMMONER, $DEFENDER, $HOSTILE, $MERCHANT or

a target who's faction is to be joined (must be a creature)

*/

// ChazM 2/25/05

// DBR 11/09/06 - TargetFactionMember was using wrong target string

#include "ginc_param_const"

#include "nw_i0_generic"

void main(string sTarget, string sTargetFaction)

{

object oTarget = GetTarget(sTarget);

int iFaction = GetStandardFaction(sTargetFaction);

if (iFaction != -1) {

ChangeToStandardFaction(oTarget, iFaction);

PrintString ("Changed to standard faction " + sTargetFaction );

}

else {

object oTargetFactionMember = GetTarget(sTargetFaction);

ChangeFaction(oTarget, oTargetFactionMember);

PrintString ("Changed to same faction as " + GetName(oTarget));

}

AssignCommand(oTarget, DetermineCombatRound());

}

// ga_faction_rep

/*

This script makes sTarget be viewed differently by a faction.

sTarget - The target who will be viewed differently (see Target's note).

sTargetFaction - Either one of the 4 standard factions $COMMONER, $DEFENDER, $HOSTILE, $MERCHANT or

a target who belongs to the faction (may or may not need to be a creature)

sChange - the amount to change the faction reputation by. (May later be ammended to allow setting).

*/

// ChazM 2/25/05

#include "ginc_param_const"

#include "nw_i0_generic"

void main(string sTarget, string sTargetFaction, string sChange)

{

object oTarget = GetTarget(sTarget);

int iChange = StringToInt(sChange);

if(!GetIsObjectValid(oTarget))

{

PrintString ("Invalid Target");

return;

}

int iFaction = GetStandardFaction(sTargetFaction);

if (iFaction == -1) {

object oTargetFaction = GetTarget(sTargetFaction);

if(GetIsObjectValid(oTargetFaction))

{

AdjustReputation(oTarget, oTargetFaction, iChange);

PrintString ("adjust faction reputation for " + GetName(oTarget) + " with faction of " + sTargetFaction + " by " + IntToString(iChange));

// this may be guy in completely different area, use nearest enemy instead in all cases

//AssignCommand(oTargetFaction, DetermineCombatRound());

}

}

else {

int iNewReputation = GetStandardFactionReputation(iFaction, oTarget) + iChange;

SetStandardFactionReputation(iFaction, iNewReputation, oTarget);

PrintString ("adjust faction reputation for " + GetName(oTarget) + " with " + sTargetFaction + " by " + IntToString(iChange));

// need to find closest and set to Determine Combat Round.

}

object oNearestEnemy = (GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, oTarget));

AssignCommand(oNearestEnemy, DetermineCombatRound());

}

// ga_fade_from_black

//

// wrapper function for FadeToBlackParty() to fade all party members from black. If the screen

// had previously faded into a specific color, FadeToBlackParty() will fade back from that color.

//

// fSpeed controls how quickly, in seconds, the screen will fade to black. Setting this to 0 will

// result in an instant fade from black. Standard value is 1.0.

//

// bColor allows users to specify what color the screen should fade back from. Basic colorlist:

// 0 = black

// Note: bColor

//

// CGaw 2/13/06 - Created.

#include "ginc_cutscene"

void main(float fSpeed)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

FadeToBlackParty(oPC, 0, fSpeed);

}

// ga_fade_to_black

//

// wrapper function for FadeToBlackParty() to fade all party members to black.

//

// fSpeed controls how quickly, in seconds, the screen will fade to black. Setting this to 0 will

// result in an instant fade to black.

//

// fFailsafe indicates the maximum lenght of time, in seconds, that the screen will remain black

// before automatically fading back in. Leave at 0.0 to use the default value of 15 seconds.

// nColor allows users to specify what color the screen should fade into. Basic colorlist:

// 0 = black, 16777215 = white. Hex Values for colors may be found in NWN2_Colors.2da, though

// they must be converted to decimal form before use.

//

// CGaw 2/13/06 - Created.

// CGaw 3/10/06 - Added color value information.

// ChazM 9/26/06 - changed fFailsafe default.

#include "ginc_cutscene"

#include "ginc_math"

void main(float fSpeed, float fFailsafe, int nColor)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

if (IsFloatNearInt(fFailsafe, 0))

fFailsafe = 15.0f;

FadeToBlackParty(oPC, 1, fSpeed, fFailsafe, nColor);

}

// ga_floating_str_ref

/*

Do floaty str ref text on PC speaker

*/

// ChazM 6/27/06

#include "ginc_debug"

void main(int iStrRef)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

string sStrRef = GetStringByStrRef(iStrRef);

//PrettyDebug ("Doing floaty text " + sStrRef + " on " + GetName(oPC));

FloatingTextStrRefOnCreature(iStrRef, oPC);

}

// ga_floating_text

/*

Do floaty text on PC speaker

*/

// ChazM 6/27/06

#include "ginc_debug"

void main(string sText)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

// PrettyDebug ("Doing floaty text on " + GetName(oPC));

FloatingTextStringOnCreature(sText, oPC);

}

// ga_force_exit

/*

Wrapper for ForceExit, which makes a creature "exit" by moving it to a location and then removing it.

Params:

sCreatureTag - tag of the exiting creature

sWPTag - tag of the waypoint (or object) to move to.

bRun - 0 = walk; 1 = run

When the creature reaches the specified loaction he will be destroyed, or in the case of roster members, despawned.

Note: This is inteded to always work, and will remove flags such as plot and not-destroyable from the creature

before attempting to destroy it.

*/

// EPF

// ChazM 6/22/06 - just a comment change.

// ChazM 9/18/06 - more comment changes.

#include "ginc_misc"

void main(string sCreatureTag, string sWPTag, int bRun)

{

//PrettyDebug("Forcing Exit!");

ForceExit(sCreatureTag, sWPTag, bRun);

}

// ga_gint_max

/*

This script changes a global int variable's value

Parameters:

string sVariable = Name of variable to change

string sChange = VALUE (EFFECT)

"5" (Set to 5)

"=-2" (Set to -2)

"+3" (Add 3)

"+" (Add 1)

"++" (Add 1)

"-4" (Subtract 4)

"-" (Subtract 1)

"--" (Subtract 1)

int iMin = Minimum Value

int iRule = Special case rule

if both the original value and the new calculated value are above the maximum,

apply the following rule:

0 - make no change to the original value

1 - set to maximum value

2 - use least of either the original or the changed value.

*/

// ChazM 8/26/05

#include "ginc_var_ops"

void main(string sVariable, string sChange, int iMax, int iRule)

{

int nOldValue = GetGlobalInt(sVariable);

int nNewValue = CalcNewIntValue(nOldValue, sChange);

if (nNewValue > iMax)

{

if (nOldValue > iMax)

{

if (iRule == 0)

return; // stick w/ old value

if (iRule == 1)

nNewValue = iMax;

if (iRule == 2)

if (nOldValue < nNewValue)

return; // stick w/ old value, else just use new value

}

else

nNewValue = iMax;

}

// Debug Message - comment or take care of in final

//SendMessageToPC( oPC, sTagOver + "'s variable " + sScript + " is now set to " + IntToString(nChange) );

SetGlobalInt(sVariable, nNewValue);

}

// ga_gint_min

/*

This script changes a global int variable's value

Parameters:

string sVariable = Name of variable to change

string sChange = VALUE (EFFECT)

"5" (Set to 5)

"=-2" (Set to -2)

"+3" (Add 3)

"+" (Add 1)

"++" (Add 1)

"-4" (Subtract 4)

"-" (Subtract 1)

"--" (Subtract 1)

int iMin = Minimum Value

int iRule = Special case rule

if both the original value and the new calculated value are below the minimum,

apply the following rule:

0 - make no change to the original value

1 - set to minimum value

2 - use larget of either the original or the changed value.

*/

// ChazM 8/26/05

#include "ginc_var_ops"

void main(string sVariable, string sChange, int iMin, int iRule)

{

int nOldValue = GetGlobalInt(sVariable);

int nNewValue = CalcNewIntValue(nOldValue, sChange);

if (nNewValue < iMin)

{

if (nOldValue < iMin)

{

if (iRule == 0)

return; // stick w/ old value

if (iRule == 1)

nNewValue = iMin;

if (iRule == 2)

if (nOldValue > nNewValue)

return; // stick w/ old value, else just use new value

}

else

nNewValue = iMin;

}

// Debug Message - comment or take care of in final

//SendMessageToPC( oPC, sTagOver + "'s variable " + sScript + " is now set to " + IntToString(nChange) );

SetGlobalInt(sVariable, nNewValue);

}

// ga_give_feat

/*

This gives a feat to a creature, player or players.

sTarg = The creature to give the feat to. If blank, assign to PC

nFeat = The number of the feat. See nwscript.nss for a list of feats.

bCheckReq = Check if the creature meets the feat's prerequisites before adding.

bAllPCs = If set to 1 it gives the feat to all the PCs (MP only).

*/

// TDE 3/4/06

// EPF 7/21/06 -- using GetTarget instead of GetObjectByTag()

#include "ginc_param_const"

void main(string sTarg, int nFeat, int bCheckReq, int bAllPCs)

{

object oTarg;

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

if ( sTarg == "" )

{

if ( !bAllPCs )

FeatAdd(oPC, nFeat, bCheckReq);

else

{

oTarg = GetFirstPC();

while(GetIsObjectValid(oTarg))

{

FeatAdd(oTarg, nFeat, bCheckReq);

oTarg = GetNextPC();

}

}

}

else

{

oTarg = GetTarget(sTarg);

FeatAdd(oTarg, nFeat, bCheckReq);

}

}

// ga_give_gold

/*

This gives the player some gold

nGP = The amount of gold coins given to the PC

nAllPCs = If set to 1 it gives gold to all the PCs (MP only)

*/

// FAB 9/30

void main(int nGP, int nAllPCs)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

if ( nAllPCs == 0 )

GiveGoldToCreature( oPC,nGP );

else

{

object oTarg = GetFirstPC();

while(GetIsObjectValid(oTarg))

{

GiveGoldToCreature( oTarg,nGP );

oTarg = GetNextPC();

}

}

}

// ga_give_inventory

/*

This script takes items from sGiver's inventory and gives it to sReceiver.

Parameters:

string sGiver = Tag of object giving items. Default is OWNER.

string sReceiver = Tag of object receiving items. Default is PC.

int iInventoryContents = Which items to donate:

0 = All inventory items, equipped items and gold. (Giver must be creature)

1 = All inventory items only.

2 = All equipped items only. (Giver must be creature)

*/

// CGaw 3/10/06

// ChazM 3/15/06 - minor changes

#include "ginc_item"

#include "ginc_param_const"

void main(string sGiver, string sReceiver, int iInventoryContents)

{

object oGiver = GetTarget(sGiver, TARGET_OWNER);

object oReceiver = GetTarget(sReceiver, TARGET_PC);

PrettyDebug ("sGiver = " + GetName(oGiver));

PrettyDebug ("sReceiver = " + GetName(oReceiver));

switch(iInventoryContents)

{

case 0:

GiveEverything(oGiver, oReceiver);

break;

case 1:

GiveAllInventory(oGiver, oReceiver);

break;

case 2:

GiveAllEquippedItems(oGiver, oReceiver);

break;

}

}

// ga_give_item( string sTemplate, int nQuantity, int bAllPCs )

/*

Creates item on PC(s)

Parameters:

string sTemplate = Item blueprint ResRef

int nQuantity = Stack size for item (default: 1)

int bAllPCs = If =1 create item on all player characters (MP)

*/

// FAB 9/30

// ChazM 10/19/05 - check if item is stackable and if not then give the quantity 1 at a time.

// EPF 7/27/06 -- complete rewrite to address a bug and a number of stylistic pet peeves. Also

// using a new method of tracking whether an item is stackable that Dan suggested.

#include "ginc_debug"

void CreateItemsOnObject( string sTemplate, object oTarget=OBJECT_SELF, int nItems=1 );

void main( string sTemplate, int nQuantity, int bAllPCs )

{

object oPC = GetPCSpeaker();

if ( GetIsObjectValid(oPC) == FALSE )

{

oPC = OBJECT_SELF;

}

// default stack size

if ( nQuantity < 1 )

{

nQuantity = 1;

}

if ( bAllPCs == FALSE )

{

CreateItemsOnObject( sTemplate, oPC, nQuantity );

}

else

{

oPC = GetFirstPC();

while ( GetIsObjectValid(oPC) == TRUE )

{

CreateItemsOnObject( sTemplate, oPC, nQuantity );

oPC = GetNextPC();

}

}

}

void CreateItemsOnObject( string sTemplate, object oTarget=OBJECT_SELF, int nItems=1 )

{

int i = 1;

while ( i <= nItems )

{

CreateItemOnObject( sTemplate, oTarget, 1 );

i++;

}

}

// ga_give_item_global_int

/*

This gives the player a number of items. The number is defined by a global int

sItemRR = This is the string name of the item's ResRef

sGlobalNum = The string of the global integer that contains the number of items to give

nAllPCs = If set to 1 it gives the item to all PCs (MP only)

*/

// TDE 7/19/06

//Returns TRUE if oItem is stackable

int GetIsStackableItem(string sItemRR)

{

//Must have a chest tagged checkchest

//object oCopy = CopyItem(oItem, GetObjectByTag("checkchest"));

object oCheck = GetObjectByTag("checkchest");

if (!GetIsObjectValid(oCheck))

oCheck = OBJECT_SELF;

object oCopy = CreateItemOnObject(sItemRR, oCheck, 2);

//Set the stacksize to two

//SetItemStackSize(oCopy, 2);

//Check if it really is two - otherwise, not stackable!

int bStack=GetItemStackSize(oCopy)==2;

//Destroy the test copy

DestroyObject(oCopy);

//Return bStack which is TRUE if item is stackable

return bStack;

}

void CreateItemsOnObject(string sItemTemplate, object oTarget, int nNumToCreate)

{

int i;

if(nNumToCreate > 1)

{

if (GetIsStackableItem(sItemTemplate))

{

CreateItemOnObject(sItemTemplate, oTarget, nNumToCreate);

}

else

for (i=1; i<=nNumToCreate; i++)

{

CreateItemOnObject(sItemTemplate, oTarget);

}

}

}

void main(string sItemRR, string sGlobalNum, int nAllPCs)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

// Check the global integer for the number of items to give

int nQuantity = GetGlobalInt(sGlobalNum);

if ( nQuantity == 0 )

nQuantity = 1;

if ( nAllPCs == 0 )

CreateItemsOnObject(sItemRR, oPC, nQuantity );

else

{

object oTarg = GetFirstPC();

while(GetIsObjectValid(oTarg))

{

CreateItemsOnObject( sItemRR,oTarg,nQuantity );

oTarg = GetNextPC();

}

}

}

// ga_give_partial_quest_xp

//

// Give everyone experience for completing a quest. The experience goes to

// ALL PCs in the party. Distinguished from ga_give_quest_xp in that you can specify the percentage

// of the quest experience you want to give out, so, say if you have a 4-part quest, you could

// award 25% of the experience for completing each portion. There is a cap in place so you can't

// accidentally award more than 100% overall.

// EPF 3/15/06

#include "ginc_journal"

void main(string sQuestTag, int nPercentXP)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

RewardPartyCappedQuestXP(oPC, sQuestTag, nPercentXP);

}

// ga_give_quest_xp

//

// Give everyone experience for completing a quest. The experience goes to

// ALL PCs in the party.

// EPF 3/15/06

#include "ginc_journal"

void main(string sQuestTag)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

RewardPartyQuestXP(oPC, sQuestTag);

}

// ga_give_xp

/*

This gives the player some experience

nXP = The amount of experience given to the PC

nAllPCs = If set to 1 it gives XP to all the PCs (MP only)

*/

// FAB 9/30

void main(int nXP, int nAllPCs)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

if ( nAllPCs == 0 ) GiveXPToCreature(oPC, nXP );

else

{

object oTarg = GetFirstPC();

while(GetIsObjectValid(oTarg))

{

GiveXPToCreature( oTarg,nXP );

oTarg = GetNextPC();

}

}

}

// ga_global_float

/*

This script changes a global float variable's value

Parameters:

string sVariable = Name of variable to change

string sChange = VALUE (EFFECT)

"5.1" (Set to 5.1)

"=-2.3" (Set to -2.3)

"+3.0" (Add 3.0)

"+" (Add 1.0)

"++" (Add 1.0)

"-4.9" (Subtract 4.9)

"-" (Subtract 1.0)

"--" (Subtract 1.0)

*/

// FAB 10/7

// BMA 4/15/05 added set operator, "=n"

void main(string sVariable, string sChange )

{

float fChange;

if (GetStringLeft(sChange, 1) == "=")

{

// BMA 4/15/05

sChange = GetStringRight(sChange, GetStringLength(sChange) - 1);

fChange = StringToFloat(sChange);

}

else if (GetStringLeft(sChange, 1) == "+")

{

// If sChange is just "+" then default to increment by 1

if (GetStringLength(sChange) == 1)

{

fChange = GetGlobalFloat(sVariable) + 1.0;

}

else // This means there's more than just "+"

{

if (GetSubString(sChange, 1, 1) == "+") // "++" condition

{

fChange = GetGlobalFloat(sVariable) + 1.0;

}

else

{

sChange = GetStringRight(sChange, GetStringLength(sChange) - 1);

fChange = StringToFloat(sChange) + GetGlobalFloat(sVariable);

}

}

}

else if (GetStringLeft(sChange, 1) == "-")

{

// If sChange is just "-" then default to increment by 1

if (GetStringLength(sChange) == 1)

{

fChange = GetGlobalFloat(sVariable) - 1.0;

}

else // This means there's more than just "-"

{

if (GetSubString(sChange, 1, 1) == "-") // "--" condition

{

fChange = GetGlobalFloat(sVariable) - 1.0;

}

else

{

sChange = GetStringRight(sChange, GetStringLength(sChange) - 1);

fChange = GetGlobalFloat(sVariable) - StringToFloat(sChange);

}

}

}

else

{

fChange = StringToFloat(sChange);

if (sChange == "") fChange = GetGlobalFloat(sVariable) + 1.0;

}

SetGlobalFloat(sVariable, fChange);

}

// ga_global_int

/*

This script changes a global int variable's value

Parameters:

string sVariable = Name of variable to change

string sChange = VALUE (EFFECT)

"5" (Set to 5)

"=-2" (Set to -2)

"+3" (Add 3)

"+" (Add 1)

"++" (Add 1)

"-4" (Subtract 4)

"-" (Subtract 1)

"--" (Subtract 1)

*/

// FAB 10/7

// BMA 4/15/05 added set operator, "=n"

// ChazM 5/4/05 mod

#include "ginc_var_ops"

void main(string sVariable, string sChange )

{

int nOldValue = GetGlobalInt(sVariable);

int nNewValue = CalcNewIntValue(nOldValue, sChange);

// Debug Message - comment or take care of in final

//SendMessageToPC( oPC, sTagOver + "'s variable " + sScript + " is now set to " + IntToString(nChange) );

SetGlobalInt(sVariable, nNewValue);

}

// ga_global_string

/*

This script changes a local string variable's value

sScript = This is the name of the variable being changed

sChange = This is what the local string is set to.

*/

// FAB 10/7

void main(string sScript, string sChange)

{

float fChange;

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

// Debug Message - comment or take care of in final

//SendMessageToPC( oPC, sTagOver + "'s variable " + sScript + " is now set to " + sChange );

SetGlobalString( sScript, sChange );

}

// ga_heal_pc

/*

This command heals the PC (and potentially their party)

nHealPercent = This is the % damage the PC will be healed, 0 = 100% by default

nFullParty = This is a boolean, by default it is FALSE and only the PC will be healed, 1 is full party

*/

// FAB 9/30

void main(int nHealPercent, int nFullParty)

{

object oPC = GetFirstPC();

object oComp;

int nCurrentHP;

int nHP;

int nCompNumber = 1; // This is the companion number index

effect eFX;

if ( nHealPercent == 0 ) nHealPercent = 100;

while( GetIsObjectValid(oPC) )

{

nCurrentHP = GetCurrentHitPoints( oPC );

nHP = FloatToInt( IntToFloat(GetMaxHitPoints(oPC)) * IntToFloat(nHealPercent) / 100 ) - nCurrentHP;

eFX = EffectHeal( nHP );

ApplyEffectToObject( DURATION_TYPE_PERMANENT,eFX,oPC );

oPC = GetNextPC();

}

if ( nFullParty != 0 )

{

oPC = GetFirstPC();

oComp = GetHenchman( oPC,1 );

while( GetIsObjectValid(oComp) )

{

nCurrentHP = GetMaxHitPoints( oComp );

nHP = FloatToInt( IntToFloat(nCurrentHP) * IntToFloat(nHealPercent) / 100 ) - nCurrentHP;

eFX = EffectHeal( nHP );

ApplyEffectToObject( DURATION_TYPE_PERMANENT,eFX,oComp );

nCompNumber++;

oComp = GetHenchman( oPC,nCompNumber );

}

}

}

//::///////////////////////////////////////////////////////////////////////////

//::

//:: ga_henchman_add

//::

//:: Adds a target creature to your party as a henchman (not a companion).

//::

//:: Parameters:

//:: sTarget - tag of the creature you want to add

//:: bForce - if set to 1, sTarget will be added even if player already has maximum henchman

//:: sMaster - The Creature you are adding the henchman to (default is PC Speaker)

//:: bOverrideBehavior - if set to 1, sTarget's event handlers (scripts) will be replaced with henchman ones.

//::

//::///////////////////////////////////////////////////////////////////////////

// DBR 1/28/06

#include "ginc_param_const"

#include "ginc_henchman"

void main(string sTarget, int bForce, string sMaster, int bOverrideBehavior)

{

object oMaster,oHench;

if (sMaster=="")

oMaster=(GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

else

oMaster=GetTarget(sMaster);

oHench =GetTarget(sTarget);

if (!GetIsObjectValid(oMaster))//tests for safety

{

PrintString("ga_henchman_add: Couldn't find master: "+sMaster);

return;

}

if (!GetIsObjectValid(oHench))

{

PrintString("ga_henchman_add: Couldn't find henchman: "+sTarget);

return;

}

HenchmanAdd(oMaster,oHench,bForce,bOverrideBehavior);

}

//::///////////////////////////////////////////////////////////////////////////

//::

//:: ga_henchman_remove

//::

//:: Removes a target creature from your party (must be a henchman, not a companion).

//::

//:: Parameters:

//:: sTarget - tag of the creature you want to remove. Default is NPC speaker

//:: sOptionalMasterTag - No longer used.

//::

//::///////////////////////////////////////////////////////////////////////////

// DBR 1/28/06

// ChazM 10/18/06 - sOptionalMasterTag no longer used.

#include "ginc_param_const"

#include "ginc_henchman"

// sOptionalMasterTag no longer used

void main(string sTarget, string sOptionalMasterTag)

{

object oMaster, oHench;

oHench = GetTarget(sTarget);

if (!GetIsObjectValid(oHench)) //does he exist?

{

PrettyDebug("ga_henchman_remove: Couldn't find henchman: " + sTarget);

return;

}

oMaster = GetMaster(oHench);

if (!GetIsObjectValid(oMaster)) //Safety first, ladies and gentlemen

{

PrettyDebug("ga_henchman_remove: Couldn't reference master.");

return;

}

HenchmanRemove(oMaster,oHench);

}

//::///////////////////////////////////////////////////////////////////////////

//::

//:: ga_henchman_replace

//::

//:: Repalces a target henchman from your party with another (henchmen are not companions).

//::

//:: Parameters:

//:: sOld - tag of the creature you want to remove as a companion.

//:: sNew - tag of the creature you want to add as a companion.

//:: bForce - if set to 1, sTarget will be added even if player already has maximum henchman

//:: bOverrideBehavior - if set to 1, sTarget's event handlers (scripts) will be replaced with henchman ones.

//:: sOptionalMasterTag - OPTIONAL - if ga_henchman_add wasn't used to add the henchman, you can supply the master tag here.

//::

//::///////////////////////////////////////////////////////////////////////////

// DBR 1/28/06

#include "ginc_param_const"

#include "ginc_henchman"

void main(string sOld, string sNew, int bForce, int bOverrideBehavior, string sOptionalMasterTag)

{

object oMaster=OBJECT_INVALID,oNew,oOld;

if (sOld=="") //Get the old henchman

oOld =GetLastSpeaker();

else

oOld =GetTarget(sOld);

if (!GetIsObjectValid(oOld)) //does he exist?

{

PrintString("ga_henchman_replace: Couldn't find henchman: "+sNew);

return;

}

if (sNew=="") //Get the new henchman

oNew =GetLastSpeaker();

else

oNew =GetTarget(sNew);

if (!GetIsObjectValid(oNew)) //does he exist?

{

PrintString("ga_henchman_replace: Couldn't find henchman: "+sOld);

return;

}

//Get the Master

if (sOptionalMasterTag!="") //if a tag was supplied, use that

oMaster=GetTarget(sOptionalMasterTag);

if (!GetIsObjectValid(oMaster)) //if we still don't have a master, try checking for a stored value

oMaster=GetLocalObject(oOld,sMasterRef);

if (!GetIsObjectValid(oMaster)) //if we still don't have a master, try using the PC Speaker

oMaster=(GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

if (!GetIsObjectValid(oMaster)) //Safety first, ladies and gentlemen

{

PrintString("ga_henchman_replace: Couldn't reference master.");

return;

}

//Ok, boot out the old henchman

HenchmanRemove(oMaster,oOld);

//And welcome in the new henchman

HenchmanAdd(oMaster,oNew,bForce,bOverrideBehavior);

}

//::///////////////////////////////////////////////////////////////////////////

//::

//:: ga_henchman_setmax

//::

//:: Sets the maximum number of allowed Henchmen (henchmen are not companions).

//::

//:: Parameters:

//:: sChange - Acts just like ga_local_int, give it the string of your change.

//:: = VALUE (EFFECT)

//:: "5" (Set to 5)

//:: "=-2" (Set to -2)

//:: "+3" (Add 3)

//:: "+" (Add 1)

//:: "++" (Add 1)

//:: "-4" (Subtract 4)

//:: "-" (Subtract 1)

//:: "--" (Subtract 1)

//::

//::///////////////////////////////////////////////////////////////////////////

// DBR 1/28/06 - I so ripped this off of ga_local_int. Thank you FAB.

#include "ginc_param_const"

#include "ginc_var_ops"

//#include "ginc_henchman"

void main(string sChange)

{

int nOldValue = GetMaxHenchmen();

int nNewValue = CalcNewIntValue(nOldValue, sChange);

SetMaxHenchmen(nNewValue);

}

// ga_journal(string sCategoryTag, int nEntryID, int bAllPartyMembers, int bAllPlayers, int bAllowOverrideHigher)

/*

Wrapper to add an entry to PCSpeaker's journal.

Parameters:

string sCategoryTag = The tag of the Journal category (case sensitive).

int nEntryID = The ID of the Journal entry.

int bAllPartyMembers = If =1, the entry is added to the journal of all of oCreature's Party. (Default: =1)

int bAllPlayers = If =1, the entry will show up in the journal of all PCs in the module. (Default: =0)

int bAllowOverrideHigher = If =1, override restriction that nState must be > current Journal Entry. (Default: =0)

*/

// BMA-OEI 10/14/05

// BMA-OEI 1/11/06 removed default params

void main(string sCategoryTag, int nEntryID, int bAllPartyMembers, int bAllPlayers, int bAllowOverrideHigher)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

AddJournalQuestEntry(sCategoryTag, nEntryID, oPC, bAllPartyMembers, bAllPlayers, bAllowOverrideHigher);

}

// ga_jump(string sDestination, string sTarget, float fDelay)

/*

Jump an object to a waypoint or another object.

Parameters:

string sDestination = Tag of waypoint or object to jump to.

string sTarget = Tag of object to jump. Default is OWNER

float fDelay = Delay before JumpToObject()

*/

// TDE 3/9/05

// ChazM 3/11/05

// BMA 7/13/05 changed Delay/Assign to Assign/Delay

// BMA-OEI 1/11/06 removed default param

#include "ginc_param_const"

void main(string sDestination, string sTarget, float fDelay)

{

object oDestination = GetTarget(sDestination);

object oTarget = GetTarget(sTarget, TARGET_OWNER);

AssignCommand(oTarget, DelayCommand(fDelay, JumpToObject(oDestination)));

}

// ga_jump_faction(string sTagOfMember, string sTagOfWayPoint, int iFormation, string sFormationParams)

/*

Jump faction into formation at sTagOfWayPoint.

Parameters:

string sTagOfMember = Tag of member in faction to jump.

string sTagOfWayPoint = Tag of waypoint.

int iFormation = DOES NOTHING.

string sFormationParams = DOES NOTHING.

*/

// BMA 5/24/05

// ChazM 5/26/05

// ChazM 6/2/05 updated to work w/ new features

// BMA-OEI 1/11/06 removed default param, use default U7 formation

// ChazM 3/3/06 Added error message for when this is used in campaign on a PC to do an area transition

#include "ginc_param_const"

#include "ginc_group"

#include "ginc_transition"

void main(string sTagOfMember, string sTagOfWayPoint, int iFormation, string sFormationParams)

{

object oTarget = GetTarget(sTagOfMember, TARGET_OBJECT_SELF);

//float fRadius = StringToFloat(sFormationParams);

//if (fRadius <= 0.1f) fRadius = 10.0f;

string sGroupName = "tempGroup";

ResetGroup(sGroupName);

GroupAddFaction(sGroupName, oTarget, GROUP_LEADER_FIRST, TRUE);

GroupSetBMAFormation(sGroupName);

if (GetIsPC(oTarget) && (GetGlobalInt(VAR_GLOBAL_GATHER_PARTY)==1) && (GetArea(oTarget) != GetArea(GetWaypointByTag(sTagOfWayPoint))) )

{

PrettyError("Area transition of PC's made using ga_jump_faction in a campaign module. Please report this as an error.");

}

GroupMoveToWP(sGroupName, sTagOfWayPoint, MOVE_JUMP_INSTANT);

}

// ga_jump_party_in_formation

// CGaw 3/16/06

//

// Jumps entire party to a waypoint in the formation specified.

//

// string sWaypoint - the string of tag to jump the party to.

//

// int iFormationNum - the number that corresponds to the formation you want the party

// jumped in.

// 0 = BenMa Formation - creates a standard party group formation:

// 1

// 2 3

// 4 5 6

// 7 8

// 1 = Line Formation

// 2 = Half circle formation, facing outward

// 3 = Full circle formation, facing outward

// 4 = Rectangle formation

//

// float fFormationTightness - float value to determine how far apart each party member

// is from one another. Each formation type has a specified default value:

// 0 = 1.5f

// 1 = 1.5f

// 2 = 1.5f

// 3 = 1.5f

// 4 = 1.5f

//

// int bDisableNoise - determines whether noise for imperfect group formations should

// be applied.

// 0 = default noise values applied (DEFAULT VALUE)

// 1 = noise disabled

// Note: To ensure that the party group appears in the expected formation, each party

// member's associate state for "NW_ASC_MODE_STAND_GROUND" should be set to FALSE.

// The global script ga_party_freeze can also be used to accomplish this.

#include "ginc_group"

void main(string sWaypoint, int iFormationNum, float fFormationTightness, int bDisableNoise)

{

object oPC = GetFirstPC();

string sGroupName = "Party_Jump_Group";

ResetGroup(sGroupName);

GroupAddFaction(sGroupName, oPC, GROUP_LEADER_FIRST, TRUE);

if (fFormationTightness < 0.1)

{

fFormationTightness = 1.5f;

}

switch(iFormationNum)

{

case 0:

GroupSetBMAFormation(sGroupName, fFormationTightness);

break;

case 1:

GroupSetLineFormation(sGroupName, fFormationTightness);

break;

case 2:

GroupSetSemicircleFormation(sGroupName, FORMATION_SEMICIRCLE_FACE_OUT, fFormationTightness);

break;

case 3:

GroupSetCircleFormation(sGroupName, FORMATION_HUDDLE_FACE_OUT, fFormationTightness);

break;

case 4:

GroupSetRectangleFormation(sGroupName, fFormationTightness);

break;

default:

GroupSetBMAFormation(sGroupName, fFormationTightness);

break;

}

switch(bDisableNoise)

{

case 0:

GroupSetNoise(sGroupName, 0.0f, 10.0f, 0.5f);

break;

case 1:

break;

default:

GroupSetNoise(sGroupName, 0.0f, 10.0f, 0.5f);

break;

}

GroupJumpToWP(sGroupName, sWaypoint);

}

// ga_jump_players(string sDestTag, int bWholeParty, int bOnlyThisArea)

/*

Jumps the PC party to a waypoint or object.

Parameters:

string sDestTag = Tag of waypoint or object to jump to.

int bWholeParty = DOES NOTHING IN CAMPAIGN. If =0 then jump the PC only, else jump the PC's party.

int bOnlyThisArea = DOES NOTHING

*/

// ChazM 3/11/05

// BMA-OEI 1/11/06 removed default params

// EPF 2/6/06 -- fixed the loop in JumpParty to deal with multiple parties

// ChazM 3/3/06 - replaced JumpParty() w/ JumpPartyToArea() script command. Modified to always jump whole party in campaign.

#include "ginc_debug"

#include "ginc_transition"

// Jump oPC's whole party.

// oPartyMember - member of the party to jump

// oDestination - the destination (typically a waypoint object)

// bOnlyThisArea - Jump only members of the party in the same area as oPartyMember? Default is true

void JumpParty(object oPartyMember, object oDestination, int bOnlyThisArea)

{

object oThisArea = GetArea(oPartyMember);

object oJumper = GetFirstFactionMember(oPartyMember, FALSE);

if(GetIsPC(oJumper))

{

oJumper = GetNextFactionMember(oPartyMember, FALSE);

}

while (GetIsObjectValid(oJumper) == TRUE)

{

if (!bOnlyThisArea || (GetArea(oJumper) == oThisArea))

{

AssignCommand(oJumper, JumpToObject(oDestination));

}

oJumper = GetNextFactionMember(oPartyMember, FALSE);

}

oJumper = GetFirstFactionMember(oPartyMember, TRUE);

while (GetIsObjectValid(oJumper) == TRUE)

{

if (!bOnlyThisArea || (GetArea(oJumper) == oThisArea))

{

AssignCommand(oJumper, JumpToObject(oDestination));

}

oJumper = GetNextFactionMember(oPartyMember, TRUE);

}

}

void main(string sDestTag, int bWholeParty, int bOnlyThisArea)

{

object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());

object oDestination = GetObjectByTag(sDestTag);

if (bWholeParty == 0 && GetGlobalInt(VAR_GLOBAL_GATHER_PARTY)==0)

{

AssignCommand(oPC, JumpToObject(oDestination));

}

else

{

// BMA-OEI 6/14/06

SinglePartyTransition( oPC, oDestination );

//JumpPartyToArea(oPC, oDestination);

//JumpParty(oPC, oDestination, bOnlyThisArea);

}

}

// ga_load_mod

//

// Loads a module, including any data that may have been affected by the player during previous

// visits. (As opposed to ga_start_mod, which gives you a brand-new copy of the module.)

// sModule is the filename of the module, minus the .mod extension.

// sWaypoint is the tag of the waypoint from which the player will begin the module.

// If no waypoint is supplied, the module's default start location is used instead.

// EPF 1/16/06

// BMA-OEI 4/12/06 - replaced LNM() with SRLM()

#include "ginc_companion"

void main( string sModule, string sWaypoint )

{

SaveRosterLoadModule( sModule, sWaypoint );

}

// ga_local_float(string sVariable, string sChange, string sTarget

/*

This script changes a local float variable's value

Parameters:

string sVariable = Name of variable to change

string sChange = VALUE (EFFECT)

"5.1" (Set to 5.1)

"=-2.3" (Set to -2.3)

"+3.0" (Add 3.0)

"+" (Add 1.0)

"++" (Add 1.0)

"-4.9" (Subtract 4.9)

"-" (Subtract 1.0)

"--" (Subtract 1.0)

string sTarget = Target tag or identifier. If blank then use OBJECT_SELF

*/

// FAB 10/7

// BMA 4/15/05 added set operator, "=n"

// BMA 4/27/05 added GetTarget()

// BMA 7/19/05 added object invalid printstring

#include "ginc_param_const"

void main(string sVariable, string sChange, string sTarget)

{

float fChange;

object oTarg = GetTarget(sTarget, TARGET_OBJECT_SELF);

if (GetIsObjectValid(oTarg) == FALSE) PrintString("ga_local_string: " + sTarget + " is invalid");

if (GetStringLeft(sChange, 1) == "=")

{

sChange = GetStringRight(sChange, GetStringLength(sChange) - 1);

fChange = StringToFloat(sChange);

}

else if (GetStringLeft(sChange, 1) == "+")

{

// If sChange is just "+" then default to increment by 1

if (GetStringLength(sChange) == 1)

{

fChange = GetLocalFloat(oTarg, sVariable) + 1.0;

}

else // This means there's more than just "+"

{

if (GetSubString(sChange, 1, 1) == "+") // "++" condition

{

fChange = GetLocalFloat(oTarg, sVariable) + 1.0;

}

else

{

sChange = GetStringRight(sChange, GetStringLength(sChange) - 1);

fChange = GetLocalFloat(oTarg, sVariable) + StringToFloat(sChange);

}

}

}

else if (GetStringLeft(sChange, 1) == "-")

{

// If sChange is just "-" then default to increment by 1

if (GetStringLength(sChange) == 1)

{

fChange = GetLocalFloat(oTarg, sVariable) - 1.0;

}

else // This means there's more than just "-"

{

if (GetSubString(sChange, 1, 1) == "-") // "--" condition

{

fChange = GetLocalFloat(oTarg, sVariable) - 1.0;

}

else

{

sChange = GetStringRight(sChange, GetStringLength(sChange) - 1);

fChange = GetLocalFloat(oTarg, sVariable) - StringToFloat(sChange);

}

}

}

else

{

fChange = StringToFloat(sChange);

if (sChange == "") fChange = GetLocalFloat(oTarg, sVariable) + 1.0;

}

// Debug Message - comment or take care of in final

SetLocalFloat(oTarg, sVariable, fChange);

}

// ga_local_int(string sVariable, string sChange, string sTarget)

/*

This script changes a local int variable's value

Parameters:

string sVariable = Name of variable to change

string sChange = VALUE (EFFECT)

"5" (Set to 5)

"=-2" (Set to -2)

"+3" (Add 3)

"+" (Add 1)

"++" (Add 1)

"-4" (Subtract 4)

"-" (Subtract 1)

"--" (Subtract 1)

string sTarget = Target tag or identifier. If blank then use OBJECT_SELF

*/

// FAB 10/7

// BMA 4/15/05 added set operator, "=n"

// BMA 4/27/05 added GetTarget()

// ChazM 5/4/05 moved CalcNewIntValue() to "ginc_var_ops"

// BMA 7/19/05 added object invalid printstring

#include "ginc_param_const"

#include "ginc_var_ops"

void main(string sVariable, string sChange, string sTarget)

{

object oTarg = GetTarget(sTarget, TARGET_OBJECT_SELF);

if (GetIsObjectValid(oTarg) == FALSE)

PrintString("ga_local_int: " + sTarget + " is invalid");

int nOldValue = GetLocalInt(oTarg, sVariable);

int nNewValue = CalcNewIntValue(nOldValue, sChange);

SetLocalInt(oTarg, sVariable, nNewValue);

//PrintString(sTarget + "'s variable " + sVariable + " is now set to " + IntToString(nNewValue) );

}

// ga_local_string(string sVariable, string sValue, string sTarget)

/*

This script changes a Target's local string variable's value.

Parameters:

string sVariable = The name of the variable.

string sValue = The new value for the variable.

string sTarget = The target's tag or identifier, if blank use OWNER

*/

// FAB 10/4

// BMA 4/27/05 - added GetTarget()

// BMA 7/19/05 added object invalid printstring

// BMA-OEI 7/28/05 - added debug printstring

#include "ginc_param_const"

void main(string sVariable, string sValue, string sTarget)

{

object oTarget = GetTarget(sTarget, TARGET_OWNER);

PrintString("ga_local_string: Object '" + GetName(oTarget) + "' variable '" + sVariable + "' set to '" + sValue + "'");

SetLocalString(oTarget, sVariable, sValue);

}

//::///////////////////////////////////////////////////////////////////////////

//::

//:: ga_lock.nss

//::

//:: Change the lock status of a door. If bLock is false, the door will

//:: be unlocked.

//::

//::///////////////////////////////////////////////////////////////////////////

//::

//:: Created by: EPF

//:: Created on: 3/7/06

//::

//::///////////////////////////////////////////////////////////////////////////

#include "ginc_param_const"

void main(string sDoorTag, int bLock)

{

object oDoor = GetTarget(sDoorTag);

SetLocked(oDoor, bLock);

}

//ga_mapnote

// Turns on and off map notes on the mini-map.

// sTag - Tag of the mapnote to turn on or off

// bActive - TRUE(1) will turn the map note on, making it visible to the player

// FALSE(0) will turn off the map note, making it invisible to the player

#include "ginc_param_const"

void main(string sTag, int bActive)

{

SetMapPinEnabled(GetTarget(sTag),bActive);

}

// ga_move

/*

This moves someone to a waypoint.

sWP = Lists the waypoint the object is moving to.

nRun = Defaults to walk, set to 1 for running

sTagOverride = If this is null, then OWNER runs the script. Otherwise the string is the

tag name of who will run it

*/

// FAB 10/5

// ChazM 6/22/05 - changed to GetTarget()

// ChazM 9/9/05 - modifed waypoint look up to also look for sWP w/o prepending "wp_"

#include "ginc_param_const"

void main(string sWP, int nRun, string sTagOverride)

{

object oTarg = OBJECT_SELF;

object oWP = GetObjectByTag( "wp_" + sWP );

if (!GetIsObjectValid(oWP))

oWP = GetObjectByTag(sWP );

if (!GetIsObjectValid(oWP))

{

PrintString("WARNING - ga_move: couldn't find waypoint: " + sWP);

return;

}

if ( sTagOverride != "" )

oTarg = GetTarget(sTagOverride);

AssignCommand(oTarg, ActionForceMoveToObject(oWP, nRun));

}

// ga_move_exit

/*

This makes the object go to the exit (default nwc_exit) and then vanish

nExitNumber = nwc_exit#N

nRun = TRUE if you want the character to run there

sWaypoint = go to waypoint nwc_#S then disappear

sObject = if you don't want the OWNER to move, use the tag string here

*/

// FAB 9/29

// ChazM 6/29/06 - rewrote to use ForceExit() without changing functionality.

#include "ginc_misc"

string GetExitWaypoint(int nExitNumber, string sWaypoint)

{

string sWPTag;

// No other parameters on the exit are set

if ( nExitNumber == 0 && sWaypoint == "")

{

sWPTag = "nwc_exit";

}

// An exit number is set

else if ( sWaypoint == "")

{

sWPTag = "nwc_exit" + IntToString(nExitNumber);

}

// An exit string is set

else

{

sWPTag = "nwc_" + sWaypoint;

}

return (sWPTag);

}

void main(int nExitNumber, int nRun, string sWaypoint, string sObject)

{

string sWPTag = GetExitWaypoint(nExitNumber, sWaypoint);

object oWP = GetWaypointByTag(sWPTag);

PrettyDebug(" Name of generic exit: " + GetName(oWP));

ForceExit(sObject, sWPTag, nRun);

/*

if ( sObject == "" )

{

// No other parameters on the exit are set

if ( nExitNumber == 0 && sWaypoint == "")

{

ActionForceMoveToObject(oWP,nRun );

}

// An exit number is set

else if ( sWaypoint == "")

{

ActionForceMoveToObject( GetWaypointByTag("nwc_exit" + IntToString(nExitNumber)),nRun );

}

// An exit string is set

else

{

ActionForceMoveToObject( GetWaypointByTag("nwc_" + sWaypoint),nRun );

}

// Now queue up the actions for after they move

ActionDoCommand( SetCommandable(TRUE) );

ActionDoCommand( DestroyObject(OBJECT_SELF) );

SetCommandable( FALSE );

}

else

{

// This is who is going to be executing the command besides the OWNER

object oTarg = GetObjectByTag( sObject );

int iCommandable = GetCommandable(oTarg);

PrettyDebug(GetName(oTarg) + " commandable state is " + IntToString(iCommandable));

AssignCommand( oTarg, SetCommandable( TRUE ) );

PrettyDebug(GetName(oTarg) + " is Target of MoveExit");

// No other parameters on the exit are set

if ( nExitNumber == 0 && sWaypoint == "")

{

PrettyDebug(" Using generic exit of " + GetName(oWP));

AssignCommand( oTarg, ActionForceMoveToObject( oWP,nRun ) );

}

// An exit number is set

else if ( sWaypoint == "")

{

AssignCommand( oTarg, ActionForceMoveToObject( GetWaypointByTag("nwc_exit" + IntToString(nExitNumber)),nRun ) );

}

// An exit string is set

else

{`

AssignCommand( oTarg, ActionForceMoveToObject( GetWaypointByTag("nwc_" + sWaypoint),nRun ) );

}

// Now queue up the actions for after they move

AssignCommand( oTarg, ActionDoCommand( SetCommandable(TRUE) ) );

AssignCommand( oTarg, ActionDoCommand( DestroyObject(OBJECT_SELF) ) );

AssignCommand( oTarg, SetCommandable( FALSE ) );

}

*/

}

// ga_music_play

/*

Play battle music in current area

*/

// EPF 8/23/06

void main()

{

object oPC = GetPCSpeaker();

if(!GetIsObjectValid(oPC))

{

oPC = OBJECT_SELF;

}

object oArea = GetArea(oPC);

MusicBattlePlay(oArea);

}

// ga_music_battle_restore

/*

Restore background music in current area. Restore with ga_music_restore.

*/

// EPF 8/23/06

#include "ginc_sound"

void main()

{

object oPC = GetPCSpeaker();

if(!GetIsObjectValid(oPC))

{

oPC = OBJECT_SELF

Recommended