Jump to content

Home

Qui-Gon's Script Shack


Qui-Gon Glenn

Recommended Posts

I imagine it might. I haven't tested everything, exactly. Yeah, I do test a lot of things that supposedly aren't possible, just to see what exactly is wrong with them and why. But I haven't with this, not completely. According to nwscript.nss you should be able to have three classes, but that might be left over notes from Neverwinter Nights. When I did test some stuff, a third class caused the game to crash or it replaced the second class (I think only in the case where I hasn't leveled up yet, so it didn't really exist yet).

Link to comment
Share on other sites

  • Replies 352
  • Created
  • Last Reply
I used these for a script that switches the active PC to a party member. I needed to get the integer of the current PC and store it, check if who I'm turning into is available, make sure the two aren't the same, remove who I'm switching to from the party if present so the game doesn't CRASH, add the other party members back into the party (with the integer), and various other things - and give different error messages depending on the situation. Took me days to sort out all the possibilities.
Most interesting... The reason why I wondered this is because at the beginning of my SERIOUS :carms: scripting adventures, something you actually helped me with once upon a time, and sadly most of the thread was lost to a website database issue. 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.

 

My confusion I now recognize as one of those :ugh: moments... NPC_INTEGER, where INTEGER is a placeholder for the actual data, eg MISSION or ATTON. I musta drank about 15 Dr. Peppers....

Link to comment
Share on other sites

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...

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.

 

My confusion I now recognize as one of those :ugh: 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. :D But as I said, I prefer the numbers anyway. That's probably just because I love script parameters, though.

Link to comment
Share on other sites

Well... Now it is time for me to hijack my own thread!

 

I am having an issue with my OnEnter script for the Endar Spire in the hopefully to-be-released FFK1 by jonathan7 and co.... It is probably my stupid work that is holding up the release :(

 

My original version of the OnEnter worked fine... Because it had less going on, or because I did something wrong with my .utc's... Either way, I think that I need to go in a different direction in how I achieve what we want for the mod - specifically either modifying directly the original vanilla OnEnter so that script injection is removed from the equation, or move the script to Trask's dialog...

 

Has anyone ever decompiled successfully the (edit!) k_pend_1b_area.ncs? DeNCS fails as I am sure there are many include files....

 

Essentially, I have a cluster of bad guys to spawn in, and then separately their leader. They spawn in invisible and then "uncloak" and attack when they perceive the PC. The leader is a little more complex, with a talk-fight sequence. Also, according to PC class, several items are being added to either a new footlocker or the existing one... I was having difficulty getting my new one to appear.

 

I will post the code I was working with... it compiles, doesn't crash the game, but nothing works properly anymore - the main sequence with the leader has somehow been broken by the new enemies and footlocker I was spawning.

 

void main()
{
  [color=darkorange]// Declarations[/color]

  object oPC = GetFirstPC();
  object oStalker = GetObjectByTag("qg_sithstalker");
  object oAssassin1 = GetObjectByTag("ff_assnleadr");
  object oAssassin2 = GetObjectByTag("ff_assassin2");
  object oAssassin3 = GetObjectByTag("ff_assassin3");
  object oContainer = CreateObject( OBJECT_TYPE_PLACEABLE, "ffk1lker001", Location(Vector(20.34,16.75,-1.08), 0.0));

  effect eI1 = EffectInvisibility(INVISIBILITY_TYPE_NORMAL);
  effect eI2 = EffectVisualEffect(8000);
  effect eInvis = EffectLinkEffects(eI1, eI2);

  int iClass = GetClassByPosition(1,oPC);

  [color=darkorange]// Functional Code[/color]

  switch (iClass) 
  {
     case 0:
        CreateItemOnObject("soldier",oContainer,1);
        CreateItemOnObject("g_w_vibrosword04", oContainer,1);
        CreateItemOnObject("g_i_gauntlet08", oContainer,1);
        break;  
     case 1:
        CreateItemOnObject("scout",oContainer,1);
        CreateItemOnObject("g_i_belt009", oContainer,1);
        CreateItemOnObject("g_w_blstrpstl004", oContainer,1);          
        break;
     case 2:
        CreateItemOnObject("scoundrel",oContainer,1);
        CreateItemOnObject("g_i_gauntlet09", oContainer,1);
        CreateItemOnObject("g_i_mask20", oContainer,1);
        break;
  }

  CreateItemOnObject("g_i_upgrade003", oContainer,1); 
  CreateItemOnObject("g_i_upgrade005", oContainer,1);

  if  (!GetIsObjectValid(GetObjectByTag(oStalker)))
  {
     CreateObject(OBJECT_TYPE_CREATURE, oStalker, Location(Vector(76.90,84.12,0.00), 0.0));
     CreateObject(OBJECT_TYPE_CREATURE, OAssassin1, Location(Vector(29.10,97.91,-0.52), 0.0));
     CreateObject(OBJECT_TYPE_CREATURE, OAssassin2, Location(Vector(31.10,102.25,-0.23), 0.0));
     CreateObject(OBJECT_TYPE_CREATURE, OAssassin3, Location(Vector(27.62,102.25,-0.21), 0.0));
     ApplyEffectToObject(3, eInvis, oStalker, -1.0);
     ApplyEffectToObject(3, eInvis, oAssassin1, -1.0);
     ApplyEffectToObject(3, eInvis, oAssassin2, -1.0);
     ApplyEffectToObject(3, eInvis, oAssassin3, -1.0);
  }

  [color=darkorange]// Script Injection[/color] 

  ExecuteScript("qg_pnd_1b_area", OBJECT_SELF);
}

 

As said, this code compiles fine, and the game tries to work it out, EPIC FAIL. Any glaring issues you see? Especially, why isn't the footlocker spawning?

Link to comment
Share on other sites

A few things...

 

1. The script decompiled for me just fine.

2. Isn't Trask dead when you get to that area?

3. What exactly isn't working, and what is? I can see a few things that in my experience have a 50% chance of working, but if they're working then any advice wouldn't be helpful. :p

4. Why's it necessary to have an "if oStalker isn't valid"? If you're doing everything with the OnEnter script, he should never be valid, right?

5. "qg_pnd_1b_area" - is that a typo?

Link to comment
Share on other sites

1. Huh? Whoa. Derp. Hmm... I will pm you, perhaps chat over at the Hssiss or something. I did make a typo though, in that last post it should be k_pnd_1b_area.ncs that I cannot decompile. Not sure if there is a script named k_pnd_1b.ncs

2. He is no longer in your party.... Do we really know if he dies there ;)

