View Single Post
Old 01-12-2012, 07:27 PM   #53
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,628
Quote:
Originally Posted by Qui-Gon Glenn View Post
Anyways, when I was needing to RemoveEffect(xxx) from a certain NPC, I needed to find the specific effect. I found it quite frustrating that there was no way to directly "get" the value - rather I had to use a loop and use GetCurrentEffect and compare that to my desired value, else GetNextEffect rinse'n'repeat.... It got the job done but it was IMO less than ideal.
Aye, I've been there myself. K2, however, does have a specific function for that. They created it for Mandalore's implant switching; the other day I successfully used to to create a permanent Force Sight and then remove it. Let me dig it up...
Code:
void ForceSight() {

if( GetLocalBoolean(OBJECT_SELF, 54) ){
	ApplyEffectToObject(2, EffectForceSight(), OBJECT_SELF, 0.0);
	}

}

void deactivate() {

SetLocalBoolean(OBJECT_SELF, 54, FALSE);
RemoveEffectByExactMatch(OBJECT_SELF, EffectForceSight());

}

void main() {

if( !GetLocalBoolean(OBJECT_SELF, 54) ){
	SetLocalBoolean(OBJECT_SELF, 54, TRUE);
	AssignCommand(OBJECT_SELF, ForceSight());
	}

else	deactivate();

}
So basically, if you define an effect, you can remove it later in the same script. This allowed me to have the Force sigh effect carry from module to module (rather than have it at an appalling 45 seconds) and I could still deactivate it with ease.

But I have NO idea how to do it in K1, apart from the way you described... tedious but effective. Judging by what's left in nwscript, I think Neverwinter Nights had all its effects defined, with functions that can get and remove them quite easily. But of course the KOTOR effects aren't defined properly.

Speaking of effects, I've tried out a couple left over NWN ones, some of them still work. Time Stop is quite hilarious. It freezes everything in the game, and I mean everything. I might play around with it at some point, because it would be pretty cool if it worked properly.

Quote:
My confusion I now recognize as one of those moments... NPC_INTEGER, where INTEGER is a placeholder for the actual data, eg MISSION or ATTON. I musta drank about 15 Dr. Peppers....
Oh, I see. Sorry about that. But as I said, I prefer the numbers anyway. That's probably just because I love script parameters, though.


JCarter426 is offline   you may: quote & reply,