Finished PRC8 integration. Moved creature abilities to top hak. Setup tooling. Created release archive
187 lines
4.1 KiB
Plaintext
187 lines
4.1 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Custom User Defined Event
|
|
//:: FileName
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By:
|
|
//:: Created On:
|
|
//:://////////////////////////////////////////////
|
|
|
|
void main()
|
|
{
|
|
ExecuteScript("prc_npc_userdef", OBJECT_SELF);
|
|
|
|
int nUser = GetUserDefinedEventNumber();
|
|
|
|
if(nUser == 50) //boulder smash
|
|
|
|
{
|
|
|
|
object oObject;
|
|
effect eEffect;
|
|
int nReflex;
|
|
int nDexbonus;
|
|
int nD20;
|
|
object oShiny =GetObjectByTag("jw_ore_boulder_wp");
|
|
location bLoc=GetLocation(oShiny);
|
|
int nCounter;
|
|
int nDone=0;
|
|
object oBoulder;
|
|
int nIdx;
|
|
int nAgain;
|
|
|
|
for (nAgain=1;nAgain<=2;nAgain++)
|
|
|
|
{
|
|
|
|
// say a rockfall has been triggered.
|
|
|
|
|
|
PlaySound("as_na_rockfallg2");
|
|
|
|
|
|
// get the radius and DC of the trap.
|
|
float fSearchDist = 12.0;
|
|
int nDiffaculty = 18;
|
|
|
|
|
|
|
|
// Find the best creature within the trap radius
|
|
int nCount = 1;
|
|
object oidNearestCreature = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
|
|
|
|
while ( ( nDone == 0 ) &&
|
|
( oidNearestCreature != OBJECT_INVALID )
|
|
)
|
|
|
|
// start the while loop
|
|
{
|
|
// what is the distance of the PC to the trap location
|
|
float fDist = GetDistanceBetween(OBJECT_SELF,oidNearestCreature);
|
|
|
|
|
|
|
|
// if the player is in range, then make the saving throw
|
|
|
|
if ( fDist <= fSearchDist )
|
|
{
|
|
int nReflex = ReflexSave(oidNearestCreature,nDiffaculty,SAVING_THROW_TYPE_NONE);
|
|
// false if failed, true if succeeded
|
|
|
|
// If succeeded:
|
|
|
|
|
|
|
|
if (nReflex)
|
|
|
|
{
|
|
SendMessageToPC(oidNearestCreature,"Reflex throw success: you dodge the falling rock");
|
|
FloatingTextStringOnCreature("**Dodges**",oidNearestCreature);
|
|
oBoulder= CreateObject(OBJECT_TYPE_PLACEABLE,"jw_smash_boulder",GetLocation(oidNearestCreature));
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDeath(TRUE),oBoulder,3.0);
|
|
}
|
|
|
|
//but if fail:
|
|
|
|
else
|
|
|
|
{
|
|
SendMessageToPC(oidNearestCreature,"Reflex throw failure: you are hit by the falling rocks");
|
|
FloatingTextStringOnCreature("**Smash**",oidNearestCreature);
|
|
//make a rock fall on their head
|
|
|
|
oBoulder= CreateObject(OBJECT_TYPE_PLACEABLE,"jw_smash_boulder",GetLocation(oidNearestCreature));
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDeath(TRUE),oBoulder,3.0);
|
|
//DestroyObject(oBoulder);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(d6(7)+20,DAMAGE_TYPE_BLUDGEONING,DAMAGE_POWER_PLUS_ONE),oidNearestCreature);
|
|
|
|
//end the else statement
|
|
}
|
|
|
|
//end the if the player is in range sequence
|
|
}
|
|
|
|
//if the player was too far way, stop everything now
|
|
|
|
if ( fDist > fSearchDist )
|
|
|
|
{
|
|
nDone = 1;
|
|
}
|
|
|
|
nCount++;
|
|
oidNearestCreature = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, OBJECT_SELF ,nCount);
|
|
|
|
//end the while loop
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (nIdx=1;nIdx<=5;nIdx++)
|
|
|
|
{
|
|
object oObject=GetNearestObjectByTag("jw_ore_boulderfx_wp",OBJECT_SELF,nIdx);
|
|
oBoulder= CreateObject(OBJECT_TYPE_PLACEABLE,"jw_smash_boulder",GetLocation(oObject));
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDeath(TRUE),oBoulder,3.0);
|
|
}
|
|
|
|
|
|
/// do it again
|
|
|
|
ActionWait(2.0);
|
|
|
|
}
|
|
|
|
// create the ore
|
|
SpeakString("The ceiling begins to shake. Rockfall!");
|
|
object oOre=CreateObject(OBJECT_TYPE_ITEM,"jw_bright_ore",bLoc);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(VFX_DUR_LIGHT_WHITE_15),oOre);
|
|
|
|
// end the whole thing
|
|
}
|
|
|
|
|
|
|
|
else if(nUser == 1001) //HEARTBEAT
|
|
{
|
|
|
|
}
|
|
else if(nUser == 1002) // PERCEIVE
|
|
{
|
|
|
|
}
|
|
else if(nUser == 1003) // END OF COMBAT
|
|
{
|
|
|
|
}
|
|
else if(nUser == 1004) // ON DIALOGUE
|
|
{
|
|
|
|
}
|
|
else if(nUser == 1005) // ATTACKED
|
|
{
|
|
|
|
}
|
|
else if(nUser == 1006) // DAMAGED
|
|
{
|
|
|
|
}
|
|
else if(nUser == 1007) // DEATH
|
|
{
|
|
|
|
}
|
|
else if(nUser == 1008) // DISTURBED
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|