NaboeN Posted May 1, 2009 Share Posted May 1, 2009 Uh, check the "Playable" flag if it's there? I know it's on ammo and weapons, haven't fiddled around with keyes yet Link to comment Share on other sites More sharing options...
TGBlank Posted May 1, 2009 Share Posted May 1, 2009 I'm trying to get a weapon to have a chance of making the hit enemy join, my faction and stop attacking. When I couldn't get that working I tried making the character have a 10% chance of casting a spell that does the same thing. Neither seem to work, at all. Ideas? Spellyada yada yada BEGIN OnHit <----- This is your problem more yada yada yada OnHit runs on NPCs and perhaps some objects, it runs when the object is hit.If you want to add the effect to a weapon, add an object effect (either as enchantment or on critical), that haves a base effect, that is your script. The script should use a "scripteffectstart" block CharacterSCN JesusScript ;Follower Variables short HasBeenHired short WeaponOut short CombatStyleRanged short CombatStyleMelee short IsFollowingDefault short IsFollowingLong short IsFollowingShort short Waiting short PlayerTeamate ;Cast Convert Var's float Timer short iRandom ref Target BEGIN GameMode set iRandom to GetRandomPercent if (JesusREF.IsInCombat == 1) if(iRandom < 10) set Target to GetCombattarget cast JesusConvert Target endif endif END Cast doesn't work. Use:Target.Castimmediateonself JesusConvertInstead.Ofc, this will give no animation whatsoever for jesus' casting The effect haves to be an actor effect with self range btw. Another problem.I need a Perk to add a "Button Press Listener" to the player, either by a spell, item or however. I can't figure out how to do this. Every way I have tried pressing the button does nothing. :wallbash: You don't really need a perk for this, in fact, avoid using perks at all unless strictly necessary. They make your mod crash people's games when they remove it. If you do use perks, offer a method of uninstall that removes the perks from the player. "Button Press Listener" is made with FOSE and a gamemode or scripteffectupdate block, in either an object, actor effect or quest.short doonce Begin GameMode If (IsKeyPressed == <key's scan code>) if (doonce) Return endif Set doonce to 1 <do stuff when you press the key> Else set doonce to 0 Endif End Link to comment Share on other sites More sharing options...
thefourwings Posted May 2, 2009 Share Posted May 2, 2009 Uh, check the "Playable" flag if it's there? I know it's on ammo and weapons, haven't fiddled around with keyes yet Works for ammo, but no 'playable' flag on keys... Link to comment Share on other sites More sharing options...
Holty07 Posted May 2, 2009 Share Posted May 2, 2009 Thanks heaps Blank. I got the converter to work now for the Night Vision. Link to comment Share on other sites More sharing options...
TGBlank Posted May 2, 2009 Share Posted May 2, 2009 Works for ammo, but no 'playable' flag on keys...Then fake the key. Script the door so it only opens if you're carrying a certain (non-playable) item, or a quest variable is set. Link to comment Share on other sites More sharing options...
Cipscis Posted May 2, 2009 Author Share Posted May 2, 2009 Alternately, you could script the NPC so that, when the player activates them, the key is removed from their inventory. You could then add it back again afterwards in one of a few ways. I would recommend that, when you remove the key, add a token (an unplayable, therefore invisible, piece of armour) to the NPC that is scripted to add the key and remove itself as soon as GameMode is resumed. Of course, this approach would only work on a specific actor. Since the idea of a "button press listener" has been brought up, I think I'll share mine, as it's a little more compact that TGBlank's, although the concept is the same. Using the "N" key as an example:int iIsNPressed Begin GameMode if iIsNPressed != IsKeyPressed 49 ; N set iIsNPressed to iIsNPressed == 0 if iIsNPressed ; Code placed here will run when "N" is pressed else ; Code placed here will run when "N" is released endif endif End Cipscis Link to comment Share on other sites More sharing options...
Holty07 Posted May 2, 2009 Share Posted May 2, 2009 Argh. This Night Vision thing is really annoying me. Basically I want a perk to add the ability of NightVision to my player. This ability uses the NightVisionEff. NightVisionEff use NightVisionScript. Here is NightVisionScript:SCN NightVisionScript short NVOn short DoOnce BEGIN ScriptEffectStart ShowMessage NightVisionAdd END BEGIN ScriptEffectUpdate if (Player.HasPerk NightVision == 1) If (IsKeyPressed 49) if (doonce) Return endif Set doonce to 1 if (NVOn == 0) imod NightVisionSFX set NVOn to 1 showMessage NightVisionOn elseif (NVOn == 1) rimod NightVisionSFX set NVOn to 0 showMessage NightVisionOff endif Else set doonce to 0 Endif Endif End When adding the perk to my player, nothing happens. Where have I gone wrong? Link to comment Share on other sites More sharing options...
TGBlank Posted May 2, 2009 Share Posted May 2, 2009 hmm...SCN NightVisionScript short NVOn short DoOnce BEGIN ScriptEffectStart Printc "Effect added" END BEGIN ScriptEffectUpdate If (IsKeyPressed 49) if (doonce) Return endif printc "N pressed" Set doonce to 1 if (NVOn == 0) imod NightVisionSFX set NVOn to 1 Printc "should be on" else rimod NightVisionSFX set NVOn to 0 Printc "should turn off" endif Else set doonce to 0 printc "N released" Endif End (1) Try with this one. Add the perk, then open the console, see if any text appeared. If "Effect added" doesn't appear, you're failing at adding the effect to the player.If it does appear, close console and press n for a second, then release it. If you got your imod running, do the polka dance. If not, open the console and see if any new lines where added, if they where, post them here. Link to comment Share on other sites More sharing options...
Holty07 Posted May 2, 2009 Share Posted May 2, 2009 Nevermind. I've got it all sorted. The Actor Effect wasn't set as an ability which it needed to be. :o All sorted now! My Night Vision Perk is complete. Link to comment Share on other sites More sharing options...
thefourwings Posted May 2, 2009 Share Posted May 2, 2009 Works for ammo, but no 'playable' flag on keys...Then fake the key. Script the door so it only opens if you're carrying a certain (non-playable) item, or a quest variable is set. Simple, but effective. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts