m16965 Posted February 26, 2007 Share Posted February 26, 2007 I was just wondering is there stealth script for the game. I have looked in many game scripts, "a_belt_03"(the steath generator) and Spells.2da. For the game scripts I couldn't find any that had an effect and in nwscript.nss it dosent appear to have a "Effect stealth()" function. In the stealth belt it simply didn't return any properties to run the stealth function. The spells.2da has had close things, but not quite the effect. If there is a script or effect, please would someone point me in the right direction? If not is it hardcoded or put into the games memory itself? Thanks ~Mando Link to comment Share on other sites More sharing options...
jimbo32 Posted February 26, 2007 Share Posted February 26, 2007 I believe that all the stealth belts do is make the stealth icon available for the character (and add a bonus if applicable). The actual ability itself is probably hard-coded, although I'm just guessing. Even the "Force Camouflage" power doesn't actually do anything IIRC. Juhani has a stealth belt hidden in her "hide" slot. Link to comment Share on other sites More sharing options...
stoffe Posted February 26, 2007 Share Posted February 26, 2007 I was just wondering is there stealth script for the game. For the game scripts I couldn't find any that had an effect and in nwscript.nss it dosent appear to have a "Effect stealth()" function. In the stealth belt it simply didn't return any properties to run the stealth function. The Stealth Mode enabled by the stealth belts is not a scripted effect or an item property, it's a game engine mechanic. The game checks if the character has an item of base item type 88 equipped, and if so allows use of stealth mode. (In TSL there are a few feats that do the same as the belt). What kind of stealth script do you need? If you want one that makes an NPC activate stealth mode you could use something like this: void ST_EnableStealthMode(object oActor) { talent tStealth = TalentSkill(SKILL_STEALTH); DelayCommand(0.1, AssignCommand(oActor, ClearAllActions())); DelayCommand(0.2, AssignCommand(oActor, ActionUseTalentOnObject(tStealth, oActor))); } void main() { object oNPC = GetObjectByTag("[color=Yellow]NPCTOHIDE[/color]"); ST_EnableStealthMode(oNPC); } Change NPCTOHIDE in the script above to the tag of the NPC who should sneak. Make sure that the NPC is equipped with a Stealth Belt and have Skill points in the Stealth Skill, or it won't work. Also keep in mind that the same Stealth rules apply to NPCs as the player. I.e. they can only walk while in stealth mode (unless they know the Stealth Run feat), and they will be taken out of stealth mode if they take a hostile action. Link to comment Share on other sites More sharing options...
glovemaster Posted February 27, 2007 Share Posted February 27, 2007 If you wanted to activate stealth without a stealth field generator (like in a force power) you might need a script to temporaraly award stealth points: //set the amount of stealth points to award: effect eStealth = EffectAbilityIncrease(ABILITY_STEALTH, [b][Amount to increase, eg. 10][/b]); //Award the stealth points: ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eStealth, OBJECT_SELF, [b][Duration to apply the points in seconds, eg. 60][/b]); The script above should work, at the moment i don't have the NWscript to check the ABILITY_STEALTH and other references, i'll edit this post when i can. Link to comment Share on other sites More sharing options...
stoffe Posted February 27, 2007 Share Posted February 27, 2007 If you wanted to activate stealth without a stealth field generator (like in a force power) you might need a script to temporaraly award stealth points: //set the amount of stealth points to award: effect eStealth = EffectAbilityIncrease(ABILITY_STEALTH, [b][Amount to increase, eg. 10][/b]); //Award the stealth points: ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eStealth, OBJECT_SELF, [b][Duration to apply the points in seconds, eg. 60][/b]); The script above should work, at the moment i don't have the NWscript to check the ABILITY_STEALTH and other references, i'll edit this post when i can. Stealth is not an ability (Str/Dex/Con/Int/Wis/Cha are abilities), it's a Skill. Simply granting temporary skill points will not make a character use stealth, since this skill is only used to determine how effective a character is in Stealth mode (which you need either a Stealth Belt or one of the Force Camouflage feats in TSL to use). Further, if a character has no ranks in a skill I don't think it can be increased above 0 via an effect or item property (at least that's how it works in NWN). If the character already have some skill ranks in stealth though you can boost it further up that way. At any rate you should use EffectSkillIncrease() instead if you want to grant temporary skill bonuses. The Stealth skill of a character in stealth mode is compared against the Awareness skill of all characters in perception range to determine if they see through the Stealth and spot the sneaky character. * * * While Stealth can't be scripted other than activating Stealth Mode, you can apply invisibility via scripts. If you want to use full Invisibility rather than stealth you can do as in the below example as well. Keep in mind that Invisibility is much more potent though since the character can't be detected at all no matter what, and scripts that check for Stealth Mode won't catch it (so it has the potential to break dialogs if any NPC or PC involved is invisible when the conversation starts). Like Stealth Mode normal invisibility will also expire if you attack someone: void main() { object oNPC = GetObjectByTag("[color=Yellow]TagofNPCtoHide[/color]"); effect eInvis = EffectLinkEffects( EffectInvisibility(INVISIBILITY_TYPE_NORMAL), EffectVisualEffect(8000)); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eInvis, oNPC); } Link to comment Share on other sites More sharing options...
glovemaster Posted February 27, 2007 Share Posted February 27, 2007 Yes, sorry about that. I did mention my references were probably wrong as i normally refer to KotORs NWscript (which at the time i didn't have) so i apologise... well you've covered it and i was only tagging that bit of script onto the one you made above the post... (My scripting abilitys are not the best... I just like to help! ) Link to comment Share on other sites More sharing options...
m16965 Posted February 27, 2007 Author Share Posted February 27, 2007 Thanks STOFFE worked perfectly as usual! Not to worry Glovemaster, I already have that one from Hangout Hermit. Link to comment Share on other sites More sharing options...
glovemaster Posted February 27, 2007 Share Posted February 27, 2007 lol, no worries then. Glad you got it workin! Link to comment Share on other sites More sharing options...
deathdisco Posted February 27, 2007 Share Posted February 27, 2007 Further, if a character has no ranks in a skill I don't think it can be increased above 0 via an effect or item property (at least that's how it works in NWN). That is correct, this is also true in K1/TSL. Link to comment Share on other sites More sharing options...
m16965 Posted March 1, 2007 Author Share Posted March 1, 2007 Does anyone know the spell to deactivate the stealth script? Thanks ~Mando Link to comment Share on other sites More sharing options...
stoffe Posted March 1, 2007 Share Posted March 1, 2007 Does anyone know the spell to deactivate the stealth script? I'm not sure I understand what you mean? You can't deactivate a script since they only run for a fraction of a second, and not continually. Link to comment Share on other sites More sharing options...
Det. Bart Lasiter Posted March 1, 2007 Share Posted March 1, 2007 Does anyone know the spell to deactivate the stealth script? Thanks ~Mando If you mean remove the stealth effect, this might work (I haven't posted in this forum in ages, let alone written a script for KotOR). void main(){ object oNpc=GetObjectByTag("npc_tag"); effect eInvis=EffectLinkEffects(EffectInvisibility( INVISIBILITY_TYPE_NORMAL ), EffectVisualEffect(8000)); RemoveEffect(oNpc,eInvis); } Link to comment Share on other sites More sharing options...
stoffe Posted March 2, 2007 Share Posted March 2, 2007 If you mean remove the stealth effect, this might work (I haven't posted in this forum in ages, let alone written a script for KotOR). void main(){ object oNpc=GetObjectByTag("npc_tag"); effect eInvis=EffectLinkEffects(EffectInvisibility( INVISIBILITY_TYPE_NORMAL ), EffectVisualEffect(8000)); RemoveEffect(oNpc,eInvis); } This script would not do anything, since you don't remove the invisibility effect that is present on the NPC. You create a new effect, which you don't apply to anything, and then try to remove it. You'll have to find the effect to remove on the NPC, and remove that one instead. This can be done by looping through the effects applied to the NPC and checking their type, like: void ST_RemoveEffectByType(int nEffectType, object oTarget=OBJECT_SELF) { effect eEff = GetFirstEffect(oTarget); while (GetIsEffectValid(eEff)) { if (GetEffectType(eEff) == nEffectType) { RemoveEffect(oTarget, eEff); eEff = GetFirstEffect(oTarget); } else { eEff = GetNextEffect(oTarget); } } } void main() { object oNPC = GetObjectByTag("npc_tag"); ST_RemoveEffectByType(EFFECT_TYPE_INVISIBILITY, oNPC); } You only need to look for and remove the Invisibility effect, since the visual effect is linked to it. When one effect that's part of a link expires or is removed all the other linked effects will get removed as well. This will only work if you use scripted invisibility instead of Stealth Mode though, since stealth isn't an effect but a game mechanic. The character will automatically exit stealth mode if they take any hostile action or initiates dialog (just like for players), but I don't know if there is a way to otherwise deactivate stealth mode from scripts. Link to comment Share on other sites More sharing options...
m16965 Posted March 2, 2007 Author Share Posted March 2, 2007 Brilliant Stoffe! Worked perfectly! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.