Firoas Posted February 20, 2010 Share Posted February 20, 2010 I've been messing around with the GECK, trying to make a sword that steals health from the enemy (very final fantasy I know) but so far I've had no luck. I'm also completely useless with scripting, so if anyone could just send the code (if thats what it needs), I'd be greatly appreicative. I'm also having trouble with a fleeing NPC. I'm trying to make a 'boss battle' against an NPC with very high health, but after a couple of hits he just starts running in the opposite direction, directly into a wall. Any help with this would also be fantastic. I'm sorry I've asked a lot, I really appreciate the work you guys do here.Thanks in advance. Link to comment Share on other sites More sharing options...
pkleiss Posted February 21, 2010 Share Posted February 21, 2010 For the second part, check the NPC's AI Data tab and set his confidence to foolhardy. He won't ever run away then. For the first part, make an Object effect that uses a base effect that is setup using the Script Arch-Type, then just add a line like this: SCN MyScriptEffect Ref Self Begin ScriptEffectStart Set Self to getcontainer Self.RestoreAV Health XX End Replace XX with the amount you want restored, a good value would be the amount of damage the weapon doesAnd set the following flags on the base effect: FX Persist, Touch, No Duration, No Area I think that will work. Link to comment Share on other sites More sharing options...
Firoas Posted February 21, 2010 Author Share Posted February 21, 2010 Worked a treat, thanks very much :) Link to comment Share on other sites More sharing options...
Firoas Posted February 21, 2010 Author Share Posted February 21, 2010 Actually, I've now discovered that it's giving health to the person I'm hitting (I stupidly tested the sword against a foe who also had one) anyone know how I could fix this? Link to comment Share on other sites More sharing options...
Cipscis Posted February 22, 2010 Share Posted February 22, 2010 Weapon object effects run on the target, not the wielder of the actual weapon. There is no direct way to get the refID of the weapon's wielder. There are a few indirect methods that you can use which will be accurate most of the time, but which one you should use depends on a few things. In this case, if you can guarantee that only one instance of the weapon will exist, you can use a quest variable to store the wielder's refID and access it remotely from the quest script. Better yet, if it can only be equipped by the player then you can just hard-code the script to add health to the player. If multiple instances can be used, then I'd recommend using FOSE's reference-walking and looping functions to loop through all nearby actors and check things like which weapon they have equipped, if their weapon is out, if they're facing the target etc. Cipscis Link to comment Share on other sites More sharing options...
Recommended Posts