Everything could be spawned in and done by the end of your first conversation with him, I think, if it were to be injected into the dialog script spots.

3. The Stalker and 2 assassins spawn in. None of them spawn in correctly except for oddly one assassin, but their spawn in is unreliable. The Stalker spawns in the correct location but is no longer invisible when the encounter should occur. There is no footlocker at all, of course that could simply be an orientation issue, although I have played with it to no avail.

4. Correct. A vestige from when I thought I might do the script differently, via a dialog or other means. This script has been re-written extensively. It can be removed :)

5. No.... I had the audacity to rename Bioware's vanilla script with my tag. It could be old_k_pnd 1b_area.ncs, or diggitydo.ncs.

Link to comment
Share on other sites

1. Huh? Whoa. Derp. Hmm... I will pm you, perhaps chat over at the Hssiss or something. I did make a typo though, in that last post it should be k_pnd_1b_area.ncs that I cannot decompile. Not sure if there is a script named k_pnd_1b.ncs

You... you did it again.

No.... I had the audacity to rename Bioware's vanilla script with my tag. It could be old_k_pnd 1b_area.ncs, or diggitydo.ncs.

You did it again! :xp:

 

But that's all I meant, it's k_pend_1b_area... make sure you're being consistent.

He is no longer in your party.... Do we really know if he dies there ;)

Everything could be spawned in and done by the end of your first conversation with him, I think, if it were to be injected into the dialog script spots.

Yeah but... it's a different module. If you did want to use the dialogues, you'd need Carth, since he's the only one who ever says anything there.

The Stalker and 2 assassins spawn in. None of them spawn in correctly except for oddly one assassin, but their spawn in is unreliable. The Stalker spawns in the correct location but is no longer invisible when the encounter should occur. There is no footlocker at all, of course that could simply be an orientation issue, although I have played with it to no avail.

Ok, now, no guarantees here. I have no idea why any of these things should be so, but I've observed them to be true.

 

