Jump to content

Home

Qui-Gon's Script Shack


Qui-Gon Glenn

Recommended Posts

  • Replies 352
  • Created
  • Last Reply
Posted
I feel a bit silly asking this, but I really haven't done much modding for K1 at all... so my question is: is it not possible to play animations from animations.2da and dialoganimations.2da in K1? I am so used to it in K2 that this seems hard to believe. But all my efforts thus far have been in vain.

 

I don't believe so, only NWScript-defined animations can be played via a script in K1.

Posted

Okay, I'm trying to compile this script with a lot of DelayCommand functions, most of them work fine, but the ones that are like this

 

DelayCommand(0.4, SpawnAvailableNPC(11, GetLocation(GetWaypointByTag("WP_ebon_atton"))));

i.e. spawning a NPC

 

return this error when compiling "Error: Type mismatch in parameter 2 in call to Delay Command"

 

at first I thought it might be becuase the problem commands are within if statements, but moving them outside the statement still gives the error. There are other DelayCommands used in this script, and they aren't giving me this error. What gives?

 

Show spoiler
(hidden content - requires Javascript to show)
void main() {
SetGlobalFadeOut(0.0, 0.0, 0.0, 0.0, 0.0);	
NoClicksFor(2.0);
object oKreia = GetObjectByTag("Kreia", 0);
object oHandmaiden = GetObjectByTag("Handmaiden", 0);
      object oVisasMarr = GetObjectByTag("VisasMarr", 0);
      AssignCommand(GetObjectByTag("hologram", 0), ActionPlayAnimation(204, 1.0, 0.0));
DelayCommand(0.2, DestroyObject(oKreia, 0.0, 0, 0.0, 0));
DelayCommand(0.2, DestroyObject(oVisasMarr, 0.0, 0, 0.0, 0));
DelayCommand(0.2, DestroyObject(oHandmaiden, 0.0, 0, 0.0, 0));
      //
                   if (IsAvailableCreature(4)) {
		DelayCommand(0.4, SpawnAvailableNPC(4, GetLocation(GetWaypointByTag("WP_ebon_brianna"))));
              DelayCommand(0.4, CreateObject(1, "oKreia", GetLocation(GetObjectByTag("WP_ebon_kreia", 0))));
                    DelayCommand(0.4, SpawnAvailableNPC(9, GetLocation(GetObjectByTag("WP_ebon_visas", 0))));			
                    DelayCommand(0.4, SpawnAvailableNPC(0, GetLocation(GetObjectByTag("WP_ebon_atton", 0))));
                     }
else
                  if (IsAvailableCreature(11)) {
		DelayCommand(0.4, SpawnAvailableNPC(11, GetLocation(GetWaypointByTag("WP_ebon_atton"))));
		DelayCommand(0.4, CreateObject(1, "oKreia", GetLocation(GetObjectByTag("WP_ebon_kreia", 0))));
		DelayCommand(0.4, SpawnAvailableNPC(9, GetLocation(GetObjectByTag("WP_ebon_visas", 0))));			
		DelayCommand(0.4, oHandmaiden = CreateObject(1, "p_handmaiden", GetLocation(GetWaypointByTag("WP_ebon_hand")), 0));
		DelayCommand(0.4, CreateObject(1, "p_sister", GetLocation(GetWaypointByTag("WP_ebon_sister1")), 0));
		DelayCommand(0.4, CreateObject(1, "p_sister2", GetLocation(GetWaypointByTag("WP_ebon_sister2")), 0));	
}
else {

		DelayCommand(0.4, SpawnAvailableNPC(0, GetLocation(GetWaypointByTag("WP_ebon_atton"))));
		DelayCommand(0.4, CreateObject(1, "oKreia", GetLocation(GetObjectByTag("WP_ebon_kreia", 0))));
		DelayCommand(0.4, SpawnAvailableNPC(9, GetLocation(GetObjectByTag("WP_ebon_visas", 0))));			
		DelayCommand(0.4, oHandmaiden = CreateObject(1, "p_handmaiden", GetLocation(GetWaypointByTag("WP_ebon_hand")), 0));
		DelayCommand(0.4, CreateObject(1, "p_sister", GetLocation(GetWaypointByTag("WP_ebon_sister1")), 0));
		DelayCommand(0.4, CreateObject(1, "p_sister2", GetLocation(GetWaypointByTag("WP_ebon_sister2")), 0));
}
DelayCommand(0.5, AssignCommand(GetObjectByTag("Kreia", 0), SetFacingPoint(GetPosition(GetObjectByTag("hologram", 0)))));
DelayCommand(0.5, AssignCommand(GetObjectByTag("Atton", 0), SetFacingPoint(GetPosition(GetObjectByTag("hologram", 0)))));
DelayCommand(0.5, AssignCommand(GetObjectByTag("Sister1", 0), SetFacingPoint(GetPosition(GetObjectByTag("hologram", 0)))));	
       DelayCommand(0.5, AssignCommand(GetObjectByTag("Sister2", 0), SetFacingPoint(GetPosition(GetObjectByTag("hologram", 0)))));	
       DelayCommand(0.5, AssignCommand(GetObjectByTag("Handmaiden", 0), SetFacingPoint(GetPosition(GetObjectByTag("hologram", 0)))));	
       DelayCommand(0.5, AssignCommand(GetObjectByTag("Visas", 0), SetFacingPoint(GetPosition(GetObjectByTag("hologram", 0)))));
DelayCommand(0.5, AssignCommand(GetObjectByTag("Disciple", 0), SetFacingPoint(GetPosition(GetObjectByTag("hologram", 0)))));
DelayCommand(0.6, AssignCommand(oKreia, ActionStartConversation(GetPCSpeaker(), "pcdead", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0)));


}

