Mythos Posted July 24, 2005 Share Posted July 24, 2005 Hi, I'm willing to lear more and more. My latest Mini-Mod shall be an implant, that enhances Mandalore's Combat implantat, increasing whatever effect he chooses from 4 to 10. (At least ) And it already works quite well (through very ugly behind the screen). But one little detail is still to bad: the script does not realise, that he unequips the implant(item), untill he switchs the implant(ability). So I'm asking straight for the simplest solution: Is there a way to have an item activate a script, when it is unequiped? ...But since the easies way is probably mined, how would this work, if there is no such posibility? I'm thinking about a script (maybe activated over a feat?), that checks every 60 (or something) seconds, if the implant(item) is still in it's place. Would something like that be possible? Link to comment Share on other sites More sharing options...
stoffe Posted July 24, 2005 Share Posted July 24, 2005 Originally posted by Mythos My latest Mini-Mod shall be an implant, that enhances Mandalore's Combat implantat, increasing whatever effect he chooses from 4 to 10. (snip) But one little detail is still to bad: the script does not realise, that he unequips the implant(item), untill he switchs the implant(ability). You mean that when your special implant is equipped, Mandalores "internal" switchable implants will get their stats boosted, right? Originally posted by Mythos So I'm asking straight for the simplest solution: Is there a way to have an item activate a script, when it is unequiped? Not directly AFAIK. They never added the OnPlayerUnequipItem event in KotOR (and even if they did it would have been more work than it's worth to use it). The only way I can think of is to check in a script if the item is no longer equipped, and then do the desired actions. Originally posted by Mythos ...But since the easies way is probably mined, how would this work, if there is no such posibility? I'm thinking about a script (maybe activated over a feat?), that checks every 60 (or something) seconds, if the implant(item) is still in it's place. Would something like that be possible? You could put that code in Mandalores user-defined heartbeat script. He runs that script once every round, so it should pick up any changes to equipped items within roughly 6 seconds. As an example I think doing something like this in the heartbeat script might work: void ClearImplantBoost() { int bBoosted = GetLocalBoolean(OBJECT_SELF, 59); object oImplant = GetItemInSlot(INVENTORY_SLOT_IMPLANT); if (!bBoosted && (GetTag(oImplant) == "SPEC_IMPLANT_TAG")) { SetLocalBoolean(OBJECT_SELF, 59, TRUE); } else if (bBoosted && (GetTag(oImplant) != "SPEC_IMPLANT_TAG")) { SetLocalBoolean(OBJECT_SELF, 59, FALSE); switch (GetGlobalNumber("CANDEROUS_CUR_IMPLANT")) { case IMPLANT_REGEN: RemoveEffectByExactMatch(OBJECT_SELF, EffectRegenerate(10, 6.0f)); ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectRegenerate(4, 6.0f), OBJECT_SELF); break; case IMPLANT_STR: RemoveEffectByExactMatch(OBJECT_SELF, EffectAbilityIncrease(ABILITY_STRENGTH, 10)); ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectAbilityIncrease(ABILITY_STRENGTH, 4), OBJECT_SELF); break; case IMPLANT_END: RemoveEffectByExactMatch(OBJECT_SELF, EffectAbilityIncrease(ABILITY_CONSTITUTION, 10)); ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectAbilityIncrease(ABILITY_CONSTITUTION, 4), OBJECT_SELF); break; case IMPLANT_AGI: RemoveEffectByExactMatch(OBJECT_SELF, EffectAbilityIncrease(ABILITY_DEXTERITY, 10)); ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectAbilityIncrease(ABILITY_DEXTERITY, 4), OBJECT_SELF); break; } } } Link to comment Share on other sites More sharing options...
Mythos Posted July 24, 2005 Author Share Posted July 24, 2005 Thanks so far (Hey, I did not know this GetTag command. Useful ). This looks like what I wanted, however, you have to explain me, how this heartbeat works. I don't get it working. First I tryed k_oei_hench_inc.nss (and complie k_oei_userdef.nss) There is the void DoMandUserDef(object oPartyMember, int pUserEvent, string sModuleName) that looked like where I had to include that check for the item. However, it did not work. I included a "SendMessageToPC" but it did not work too, not in an if, not in an else. I also looked at k_def_userdef01.nss but that heartbeat did not seem to work either. What do I do wrong??? Link to comment Share on other sites More sharing options...
stoffe Posted July 24, 2005 Share Posted July 24, 2005 Originally posted by Mythos First I tryed k_oei_hench_inc.nss (and complie k_oei_userdef.nss) There is the void DoMandUserDef(object oPartyMember, int pUserEvent, string sModuleName) that looked like where I had to include that check for the item. However, it did not work. I included a "SendMessageToPC" but it did not work too, not in an if, not in an else. I also looked at k_def_userdef01.nss but that heartbeat did not seem to work either. What do I do wrong??? Have you activated the user-defined heartbeat for Mandalore? I don't think it's active for him by default. Look for the DoMandSpawnIn() function in k_oei_hench_inc.nss and add... AssignCommand(oPartyMember,GN_SetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )); ...where the comments say "default spawn in". Then, in the DoMandUserDef() function, add your code with a conditional check if the user-defined event number in the pUserEvent parameter is 1001, which is used for heartbeats. Link to comment Share on other sites More sharing options...
Mythos Posted July 24, 2005 Author Share Posted July 24, 2005 It wooooorks! I still had some problems and I can't really say, what made it working in the end but now it works. 1001 thanks, stoffe, may the force be with you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.