First, vectors sometimes just don't work. But in cases where they don't, waypoints usually do. My best guess is that it has to do with how much of the area is actually loaded at any given time - waypoints are spawned in when the module is loaded, so they always exist no matter what. So even if your coordinates are correct - check that first, obviously - it might not spawn anything because it doesn't register the vector as being valid. So you might have to do it another way. That doesn't mean you have to edit the module, though - there might be waypoints nearby you can use, and even if that fails, vectors might work in combination with the position of an existing object... and if that fails, you might be able to tell the NPCs to move to a better position once they are spawned... the footlocker, not so much. :xp:

 

Second, in a script with a switch, the game sometimes fails to assign commands to an object that was spawned in the same script. Honestly, I've changed switches to ifs in the past, absolutely nothing else, and everything worked perfectly.

 

Again, no guarantees. :p I have no reason why either of these is the way it is, but it does seem to be the way it is.

Link to comment
Share on other sites

Well, recruiting an NPC is pretty simple. Assuming you have your basic talk to NPC and then recruit them, it should go something like this:

void main() {

object oNPC = GetObjectByTag("NPC_tag", 0);
int iNPC = NPC_INTEGER;

AddAvailableNPCByObject(iNPC, oNPC);
SetNPCSelectability(iNPC, 1);

}

 

I believe you're supposed to keep the NPC tag as the tag of whoever you're replacing. So you'll have to check the original NPC for that. The NPC integers are as follows (you can paste this right into your script if you need it for reference, it won't do anything):

/*
KOTOR
int NPC_BASTILA         = 0;
int NPC_CANDEROUS       = 1;
int NPC_CARTH           = 2;
int NPC_HK_47           = 3;
int NPC_JOLEE           = 4;
int NPC_JUHANI          = 5;
int NPC_MISSION         = 6;
int NPC_T3_M4           = 7;
int NPC_ZAALBAR         = 8;
*/

/*
KOTOR 2
int NPC_ATTON           = 0;
int NPC_BAO_DUR         = 1;
int NPC_CANDEROUS       = 2;
int NPC_G0T0            = 3;
int NPC_HANDMAIDEN      = 4;
int NPC_HK_47           = 5;
int NPC_KREIA           = 6;
int NPC_MIRA            = 7;
int NPC_T3_M4           = 8;
int NPC_VISAS           = 9;
int NPC_HANHARR          = 10;
int NPC_DISCIPLE        = 11;
*/

 

You can use either the integer or the name (exactly as it appears) - depending of course on who you're replacing. You also might want to add the following, which will bring up the party selection screen and force the player to pick your new NPC:

ShowPartySelectionGUI("", iNPC, -1);

The "" is the name of a script to fire upon exiting, so put something in there (in the quotes) if you want to fire another script (such as a dialogue). Change the -1 to another NPC integer if you want another forced NPC. But if you're going to do this, you have to make sure the module is set to unescapable, or else fire the following as well:

SetAreaUnescapable(1);

...which will prevent you from changing party members, no matter what the area. Then once this is over, fire:

SetAreaUnescapable(0);

...which will let you change party members again. This function only affects a single module for as long as you're in it and is undone if you enter a new module, so if you're dealing with more than one you'll have to trigger it each time you enter a module - I believe this only ever happens in K2, and they do it by setting a global and then having all the modules' OnEnter scripts check that global.

 

So here's an example with everything, replacing Mission (because I think she's useless :xp: but feel free to change it):

void main() {

//Define everything
object oPC = GetFirstPC();
[color="Red"]object oNPC = GetObjectByTag("mission", 0);[/color]
int iNPC = NPC_MISSION;
int iClass = CLASS_TYPE_JEDISENTINEL;

//Recruit the NPC
AddAvailableNPCByObject(iNPC, oNPC);
[color="Red"]SetNPCSelectability(iNPC, 1);
[/color]
//Multiclass to Jedi Sentinel and give items
AddMutliClass(iClass, oPC);
CreateItemOnObject("g_a_jedirobe01", oPC);
CreateItemOnObject("g_w_shortsbr01", oPC);

//Bring up the party selection GUI, force the new NPC, and prevent any further changes
SetAreaUnescapable(1);
ShowPartySelectionGUI("", iNPC, -1);

}

 

Ok, looking through this, shouldn't I insert a 6 somewhere there?

Link to comment
Share on other sites