Posted

If I'm not mistaken SpawnAvailableNPC is not an action, therefore DelayCommand cannot be used on it. Easiest way around that that I can think of would be to put all the SpawnAvailableNPC (and any others that are non-action but you need to delay) commands into a separate script(s). Then, where you originally had the spawning done in the script, do something like this:

 

DelayCommand(0.5, ExecuteScript(string sScript, object oTarget, int nScriptVar=-1);

 

oTarget is the object called to run the script and int nScriptVar, to quote the commentary from the developers, "This value will be returned by calls to GetRunScriptVar."

Posted

Yeah, you can't delay spawns (of NPC's nor teammates) with DelayCommand.

Which do require Fallen Guardians solution.

 

I used it for example on the Telos cantina. One dancer got destroyed, the other spawned, but doing that at the same time like OE's script did would move the dancer away at spawn since the original was still there. Adding a small 2 seconds delay would allow her to remain on the proper location. However, yeah, doesn't seemed a way to do so unless with an executed other script.

Posted
I don't believe so, only NWScript-defined animations can be played via a script in K1.

That's unfortunate... but expected. Oh well.

Okay, I'm trying to compile this script with a lot of DelayCommand functions, most of them work fine, but the ones that are like this

 

DelayCommand(0.4, SpawnAvailableNPC(11, GetLocation(GetWaypointByTag("WP_ebon_atton"))));

i.e. spawning a NPC

 

return this error when compiling "Error: Type mismatch in parameter 2 in call to Delay Command"

Another thing you can do is create a subroutine. The benefit of this is you can keep everything in one script, though in certain cases ExecuteScript works better. So, for example:

void SpawnNPC(int iNPC, location lLocation) {

SpawnAvailableNPC(iNPC, lLocation);

}



void main() {

DelayCommand(0.4, SpawnNPC(11, GetLocation(GetWaypointByTag("WP_ebon_atton"))));

}

Haven't tested it, but it should work. Theoretically.

  • 3 weeks later...
Posted

Not really a request, more a vent...

 

So spend over an hour getting an "dreact" to appear properly after blowing up a droid. Nothing seemed to work.

Until I made a script for the sole purpose of triggering another script, and nothing else.

 

It had a 5 sec delay, but never worked properly after the droid got blown. Apparently the 5 sec had to be when the droid was still alive.

 

So using the other script, it immediately fired the other script and no longer required a living droid after 5 seconds. Fixing everything.

 

KOTOR Logic... it takes me an hour or 2 to grasp :/

  • 2 weeks later...
Posted

All righty, basically I'm trying to make a node available if you have one of 4 party members in your party, and I didn't want to copy the node to use each companion's individual inparty check, so I did this:

 

#include "k_inc_debug"



int StartingConditional()
{

  return( (IsNPCPartyMember(NPC_JOLEE) == TRUE || IsNPCPartyMember(NPC_T3_M4) == TRUE || IsNPCPartyMember(NPC_CANDEROUS) == TRUE || IsNPCPartyMember(NPC_HK_47) == TRUE));


} 

 

Now it won't compile, saying that I'm missing a required argument in IsNPCPartyMember and NPC_JOLEE is an undeclared identifier. I copied this mostly from the BioWare written companion check script, I just added in all the || symbols in between each one.

Posted
All righty, basically I'm trying to make a node available if you have one of 4 party members in your party, and I didn't want to copy the node to use each companion's individual inparty check, so I did this:

 

#include "k_inc_debug"



int StartingConditional()
{

  return( (IsNPCPartyMember(NPC_JOLEE) == TRUE || IsNPCPartyMember(NPC_T3_M4) == TRUE || IsNPCPartyMember(NPC_CANDEROUS) == TRUE || IsNPCPartyMember(NPC_HK_47) == TRUE));


} 

 

