Fallen Guardian Posted January 8, 2014 Share Posted January 8, 2014 EDIT: Aha, I seem to have gotten it working: void main() { if( GetIsInConversation(GetFirstPC()) == TRUE ) { DelayCommand(0.5, ExecuteScript("this_script", OBJECT_SELF)); return; } if( GetIsInConversation(GetFirstPC()) == FALSE ) { DelayCommand(0.5, DisplayMessageBox()); } } This makes it so the conversation continues as normal, the GUI doesn't break, and no more than a second after the conversation is over the message box is properly displayed. Hooray! Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted January 25, 2014 Share Posted January 25, 2014 EDIT: Aha, I seem to have gotten it working: void main() { if( GetIsInConversation(GetFirstPC()) == TRUE ) { DelayCommand(0.5, ExecuteScript("this_script", OBJECT_SELF)); return; } if( GetIsInConversation(GetFirstPC()) == FALSE ) { DelayCommand(0.5, DisplayMessageBox()); } } This makes it so the conversation continues as normal, the GUI doesn't break, and no more than a second after the conversation is over the message box is properly displayed. Hooray! Somehow, I didn't get the memo that you'd made a reply to the thread... ...A belated congrats on solving the issue, FG! I figured the DelayCommand would help you out, but it's nice to hear that it was successful. *Files info in brain for later transplant to archive of all that is modding* Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted February 2, 2014 Share Posted February 2, 2014 So... I'm working a script for part of mod for TSL. The idea is that the OnSpawn spawns the mandos invisible and the second script will "de-cloak" them. The second script is run from a dialogue, but the mandos aren't showing. When they're spawned, they lack the shimmer, the distortion. I've tried for the past two days to make it work... The OnSpawn: Show spoiler (hidden content - requires Javascript to show) //:: k_def_spawn01 //:: v1.0, Default On Spawn In //:: Created By: Preston Watamaniuk, Copyright (c) 2002 Bioware Corp. #include "k_inc_generic" #include "k_inc_debug" void main() { // WALK WAYPOINT BEHAVIORS (Comment In or Out to Activate ) **************************************************************************** /* I cut this section out as in this use of the script it is not necessary. If you need to have these behaviors in for a spawn, simply use the original provided in scripts.bif. As it is, this script will compile and work just fine for this purpose, just not all purposes */ // CUSTOM USER DEFINED EVENTS //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_HEARTBEAT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1001 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_PERCEPTION); //BEHAVIOR WE NEED - Fire User Defined Event 1002 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_ATTACKED); //OPTIONAL BEHAVIOR - Fire User Defined Event 1005 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DAMAGED); //OPTIONAL BEHAVIOR - Fire User Defined Event 1006 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DISTURBED); //OPTIONAL BEHAVIOR - Fire User Defined Event 1008 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_COMBAT_ROUND_END); //OPTIONAL BEHAVIOR - Fire User Defined Event 1003 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DIALOGUE); //OPTIONAL BEHAVIOR - Fire User Defined Event 1004 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DEATH); //OPTIONAL BEHAVIOR - Fire User Defined Event 1007 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DISTURBED); //OPTIONAL BEHAVIOR - Fire User Defined Event 1008 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_BLOCKED); //OPTIONAL BEHAVIOR - Fire User Defined Event 1009 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_FORCE_AFFECTED); //OPTIONAL BEHAVIOR - Fire User Defined Event 1010 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DIALOGUE_END); //OPTIONAL BEHAVIOR - Fire User Defined Event 1011 // DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ***************************************************************************************** GN_SetDayNightPresence(AMBIENT_PRESENCE_ALWAYS_PRESENT); GN_SetListeningPatterns(); //This function although poorly named sets up the listening patterns and other important data for the //creature it should never be removed. GN_WalkWayPoints(); ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectInvisibility(INVISIBILITY_TYPE_NORMAL), OBJECT_SELF); ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(8000), OBJECT_SELF); ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(8002), OBJECT_SELF); } The Decloak script: Show spoiler (hidden content - requires Javascript to show) void main() { int iTwo = 0; object oCMando = GetObjectByTag("mandocut", iTwo); effect eUncloak = EffectVisualEffect(8001); effect eCurrent = GetFirstEffect(oCMando); while(GetIsObjectValid(oCMando)) { if(GetStandardFaction(oCMando) == STANDARD_FACTION_NEUTRAL) { while (GetIsEffectValid(eCurrent)) { if (GetEffectType(eCurrent) == EFFECT_TYPE_INVISIBILITY) { DelayCommand(1.5, RemoveEffect(oCMando, eCurrent)); DelayCommand(2.0, ApplyEffectToObject(0, eUncloak, oCMando)); } eCurrent = GetNextEffect(oCMando); } ChangeToStandardFaction(oCMando, 1); } iTwo++; } } Link to comment Share on other sites More sharing options...
Hassat Hunter Posted February 3, 2014 Share Posted February 3, 2014 Have you tried checking with the Sith Assassins, how they do that? Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted February 3, 2014 Share Posted February 3, 2014 Have you tried checking with the Sith Assassins, how they do that? I originally tried that, but couldn't make it work. I just took another look at it and the UserDefined script for the Sith Assassin. I believe what I have will work, but I can't test it until tomorrow. I'll report back when I can. Link to comment Share on other sites More sharing options...
supreme kotor Posted February 3, 2014 Share Posted February 3, 2014 I originally tried that, but couldn't make it work. I just took another look at it and the UserDefined script for the Sith Assassin. I believe what I have will work, but I can't test it until tomorrow. I'll report back when I can. Check post number 3 in this thread. I believe that script could be adapted to fit your purpose. Good luck-SupremeKotor Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted February 3, 2014 Share Posted February 3, 2014 Check post number 3 in this thread. I believe that script could be adapted to fit your purpose. Good luck-SupremeKotor That's where the original source for what I posted came from. It was subtly modified from that post. On the bright side, I made them spawn right, but I have to wait to get home from school to make them unspawn. Link to comment Share on other sites More sharing options...
supreme kotor Posted February 4, 2014 Share Posted February 4, 2014 On the bright side, I made them spawn right, but I have to wait to get home from school to make them unspawn. Did you get this working fine? If so you should post both scripts you used Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted February 4, 2014 Share Posted February 4, 2014 Did you get this working fine? If so you should post both scripts you used As much as it shames me to say it, I made a rookie mistake. I've been a scripter for a year and a half(and consider myself very good at it), but I made a simple mistake: I used the wrong tag!: The worst part, we had it working about an hour ago, then it got messed up. Right now, I'm trying to get it back to a working model before I mess with it anymore. Link to comment Share on other sites More sharing options...
Hassat Hunter Posted February 4, 2014 Share Posted February 4, 2014 Know all of these problems only all too well... Link to comment Share on other sites More sharing options...
bunjeeman Posted March 30, 2014 Share Posted March 30, 2014 Hey, I've been looking for help with some custom powers (http://www.lucasforums.com/showthread.php?t=213909) and all I need is the scripts. One has been provided already in the linked thread, but it doesn't work. Any ideas? Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted November 3, 2014 Share Posted November 3, 2014 So, I haven't been here in a while, but I'm in need of some major help here. I'm working on fixing a vanilla bug relating to the Sith Armor on Taris, but it's proving irritating. In short, if you equip the Sith Armor on Carth, take him out of the party, and then talk to Gadon and cash in the Armor, it isn't actually removed and Carth still has it. My attempted workaround is like so(note that I'm re-writing the script from scratch): Show spoiler (hidden content - requires Javascript to show) void main() { int iPM = GetPartyMemberCount(); if(iPM == 1) { SetAreaUnescapable(0); object oP = SpawnAvailableNPC(2, Location(Vector(94.19, 52.9, 0.0), 0.0)); // AddToParty(oP, GetFirstPC()); if(GetTag(GetItemInSlot(1, oP)) == "ptar_sitharmor") { AssignCommand(oP, ActionUnequipItem(GetItemInSlot(1, oP))); } SetGlobalBoolean("k1r_armor_carth", 1); SaveNPCState(2); // RemoveFromParty(oP); // DelayCommand(2.0, DestroyObject(oP)); SetAreaUnescapable(1); } else { if(GetTag(GetItemInSlot(1, GetPartyMemberByIndex(0))) == "ptar_sitharmor") { AssignCommand(GetPartyMemberByIndex(0), ActionUnequipItem(GetItemInSlot(1, GetPartyMemberByIndex(0)))); } if(GetTag(GetItemInSlot(1, GetPartyMemberByIndex(1))) == "ptar_sitharmor") { AssignCommand(GetPartyMemberByIndex(1), ActionUnequipItem(GetItemInSlot(1, GetPartyMemberByIndex(1)))); } } int iStack = GetItemStackSize(GetItemPossessedBy(GetFirstPC(), "ptar_sitharmor")); int iStart = 1; while(iStart <= iStack) { DestroyObject(GetItemPossessedBy(GetFirstPC(), "ptar_sitharmor")); iStart++; } CreateItemOnObject("ptar_sithpapers", GetFirstPC(), 1); } If I don't destroy Carth after spawning him, he shows up naked. If I destroy him, exit the module, and then add him to the party, he still has the armor on. So, how would I modify the script above to make the changes stick, without having Carth permanently added to the party after the conversation (which would break immersion if he wasn't in the party when you entered...)? Link to comment Share on other sites More sharing options...
DarthParametric Posted November 3, 2014 Share Posted November 3, 2014 Restrict the armour to the player character only? Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted November 3, 2014 Share Posted November 3, 2014 Restrict the armour to the player character only? That would defeat the purpose of making both sets of armor available to obtain, which is rquired due to Gadon Thek saying that he would trade the Paper for the uniforms, not uniform.. Link to comment Share on other sites More sharing options...
Hassat Hunter Posted November 5, 2014 Share Posted November 5, 2014 I would probably go around on making Carth required for the conversation option to appear, rather than going this script route. Kinda need a look on the .dlg how to properly do that though without making people go "why doesn't this option appear?" EDIT: Aside from that you can always try to simply destroy the item rather than unequip it? Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted November 5, 2014 Share Posted November 5, 2014 I would probably go around on making Carth required for the conversation option to appear, rather than going this script route. Kinda need a look on the .dlg how to properly do that though without making people go "why doesn't this option appear?" EDIT: Aside from that you can always try to simply destroy the item rather than unequip it? Well, I tried again just now and discovered something... Show spoiler (hidden content - requires Javascript to show) A weird anomally that could be exploited... I've just come to the conclusion that each party member has a separate inventory, with each inventory sharing the same items. When a character equips something, a copy of it is removed from the inventory of every other party member. Similar, when something is aquired or bought, a copy is added. Scripting doesn't follow the same behaviour. I've come to this conclusion, which could very well prove wrong, because of the Sith Armor. I removed it from the first party member's (the one I control at the time) inventory while Carth was in the party, and then left the Hidden Bek Base. Of note is the fact that I checked my inventory after the talk with Gadon and saw no Sith Armor. After leaving the base, I added Carth to the Party, and he didn't have the Armor equipped... *but* he did have a copy in his inventory. In short, each party member has their own inventory, and when one uses the normal game mechanics to acquire or discard items, the inventories of the other party members are "synced" with the inventory of the one who got rid of/acquired the item. When one uses scripting for the same purpose, they have to apply it to more than just the one inventory... Thus, my issue was Carth's Inventory not changing/updating and him thus retaining the armor. My solution was to simply destroy the item after it was unequipped: Show spoiler (hidden content - requires Javascript to show) void main() { int iPM = GetPartyMemberCount(); object oP; if(iPM == 1) { SetAreaUnescapable(0); oP = SpawnAvailableNPC(2, Location(Vector(94.19, 52.9, 0.0), 0.0)); AddPartyMember(2, oP); object oI = GetItemInSlot(1, oP); if(GetTag(oI) == "ptar_sitharmor") { AssignCommand(oP, ActionUnequipItem(oI)); DestroyObject(oI); } SetGlobalBoolean("k1r_armor_carth", 1); // SetAvailableNPCId(2, oP); SaveNPCState(2); // RemovePartyMember(2); SetAreaUnescapable(1); } The only issue was that I had to re-sync Carth's inventory, thus I set Carth to not be selectable and then call the Party Selection screen, making him leave the party with a synced inventory. Link to comment Share on other sites More sharing options...
Hassat Hunter Posted November 10, 2014 Share Posted November 10, 2014 Could be. First that comes to mind is a situation with TSL(RCM) with BaoDur on the Telos Plateau. I fixed him being injured in 1.7, but afterwards people still mentioned him being hurt. So I wanted to check it out myself, and I spend hours on that, not understanding why it didn't work anymore... Until finally, after an insane long time, I found out; * If entering the academy the actual teammates are placed inside the force fields. If you go up then, it will heal Bao-Dur properly. * If you save, then load, before getting your teammates out, they are instead replaced by clones. The clone Bao-Dur gets healed, but the *actual* Bao-Dur is still injured if he joins your party or goes to the Hawk. It could be you simply deleted it from Carth's clone, rather than the actual teammate? (In the end I solved it by aside from healing at the academy, there's also a healing addition in the 950COR cutscene during the fade-in) Link to comment Share on other sites More sharing options...
blinkyzero Posted December 4, 2014 Share Posted December 4, 2014 Is it possible to have an NPC set down a trap with a script? I've been trying different ways to accomplish that all afternoon and haven't had any luck yet. Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted December 5, 2014 Share Posted December 5, 2014 Is it possible to have an NPC set down a trap with a script? I've been trying different ways to accomplish that all afternoon and haven't had any luck yet. Blinky, you might try this: Show spoiler (hidden content - requires Javascript to show) /* Name all of the mines ------------------------ 1 - Minor Flash Mine = g_i_trapkit001 2 - Average Flash Mine = g_i_trapkit002 3 - Deadly Flash Mine = g_i_trapkit003 4 - Minor Frag Mine = g_i_trapkit004 5 - Average Frag Mine = g_i_trapkit005 6 - Deadly Frag Mine = g_i_trapkit006 7 - Minor Plasma Mine = g_i_trapkit007 8 - Average Plasma Mine = g_i_trapkit008 9 - Deadly Plasma Mine = g_i_trapkit009 10 - Minor Poison Mine = g_i_trapkit010 11 - Average Poison Mine = g_i_trapkit011 12 - Deadly Poison Mine = g_i_trapkit012 Flash Mine = g_i_trapkit01* Frag Mine = g_i_trapkit02* Plasma Mine = g_i_trapkit03* Poison Mine = g_i_trapkit04* *: Named normal, but same script as the Minor version; not sure if they're placed in-game or random loot. */ void LayTrap(object oPerson, string sTraptag, int iTrapID); void main() { object oSelf = OBJECT_SELF; // If the script is launched via the person laying the trap. string sTrap; // This will be the tag of the trap. int iTrap; // This will be the index of the trap. int iHaveTraps = 0; // Boolean to check for whether the person has the trap type. int iRandom = Random(4) + 1; // The +1 part makes the number 1-4 instead of 0-3... /* Here we go into a while loop against the iHaveTraps integer. The reason being that we want to check for a random type of grenade and if oSelf has none of that type, we want to check for a new type, instead of just silently fail and nothing happen... */ while(iHaveTraps == 0) { if(iRandom == 1) { // Flash Mines // Checking strongest first. if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT003"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT003"; int iTrap = 3; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT002"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT002"; int iTrap = 2; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT001"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT001"; int iTrap = 1; } else { iRandom = Random(4) + 1; } // Run a custom function to lay the trap, if iHaveTraps == 1 if(iHaveTraps == 1) { LayTrap(oSelf, sTrap, iTrap); } } if(iRandom == 2) { // Frag Mines // Checking strongest first. if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT006"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT006"; int iTrap = 6; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT005"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT005"; int iTrap = 5; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT004"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT004"; int iTrap = 4; } else { iRandom = Random(4) + 1; } // Run a custom function to lay the trap, if iHaveTraps == 1 if(iHaveTraps == 1) { LayTrap(oSelf, sTrap, iTrap); } } if(iRandom == 3) { // Plasma Mines // Checking strongest first. if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT009"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT009"; int iTrap = 9; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT008"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT008"; int iTrap = 8; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT007"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT007"; int iTrap = 7; } else { iRandom = Random(4) + 1; } // Run a custom function to lay the trap, if iHaveTraps == 1 if(iHaveTraps == 1) { LayTrap(oSelf, sTrap, iTrap); } } if(iRandom == 4) { // Poison Mines // Checking strongest first. if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT012"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT012"; int iTrap = 12; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT011"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT011"; int iTrap = 11; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT010"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT010"; int iTrap = 10; } else { iRandom = Random(4) + 1; } // Run a custom function to lay the trap, if iHaveTraps == 1 if(iHaveTraps == 1) { LayTrap(oSelf, sTrap, iTrap); } } } } void LayTrap(object oPerson, string sTraptag, int iTrapID) { object oTrap = GetItemPossessedBy(oPerson, sTraptag); string sTrigger; switch (iTrapID - 1) { case 0: { sTrigger = "g_t_trap001"; } case 1: { sTrigger = "g_t_trap002"; } case 2: { sTrigger = "g_t_trap003"; } case 3: { sTrigger = "g_t_trap004"; } case 4: { sTrigger = "g_t_trap005"; } case 5: { sTrigger = "g_t_trap006"; } case 6: { sTrigger = "g_t_trap007"; } case 7: { sTrigger = "g_t_trap008"; } case 8: { sTrigger = "g_t_trap009"; } case 9: { sTrigger = "g_t_trap010"; } case 10: { sTrigger = "g_t_trap011"; } case 11: { sTrigger = "g_t_trap012"; } default: { return; } } AssignCommand(oPerson, PlayAnimation(52)); CreateObject(OBJECT_TYPE_TRIGGER, sTrigger, GetLocation(oPerson)); } Link to comment Share on other sites More sharing options...
blinkyzero Posted December 5, 2014 Share Posted December 5, 2014 Blinky, you might try this: Show spoiler (hidden content - requires Javascript to show) /* Name all of the mines ------------------------ 1 - Minor Flash Mine = g_i_trapkit001 2 - Average Flash Mine = g_i_trapkit002 3 - Deadly Flash Mine = g_i_trapkit003 4 - Minor Frag Mine = g_i_trapkit004 5 - Average Frag Mine = g_i_trapkit005 6 - Deadly Frag Mine = g_i_trapkit006 7 - Minor Plasma Mine = g_i_trapkit007 8 - Average Plasma Mine = g_i_trapkit008 9 - Deadly Plasma Mine = g_i_trapkit009 10 - Minor Poison Mine = g_i_trapkit010 11 - Average Poison Mine = g_i_trapkit011 12 - Deadly Poison Mine = g_i_trapkit012 Flash Mine = g_i_trapkit01* Frag Mine = g_i_trapkit02* Plasma Mine = g_i_trapkit03* Poison Mine = g_i_trapkit04* *: Named normal, but same script as the Minor version; not sure if they're placed in-game or random loot. */ void LayTrap(object oPerson, string sTraptag, int iTrapID); void main() { object oSelf = OBJECT_SELF; // If the script is launched via the person laying the trap. string sTrap; // This will be the tag of the trap. int iTrap; // This will be the index of the trap. int iHaveTraps = 0; // Boolean to check for whether the person has the trap type. int iRandom = Random(4) + 1; // The +1 part makes the number 1-4 instead of 0-3... /* Here we go into a while loop against the iHaveTraps integer. The reason being that we want to check for a random type of grenade and if oSelf has none of that type, we want to check for a new type, instead of just silently fail and nothing happen... */ while(iHaveTraps == 0) { if(iRandom == 1) { // Flash Mines // Checking strongest first. if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT003"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT003"; int iTrap = 3; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT002"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT002"; int iTrap = 2; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT001"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT001"; int iTrap = 1; } else { iRandom = Random(4) + 1; } // Run a custom function to lay the trap, if iHaveTraps == 1 if(iHaveTraps == 1) { LayTrap(oSelf, sTrap, iTrap); } } if(iRandom == 2) { // Frag Mines // Checking strongest first. if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT006"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT006"; int iTrap = 6; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT005"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT005"; int iTrap = 5; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT004"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT004"; int iTrap = 4; } else { iRandom = Random(4) + 1; } // Run a custom function to lay the trap, if iHaveTraps == 1 if(iHaveTraps == 1) { LayTrap(oSelf, sTrap, iTrap); } } if(iRandom == 3) { // Plasma Mines // Checking strongest first. if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT009"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT009"; int iTrap = 9; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT008"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT008"; int iTrap = 8; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT007"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT007"; int iTrap = 7; } else { iRandom = Random(4) + 1; } // Run a custom function to lay the trap, if iHaveTraps == 1 if(iHaveTraps == 1) { LayTrap(oSelf, sTrap, iTrap); } } if(iRandom == 4) { // Poison Mines // Checking strongest first. if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT012"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT012"; int iTrap = 12; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT011"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT011"; int iTrap = 11; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT010"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT010"; int iTrap = 10; } else { iRandom = Random(4) + 1; } // Run a custom function to lay the trap, if iHaveTraps == 1 if(iHaveTraps == 1) { LayTrap(oSelf, sTrap, iTrap); } } } } void LayTrap(object oPerson, string sTraptag, int iTrapID) { object oTrap = GetItemPossessedBy(oPerson, sTraptag); string sTrigger; switch (iTrapID - 1) { case 0: { sTrigger = "g_t_trap001"; } case 1: { sTrigger = "g_t_trap002"; } case 2: { sTrigger = "g_t_trap003"; } case 3: { sTrigger = "g_t_trap004"; } case 4: { sTrigger = "g_t_trap005"; } case 5: { sTrigger = "g_t_trap006"; } case 6: { sTrigger = "g_t_trap007"; } case 7: { sTrigger = "g_t_trap008"; } case 8: { sTrigger = "g_t_trap009"; } case 9: { sTrigger = "g_t_trap010"; } case 10: { sTrigger = "g_t_trap011"; } case 11: { sTrigger = "g_t_trap012"; } default: { return; } } AssignCommand(oPerson, PlayAnimation(52)); CreateObject(OBJECT_TYPE_TRIGGER, sTrigger, GetLocation(oPerson)); } Did that work for you? I tried CreateObject() with OBJECT_TYPE_TRIGGER in that exact way and myriad others and kept coming up empty. In KotOR1, of course, not 2. Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted December 5, 2014 Share Posted December 5, 2014 Did that work for you? I tried CreateObject() with OBJECT_TYPE_TRIGGER in that exact way and myriad others and kept coming up empty. In KotOR1, of course, not 2. Might try adding DelayCommand(0.5, AssignCommand(oPerson, ActionPutDownItem(oTrap))); before the CreateObject. Link to comment Share on other sites More sharing options...
blinkyzero Posted December 5, 2014 Share Posted December 5, 2014 Still no dice. Weird. Can't get any triggers to spawn like that for some reason. Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted December 5, 2014 Share Posted December 5, 2014 Still no dice. Weird. Can't get any triggers to spawn like that for some reason. Okay, try this: Show spoiler (hidden content - requires Javascript to show) /* Name all of the mines ------------------------ 1 - Minor Flash Mine = g_i_trapkit001 2 - Average Flash Mine = g_i_trapkit002 3 - Deadly Flash Mine = g_i_trapkit003 4 - Minor Frag Mine = g_i_trapkit004 5 - Average Frag Mine = g_i_trapkit005 6 - Deadly Frag Mine = g_i_trapkit006 7 - Minor Plasma Mine = g_i_trapkit007 8 - Average Plasma Mine = g_i_trapkit008 9 - Deadly Plasma Mine = g_i_trapkit009 10 - Minor Poison Mine = g_i_trapkit010 11 - Average Poison Mine = g_i_trapkit011 12 - Deadly Poison Mine = g_i_trapkit012 Flash Mine = g_i_trapkit01* Frag Mine = g_i_trapkit02* Plasma Mine = g_i_trapkit03* Poison Mine = g_i_trapkit04* *: Named normal, but same script as the Minor version; not sure if they're placed in-game or random loot. */ void LayTrap(object oPerson, string sTraptag, int iTrapID); void main() { object oSelf = OBJECT_SELF; // If the script is launched via the person laying the trap. string sTrap; // This will be the tag of the trap. int iTrap; // This will be the index of the trap. int iHaveTraps = 0; // Boolean to check for whether the person has the trap type. int iRandom = Random(4) + 1; // The +1 part makes the number 1-4 instead of 0-3... /* Here we go into a while loop against the iHaveTraps integer. The reason being that we want to check for a random type of grenade and if oSelf has none of that type, we want to check for a new type, instead of just silently fail and nothing happen... */ while(iHaveTraps == 0) { if(iRandom == 1) { // Flash Mines // Checking strongest first. if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT003"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT003"; int iTrap = 3; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT002"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT002"; int iTrap = 2; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT001"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT001"; int iTrap = 1; } else { iRandom = Random(4) + 1; } // Run a custom function to lay the trap, if iHaveTraps == 1 if(iHaveTraps == 1) { LayTrap(oSelf, sTrap, iTrap); } } if(iRandom == 2) { // Frag Mines // Checking strongest first. if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT006"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT006"; int iTrap = 6; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT005"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT005"; int iTrap = 5; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT004"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT004"; int iTrap = 4; } else { iRandom = Random(4) + 1; } // Run a custom function to lay the trap, if iHaveTraps == 1 if(iHaveTraps == 1) { LayTrap(oSelf, sTrap, iTrap); } } if(iRandom == 3) { // Plasma Mines // Checking strongest first. if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT009"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT009"; int iTrap = 9; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT008"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT008"; int iTrap = 8; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT007"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT007"; int iTrap = 7; } else { iRandom = Random(4) + 1; } // Run a custom function to lay the trap, if iHaveTraps == 1 if(iHaveTraps == 1) { LayTrap(oSelf, sTrap, iTrap); } } if(iRandom == 4) { // Poison Mines // Checking strongest first. if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT012"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT012"; int iTrap = 12; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT011"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT011"; int iTrap = 11; } else if(GetIsObjectValid(GetItemPossessedBy(oSelf, "G_I_TRAPKIT010"))) { iHaveTraps = 1; sTrap = "G_I_TRAPKIT010"; int iTrap = 10; } else { iRandom = Random(4) + 1; } // Run a custom function to lay the trap, if iHaveTraps == 1 if(iHaveTraps == 1) { LayTrap(oSelf, sTrap, iTrap); } } } } void LayTrap(object oPerson, string sTraptag, int iTrapID) { object oTrap = GetItemPossessedBy(oPerson, sTraptag); string sTrigger; switch (iTrapID - 1) { case 0: { sTrigger = "g_t_trap001"; } case 1: { sTrigger = "g_t_trap002"; } case 2: { sTrigger = "g_t_trap003"; } case 3: { sTrigger = "g_t_trap004"; } case 4: { sTrigger = "g_t_trap005"; } case 5: { sTrigger = "g_t_trap006"; } case 6: { sTrigger = "g_t_trap007"; } case 7: { sTrigger = "g_t_trap008"; } case 8: { sTrigger = "g_t_trap009"; } case 9: { sTrigger = "g_t_trap010"; } case 10: { sTrigger = "g_t_trap011"; } case 11: { sTrigger = "g_t_trap012"; } default: { return; } } SignalEvent(oPerson, EventActivateItem(oTrap, GetLocation(oPerson))); AssignCommand(oPerson, PlayAnimation(52)); // CreateObject(OBJECT_TYPE_TRIGGER, sTrigger, GetLocation(oPerson)); } Link to comment Share on other sites More sharing options...
blinkyzero Posted December 5, 2014 Share Posted December 5, 2014 Still nothing. I tinkered around with SignalEvent() too, but same end result. CreateObject() doesn't list ITEM_TYPE_TRIGGER as a possible type in its function notes, so I'm not sure if it can even spawn them, and if the mines have their events defined anywhere, I haven't found it yet. I've been trying to make Awareness and Demolitions more useful by adding in stealthed enemies with Sneak Attack and enemies that lay mines, but so far only the former has been successful. I can't think of a point in KotOR where you see a mine get created by a script. edit: I was thinking there might be an associated talent with Demolitions that lets you use it, like there is with Stealth, but if that's the case I haven't managed to make it work yet. Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted December 5, 2014 Share Posted December 5, 2014 Still nothing. I tinkered around with SignalEvent() too, but same end result. CreateObject() doesn't list ITEM_TYPE_TRIGGER as a possible type in its function notes, so I'm not sure if it can even spawn them, and if the mines have their events defined anywhere, I haven't found it yet. I've been trying to make Awareness and Demolitions more useful by adding in stealthed enemies with Sneak Attack and enemies that lay mines, but so far only the former has been successful. I can't think of a point in KotOR where you see a mine get created by a script. edit: I was thinking there might be an associated talent with Demolitions that lets you use it, like there is with Stealth, but if that's the case I haven't managed to make it work yet. Well, I'm clueless then. When you do the TSL version, or if you let me make it for TSL, then we can use the SpawnMine function. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.