What you're looking for is CutsceneAttack. It's supposed to let you have complete control over the animations, attack result, and damage for each round. I have never actually managed to get it to work, but then again it's been some time since I last tried it and I've learned a lot since then. I really should try it again, but I'm busy/lazy. Anyway, here's the source code for it:

// 503: CutsceneAttack
// This function allows the designer to specify exactly what's going to happen in a combat round
// There are no guarentees made that the animation specified here will be correct - only that it will be played,
// so it is up to the designer to ensure that they have selected the right animation
// It relies upon constants specified above for the attack result
void CutsceneAttack(object oTarget, int nAnimation, int nAttackResult, int nDamage);

Here are the attack results:

int ATTACK_RESULT_INVALID               = 0;
int ATTACK_RESULT_HIT_SUCCESSFUL        = 1;
int ATTACK_RESULT_CRITICAL_HIT          = 2;
int ATTACK_RESULT_AUTOMATIC_HIT         = 3;

And the animations are in animations.2da. combatanimations.2da explains which animations go with which, in case you need it. And I'm not sure if you have to add 10000 to the animation number like you must with ActionPlayAnimation. I don't believe you do, though.

 

And if you want Force powers, those functions are right above CutsceneAttack in nwscript.

Link to comment
Share on other sites

This is a good question, that I cannot answer fully, although I think I have a few ideas. JCarter426 is around here a bit lately, so hopefully he can fill in the gaps and give a real explanation.

 

I would think that there is a number in combatanimations.2da that corresponds to the power blast, and any other combat animation, right?

 

What number that is.... that is the difficult part. Is there a way to determine what animation actually is the power blast? Has someone already done this for us?

 

EDIT: :lol: Thanks JCarter426 :D

Link to comment
Share on other sites

What you're looking for is CutsceneAttack. It's supposed to let you have complete control over the animations, attack result, and damage for each round. I have never actually managed to get it to work, but then again it's been some time since I last tried it and I've learned a lot since then. I really should try it again, but I'm busy/lazy. Anyway, here's the source code for it:

// 503: CutsceneAttack
// This function allows the designer to specify exactly what's going to happen in a combat round
// There are no guarentees made that the animation specified here will be correct - only that it will be played,
// so it is up to the designer to ensure that they have selected the right animation
// It relies upon constants specified above for the attack result
void CutsceneAttack(object oTarget, int nAnimation, int nAttackResult, int nDamage);

Here are the attack results:

int ATTACK_RESULT_INVALID               = 0;
int ATTACK_RESULT_HIT_SUCCESSFUL        = 1;
int ATTACK_RESULT_CRITICAL_HIT          = 2;
int ATTACK_RESULT_AUTOMATIC_HIT         = 3;

And the animations are in animations.2da. combatanimations.2da explains which animations go with which, in case you need it. And I'm not sure if you have to add 10000 to the animation number like you must with ActionPlayAnimation. I don't believe you do, though.

 

And if you want Force powers, those functions are right above CutsceneAttack in nwscript.

 

This is a good question, that I cannot answer fully, although I think I have a few ideas. JCarter426 is around here a bit lately, so hopefully he can fill in the gaps and give a real explanation.

 

I would think that there is a number in combatanimations.2da that corresponds to the power blast, and any other combat animation, right?

 

What number that is.... that is the difficult part. Is there a way to determine what animation actually is the power blast? Has someone already done this for us?

 

EDIT: :lol: Thanks JCarter426 :D

 

Thanks both of you.

Link to comment
Share on other sites

And if you want Force powers, those functions are right above CutsceneAttack in nwscript.

Yes they are! Here is a simple way I have used to implement them in a dialog, from a node script slot... this way you can control the reaction of the NPC who is "choked" or "power blasted"...

void main()
{
  object oPC=GetFirstPC();

  ActionCastFakeSpellAtObject(FORCE_POWER_CHOKE, oPC);
}

Link to comment
Share on other sites

I'm always around... even when you can't see me. :xp:

 

As I said, the combat animations are in fact in the regular old animations.2da; combatanimations.2da is more like a seating arrangement. It lists all the attacks and then states which animation goes with it - hit, parry, dodge, and so on. It's entirely numbers so it can be a mess. animations.2da gives you more of a clue, but the naming scheme can seem a bit weird at first glance. The animation name is an alphanumeric code with four parts, alternating letters and numbers.

 

