View Single Post
Old 06-15-2012, 12:24 AM   #199
Fallen Guardian
@Fallen Guardian
Wandering the Galaxy...
Fallen Guardian's Avatar
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,294
Current Game: XCOM 2
Veteran Modder  Helpful! 
Originally Posted by JCarter426 View Post
Not sure what you want for the perception event... I think if you want to make something happen when an object perceives something, you have to modify its OnPerception script. Also, what you described will never trigger #3. Here it is anyway though, minus the perception stuff:

void main() {

object oPC = GetFirstPC();
int nLocal = #;
string sGlobal = "****"
string sScript1 = "****1"
string sScript2 = "****2"
string sScript3 = "****3"

if( !GetLocalBoolean(OBJECT_SELF, nLocal) ){

	if( GetDistanceBetween(OBJECT_SELF, oPC) <= 7.0 ) {
		ExecuteScript(sScript1, OBJECT_SELF, -1);

	else if( GetGlobalBoolean(string sGlobal) ){
		if( GetDistanceBetween(OBJECT_SELF, oPC) <= 10.0 ) {
			ExecuteScript(sScript3, OBJECT_SELF, -1);
		else if ( GetDistanceBetween(OBJECT_SELF, oPC) <= 5.0 ){
			ExecuteScript(sScript2, OBJECT_SELF, -1);



Thanks JC. The reason I want the perception event is because this is a userdefined script for an NPC. Just out of curiosity, why wouldn't the 3rd condition ever be met?

The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

Current Work in Progress: Dantooine Tension

Released Works
Blaster Pistol Enhancement
Dustil Restoration
Ebon Hawk Texture Enhancement
Gaffi Stick Improvement
Weapon Model Overhaul Texture Rework (Thanks to Toasty Fresh!)
Sunry Murder Recording Enhancement
VP's Hi Poly Tin Cans - KotOR 1 Version
Fallen Guardian is offline   you may: quote & reply,