Now it won't compile, saying that I'm missing a required argument in IsNPCPartyMember and NPC_JOLEE is an undeclared identifier. I copied this mostly from the BioWare written companion check script, I just added in all the || symbols in between each one.

 

You might substitute the numbers for the text, and/or split the check into four.

Posted
This for Dantooine Tension or some other project?

 

You'll just have to wait and see. ;)

 

And now I have a new problem. Okay, so I've been trying to unequip Carth and Bastila's armor and put clothing on them, however when I try to run this it crashes to desktop. Any idea what's going on?

 

void main()
{

object oPM1 = GetObjectByTag("Carth");
object oPM2 = GetObjectByTag("Bastila");

object oPC = GetFirstPC();
object oArmor = GetItemInSlot(INVENTORY_SLOT_BODY, oPM1);
object oArmorB = GetItemInSlot(INVENTORY_SLOT_BODY, oPM2);
object oArm = CreateItemOnObject("g_a_clothes01", oPM1);
object oArmB = CreateItemOnObject("g_a_clothes01", oPM2);

AssignCommand(oPM1, ClearAllActions());
   AssignCommand (oPM1, ActionUnequipItem(oArmor, INVENTORY_SLOT_BODY));
   AssignCommand (oPM1, ActionEquipItem(oArm, INVENTORY_SLOT_BODY));
   AssignCommand(oPM2, ClearAllActions());
   AssignCommand (oPM2, ActionUnequipItem(oArmorB, INVENTORY_SLOT_BODY));
   AssignCommand (oPM2, ActionEquipItem(oArmB, INVENTORY_SLOT_BODY));

}

Posted
You'll just have to wait and see. ;)

 

And now I have a new problem. Okay, so I've been trying to unequip Carth and Bastila's armor and put clothing on them, however when I try to run this it crashes to desktop. Any idea what's going on?

 

void main()
{

object oPM1 = GetObjectByTag("Carth");
object oPM2 = GetObjectByTag("Bastila");

object oPC = GetFirstPC();
object oArmor = GetItemInSlot(INVENTORY_SLOT_BODY, oPM1);
object oArmorB = GetItemInSlot(INVENTORY_SLOT_BODY, oPM2);
object oArm = CreateItemOnObject("g_a_clothes01", oPM1);
object oArmB = CreateItemOnObject("g_a_clothes01", oPM2);

AssignCommand(oPM1, ClearAllActions());
   AssignCommand (oPM1, ActionUnequipItem(oArmor, INVENTORY_SLOT_BODY));
   AssignCommand (oPM1, ActionEquipItem(oArm, INVENTORY_SLOT_BODY));
   AssignCommand(oPM2, ClearAllActions());
   AssignCommand (oPM2, ActionUnequipItem(oArmorB, INVENTORY_SLOT_BODY));
   AssignCommand (oPM2, ActionEquipItem(oArmB, INVENTORY_SLOT_BODY));

}

 

I'm fairly certain that the Equip/Unequip Item functions require the first parameter, in this case oArmor, to be a person. I myself have yet to get an Equip or Unequip function to actually work. For me, they've just done nothing.

 

Also, I recall the NWN Lexicon saying that you don't need to use the Unequip function at all if you use the Equip. You might try the script without that, though you might run into my problem with nothing happening in-game.

Posted

No, equip and unequip are actions assigned to characters:

// 32: Equip oItem into nInventorySlot.
// - nInventorySlot: INVENTORY_SLOT_*
// * No return value, but if an error occurs the log file will contain
//   "ActionEquipItem failed."
void ActionEquipItem(object oItem, int nInventorySlot, int bInstant=FALSE);

// 33: Unequip oItem from whatever slot it is currently in.
void ActionUnequipItem( object oItem, int bInstant = FALSE );

Unequip might be unnccessary as you say, but you can never be too safe with this game.

Posted
No, equip and unequip are actions assigned to characters:

// 32: Equip oItem into nInventorySlot.
// - nInventorySlot: INVENTORY_SLOT_*
// * No return value, but if an error occurs the log file will contain
//   "ActionEquipItem failed."
void ActionEquipItem(object oItem, int nInventorySlot, int bInstant=FALSE);

// 33: Unequip oItem from whatever slot it is currently in.
void ActionUnequipItem( object oItem, int bInstant = FALSE );

Unequip might be unnccessary as you say, but you can never be too safe with this game.

 

Well, could you explain where the mistake is in the item not showing up on my PC? I tried the dancer outfit as a test item and usually had the script like this:

 