The first part corresponds to the attack type - a generic attack, a feat, or a monster attack. There also seems to be some attempt to divide it into ranged and melee, but I can't discern it entirely.

b - ranged
c- melee
f - feat
g - generic
m - monster

Next, it's divided into weapon type as well as whether the character wielding one or two. These are given abbreviations for K2 only.

0 - N/A - droid
1 - SB - stun baton
2 - SS - single saber
3 - 2HS - two-handed saber (double-bladed)
4 - DS - dual sabers
5 - SB - single blaster
6 - DB - dual blasters
7 - RF - rifle
8 - NT - natural attack (unarmed, I believe)
9 - HC - heavy carbine
10 - UC - unarmed, complex (K2 only)
11 - N/A - wrist launcher (K2 only)

Next, what the character is doing.

a - attack
d - damage
f - appears unused
g - dodge
n - deflection
p - parry
r - ready
w - wield

And finally, another number. In most cases this is simply a variation number; some in K2 have an additional letter, for even more variation.

 

So, for example, if you want a character wielding a blaster rifle to dodge, the animation would be g7g1.

g: generic
7: rifle
g: dodge
1: variation (in this case there's only one)

 

Now, Mr Guardian, you asked about power blast. This is where it gets complicated.

 

Some of these variables are limited by other variables. Parry, for instance, is only a melee occurrence. I believe this is the reason for the distinction between ranged and melee that I mentioned above. Let's look at the first part again.

1:b - ranged
1:c - melee, complex
1:f - melee, feats
1:m - melee, monster
1:g - both, generic

And now let's look at the third part.

3:a - both, attack
3:d - both, damage
3:g - ranged, dodge
3:n - melee, deflection
3:p - melee, parry

(Putting this in code because of the :p emoticon.)

1:b is used for [i]all[/i] blaster attack animations.
1:c covers complex melee animations such as parries and clashes.
1:f is reserved for melee feats - critical strike, flurry, and power attack, as well as Force Jump.
1:m is for engaging a monster in melee.
1:g is anything else.
3:a is used for any attack.
3:d is used for any damage.
3:g is used for dodging ranged attacks.
3:n is used for deflecting ranged attacks with a lightsaber.
3:p is used for parrying melee attacks.

Because of these specifications, certain ones do not belong with certain other ones. If that's not confusing enough, the final number is not always a simple variation; what it is depends on both of the above letter slots. I'll go over the feats for you.

MELEE (f***)
1 - critical strike
2 - flurry
3 - power
4 - jump

RANGED (b***)
1 - attack
2 - attack 2
3 - sniper shot
4 - power blast

 

So, finally, a power blast animation is b*a4. The asterisk is either 5, 6, 7, or 9, depending on whether you are dealing with a single blaster, dual blasters, a rifle, or a heavy carbine.

 

If you're still confused, the 2DA for K2 has a description column that might help. The format is virtually the same as K1's, but of course K2 has more animations so you shouldn't go by it entirely.

Link to comment
Share on other sites

^^^^^^^^^^^

 

Uh..... Uh huh uh huh huh huh :urpdude:

I feel like Butt Head....

 

Now, that, that is some INFORMATION!

 

I have never seen that coding system explained, and therefore always ignored any of the animations labeled in such a way, wringing my hands with shame, laziness, and ignorance.

 

Thanks JCarter426, that was :guitar1

Link to comment
Share on other sites

I know it's not really about scripting, but yeah, I used to ignore it all the time too. Over time I began to notice a pattern, and here we are. To make things even more confusing, there are a couple other animations that use the same scheme, in a way. The knocked down animations, for instance, are g1x1, g1y1, and g1z1. And in K2, there are multiple ready animations for lightsabers, the final number corresponding to the saber form, but I don't know if they ever finished the animations for them. By the way, I edited the last post, I forgot about Force Jump.

Link to comment
Share on other sites

Im back in the shack :)

Well, can someone point me in the right direction about booleons. This is my aim:

A script to check you have an item. If true, you progress to another part to the dialouge. Im sure it has something to do with booleons. I mean, how would you go about doing that. And what type of booleons can you set for deifferent scenarios?

EDIT: Also, how do you go about using the goodbye function. Can you note an example on how this is used?

Link to comment
Share on other sites

Ok... I don't have time to give you a whole lot here, DJW, but the good news is TimBob12 has a great tutorial on conditional scripts that will help you here.

 

