mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
89 lines
2.0 KiB
Plaintext
89 lines
2.0 KiB
Plaintext
/*
|
|
speaktest.script
|
|
*/
|
|
|
|
//------------------------------------------------
|
|
// Includes
|
|
//------------------------------------------------
|
|
|
|
include library.utils;
|
|
include library.ai_lib;
|
|
include library.xp;
|
|
include library.factions;
|
|
include library.dot;
|
|
include library.city;
|
|
include library.loot;
|
|
include library.player_structure;
|
|
include library.player_stomach;
|
|
include library.space_quest;
|
|
include library.space_create;
|
|
include library.movement;
|
|
|
|
//------------------------------------------------
|
|
// Constants
|
|
//------------------------------------------------
|
|
|
|
double randBell( double avg, double var )
|
|
{
|
|
var = var/2;
|
|
double r, v1, v2;
|
|
do
|
|
{
|
|
v1 = 2.0 * rand() - 1.0;
|
|
v2 = 2.0 * rand() - 1.0;
|
|
r = v1*v1 + v2*v2;
|
|
}
|
|
while ( r>=1.0 || r==0.0 );
|
|
|
|
double fac = Math.sqrt( -2.0 * Math.log(r) / r );
|
|
double value = (avg + (v1*fac)*(avg*var));
|
|
if ( value < 0 )
|
|
return 0;
|
|
else
|
|
return value;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// OnSpeaking
|
|
//------------------------------------------------
|
|
|
|
trigger OnSpeaking( string text )
|
|
{
|
|
// Get the location of the player?
|
|
location playerLocation = getLocation( self );
|
|
|
|
if ( text == "meganuke" )
|
|
{
|
|
obj_id[] objects = getObjectsInRange( playerLocation, 250.0f );
|
|
for ( int i = 0; i < objects.length; i++ )
|
|
{
|
|
if ( !isPlayer(objects[i]) )
|
|
{
|
|
LOG( "LOG_CHANNEL", "object deleted ->" + objects[i] );
|
|
destroyObject( objects[i] );
|
|
}
|
|
}
|
|
}
|
|
else if ( text == "test" )
|
|
{
|
|
obj_id t = getLookAtTarget( self );
|
|
setCraftedId( t, self );
|
|
}
|
|
else if ( text == "blindme" )
|
|
{
|
|
setState( self, STATE_BLINDED, true );
|
|
setObjVar( self, "combat.intEffects.13", 1 );
|
|
// obj_id t = getLookAtTarget( self );
|
|
// sendSystemMessageTestingOnly( self, "Dist to Target: " + getDistance( self, t ) );
|
|
}
|
|
else if ( text == "poisonme" )
|
|
{
|
|
sendSystemMessageTestingOnly( self, "poisoning" );
|
|
dot.applyDotEffect( self, self, "poison", "poison1", HEALTH, -1, 5, 60, true, null );
|
|
|
|
// movement.removeMovementModifier( self, "cryobanSnare" );
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|