AssignCommand(GetFirstPC(), ActionEquipItem(GetObjectByTag("g_danceroutfit"), INVENTORY_SLOT_BODY); //Though I usually inputted "1" in place of the Slot

 

Was I not using the right slot?

  • 2 weeks later...
Posted
The tag for the dancer outfit is "DancersOutfit". It's one of the few items for which the tag and template ResRef don't match.

 

Just now got around to this, and I beg you to feel free to slap me! Now I feel like finding a corner and having a little "Duh moment".

  • 5 weeks later...
Posted

Eh, I don't blame you. :p

 

I have a problem of my own. Well, not so much a problem, really. I'm trying to see if the global string K_STUNT_MODULE is used at all in either game, so I don't have to add my own. Has anyone worked with this before?

Posted
Eh, I don't blame you. :p

 

I have a problem of my own. Well, not so much a problem, really. I'm trying to see if the global string K_STUNT_MODULE is used at all in either game, so I don't have to add my own. Has anyone worked with this before?

 

If I had to guess, I'd say it's used by the game code to load the proper stunt module, given a series of conditions, such as a point in the game. I don't think there are that many stunt modules in TSL, so I would try printing the K_STUNT_MODULE as a string to your info screen in-game in K1. You might use the save game archives from deadlystream and test the script after various points in the game. Let us know if it works?

Posted

I've looked through several saves, and it always seems to be blank... though I don't have a complete set of actual saves, just me messing around in the game. I can't think of why it would be needed, though. There are already globals for the complete planets and player choices... why would a string be needed, specifically? K_LAST_MODULE is used in K1 to record the module name you're in before you use the return to hideout/Ebon Hawk function. In that case, a string is specifically needed; numbers would be possible but it would require a lot more coding and you would have to edit it every time a new module is added to the game. But in the case of loading the correct stunt module... well, the progression is mostly linear, so there wouldn't be any point of contention.

 

I might have to make my own anyway, though. I realized I might want more than one.

Posted

It would seem like you wouldn't really need K_STUNT_MODULE. From my understanding the only unique thing about stunt modules is the fact they use cutscenes models for all the animations in the cutscene. (That and they use semi-unique variants of the area they're supposed to take place in. i.e. in one of them the Ebon Hawk ends at the garage area, and in its stead there is a void of unwalkable blackness) Of course this could all be worthless info, I haven't looked at global strings that much.

  • 3 weeks later...
Posted

So, I have a strange problem. The script compiles fine. The beginning of it executes fine. But then at some point it just stops recognizing two of my variables, causing all other parts of the script to fail to execute. What's stranger still is the script is almost identical to one I wrote for K2 with no such problems.

#include "jc_inc_clone"

void main() {

object oTarget = OBJECT_SELF;
int iFaction = 2;

if( oTarget == OBJECT_INVALID ) {
JC_DLG("jc_clo1");
}

else {

string sTemp = JC_Template(oTarget);

object oClone = CreateObject(OBJECT_TYPE_CREATURE, sTemp, GetLocation(OBJECT_SELF), FALSE);

int iI;

// Copy ALIGNMENT
AdjustAlignment(oClone, GetAlignmentGoodEvil(oTarget), abs(GetGoodEvilValue(oTarget) - GetGoodEvilValue(oClone)), FALSE);

// Clear INVENTORY
 for( iI = 0; iI <= 17; iI++ ) {
ActionUnequipItem(GetItemInSlot(iI, oClone), TRUE);
}

// Copy INVENTORY

 for( iI = 0; iI <= 17; iI++ ) {
if( GetIsObjectValid(GetItemInSlot(iI, oTarget)) ){
	DelayCommand(0.1, AssignCommand(oClone, ActionEquipItem(CreateItemOnObject(GetStringLowerCase(GetTag(GetItemInSlot(iI, oTarget))), oClone, 1, 1), iI, TRUE)));
	}
}

// Copy APPEARANCE
ApplyEffectToObject(2, EffectDisguise(GetAppearanceType(oTarget)), oClone, 0.0);

// Set FACTION
ChangeToStandardFaction(oClone, iFaction);

// Heal up the clone (just in case)
ApplyEffectToObject(0, EffectHeal(GetMaxHitPoints(oClone) - GetCurrentHitPoints(oClone)), oClone, 0.0);
ApplyEffectToObject(0, EffectHealForcePoints(GetMaxForcePoints(oClone) - GetCurrentForcePoints(oClone)), oClone, 0.0);

 }

}

It works consistently up to and including the creation of oClone. After that, it seems like oTarget and oClone work once each, and after that they never work again. I'm able to shift parts of the code around to get that part to work, but at the expense of all the others. It's rather frustrating.

 

Any ideas?

Archived

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

×
×
  • Create New...