It is certainly possible to check if an NPC or the PC has a certain item equipped, and probably but not certain (for me) you can check if it is in the PC inventory period.

 

Think about the steps.

 

1. You need to "get" the individual in question.

 

2. You need to check for the item on said individual.

 

3. You need to return the value to the dialog to open or close the branch in question.

 

so, off the top of my head, and I may improve this later at a real PC with KTool, but... and I bet there is an in-game function for this so that we don't have to create one (came to me as I wrote my "name" for the conditional function, and it seemed oddly familiar):

int GetHasEquipped() 
{
  object oPC = GetObjectByTag(yourNPCtag);

  if GetItemPossessedBy(oPC,yourItemToBeFoundtag)
     return 1;
}

That might work, or something along those lines. KotOR Tool itself has a helpful script editor search window that you can just randomly type words into, like "equip" "item" "has" etc.... never know what that can bring up :)

 

As to the goodbye function... dunno... Never looked at it. Guess I'm curious though, so I will look at it. EDIT: goodbye "function". What are you referring to? is it a script in-game? There is no function in nwscript called "goodbye"

Link to comment
Share on other sites

I think it is something along the lines of oGoodbye, I have a feeling this might have something to do with exit script, making the character dissapear. Of coure, thers more script to it... Im intrested to work out just dissapear, no walk or anything...

 

EDIT

 

int StartingConditional()

{

int iResult;

object oW1 = GetObjectByTag("jediscout");

iResult = GetIsObjectValid(oW1);

return iResult;

 

}

 

Reading the TUT I made this, creditt to Timbob.Just to assure myself, when this script fires in the conversation it will check for "jediscout" then if true allow me the npc to say a particular line that will advance the conversation? Another note, what would I do to check if an NPC was still alive...

 

EDIT 2: Well, I found this...

int StartingConditional() {

return (GetGender(GetFirstPC()) == GENDER_FEMALE);

}

Link to comment
Share on other sites

Hey I have a quick question for youz guyz..while I'm thinking about it.

 

I know how to use "&&", but what does "||" do?

I kinda have a clue, but not really, and I figure if I knew what it did I could use it. :)

 

Thanks

-QDJ

 

 

EDIT oh hey, nevermind, I just found it in one of tk107s tutes..

Logical OR..hmm. I think I get it. sort of..

Link to comment
Share on other sites

Yeah, || is logical OR as you found from tk's tut.... thanks tk102 :hattip:

I might be able to explain a use for that...

 

In a scenario where there were multiple ways to get to the desired outcome, acheivable by entirely different means.

 

Case A: Annihilate by incendiary, had to kill the girl

Case B: Overload and sabotage, the girl is your partner

Case C: Sweet talk the mayor.... but you had to rescue the girl

 

All three are acceptable outcomes to satisfy beginning our end-game. So,

 

if A || B || C
   warp endgamemoduleofdoomforevernoooooooooo;

 

A, B and C are not simple predicates, they have && clauses built into them: (incendiary && kill girl) (overload and team up) (politics and rescue). This complexity and mixture of and's/or's allows you to evaluate a broad set of conditions in one statement.

 

Is that a decent explanation? I really don't know :o

 

 

 

@DJW.... Did you try playing with KTool? There is a GetIsDead(oCreature)!

as for "oGoodbye", the "o" indicates that Goodbye is an object, not a function. Further, since it has the "o" prefix, it means that Goodbye is just a nameholder for an object being used in a script. This is the script shack, I am happy to help, but please spend some time with the basic tut's!

Link to comment
Share on other sites

Ok... so let us break this down for ya!

 

object oGoodbye;

This tells you everything you need to know. oGoodbye can be any object in the kotor world - a container, a person, the PC, a computer console, etc.

 

oGoodbye = GetObjectByTag("n_jordin");

This is defining that oGoodbye is now assigned the value of "n_jordin", which is a tag of an NPC, I am guessing.

DelayCommand(1.0, DestroyObject(oGoodbye));

Now we understand why the object has been given this clever name "oGoodbye". Whatever object that is assigned to oGoodbye is going to be destroyed. It is going away, goodbye.

 

So, it could have been called, "oLaterdude", or "oGottago" or "oImouttahere" or "oDestroyme".

 

Please understand, oGoodbye is referring to a data type.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...