belowturistas Posted December 26, 2016 Share Posted December 26, 2016 Hi! I've looked all over and I'm not seeing this. there's a few -almost- there things, and i know it has to be easy. I want to run commands on NPCs when hit with a custom dart. not just the pre-defined effects like poison. I've tried OnHitWith to fire scripts, too, and that's a fail. I also tried making a basic effect and an enchantment, then doing StartEffectScript against it as well. wtf lol Link to comment Share on other sites More sharing options...
belowturistas Posted December 26, 2016 Author Share Posted December 26, 2016 hrm well I've tried a kind of dirty solution, but it's really not suitable. on GetAnimAction shooting the gun, do player.GetCombatTarget since the reticle is obviously still on the target. only catch is it's not efficient. distance is obviously an issue since you need to be pretty much on top of the target. i'm surprised there's not a straight-forward method (documented) to get the id of last actor damaged, or rather, match the last shot fired from your weapon and return the recipient's ID. obviously the engine gets the base/ref ID naturally to apply damage and results, so i'm sure there's a way to tap into it. gotta keep looking! Link to comment Share on other sites More sharing options...
Mktavish Posted December 27, 2016 Share Posted December 27, 2016 The start block in using an effect type script is ... "Begin ScriptEffectStart" And the way I have used it to get the ref-id of what is struck with the weapons projectile , when placing a base effect that is a script archetype , on the weapon as an object effect. Is a script that looks like this ... SCN MyAmmoEffectScript Ref rTarget Begin ScriptEffectStart Set rTarget to Player.GetCombatTarget ; sets the ref variable to what the player's combat target is when bullet hits ; now do what you want with that ref variable End ~~~~~~~~~~~~~~~~~~~ However like you noticed ... the "GetCombatTarget" is not always reliable ... I have even had problems with a shotgun type weapon in fairly close range ... but there also may be something happening with how the script effect gets started by whether or not the target took damage. The wiki seems to have conflicting info on "ScriptEffectStart" with regard to that. However ... not sure though. But it would seem "GetSelf" might return the ref-id of who gets struck ... therefore getting rid of the distance factor coming into play that "GetCombatTarget" seems to have.So an Effect type script that looks like this ... ~~~~~~~~~~~~~~~~~~~~~~~~~ SCN MyAmmoEffectScript Ref rSelf Begin ScriptEffectStart Set rSelf to GetSelf ; hopefully sets the ref variable to what ever gets struck by the projectile ; now do what ever with "rSelf" End ~~~~~~~~~~~~~~~~~~~~~~ And as a curious mention ... what are you trying to do with their Ref-ID anyways ? There may be a way around needing to get it in accomplishing your end result. Link to comment Share on other sites More sharing options...
belowturistas Posted December 30, 2016 Author Share Posted December 30, 2016 I'm at work atm and will check GetSelf as soon as I can! thanks for the response, sorry for the delay, life and all that... I tried to use ScriptEffectStart to resolve the problem as well, because that's just nifty, but the issue with that was it wasn't clear how to associate a custom script to a weapon. there's built-in effects, but if you make an enchantment, select Script Effect, there's no clear method to actually associate the script with the enchant. here's how it was attempted: Weapon: Object Effect set to EnchantmentEnchantment: Set to Script Effect (no clear way to associate with script)Script (type: effect) --------------------------------------------scn DartGunBoomScriptEffectref npcToBoomfloat timer ;unused atmint isActive ;unused atmbegin ScriptEffectStart showmessage testMessageend -------------------------------------------- the message never shows, so I believe the effect is never fired. I tried other tests as well.(btw the term "boom" used is just playful naming....I've already successfully made various associated explosions, that's a simple task) another method I tried (which worked well for making grenades with scripted properties) was to make a small harmless explosion, then [set npcToBoom to GetRefFirst 81], which pretty much does the same.I could probably try another unique effect and get that ref as well, but i haven't found one suitable. lights, for example, are everywhere. this worked perfectly for the custom grenade (haha that's all I'll say on that! i want the effects to be a surprise. thanks for the help getting started and even now, for sure!). ------------------------------------------------------------------------------------------------- what am i trying to do with ref-id: Working on a kind of sandbox fun-times mod with a lot of different stupid effects. there's no concrete effect I want, because the more I've been testing and reading, the more fun stuff I've come up with.I mean, we NEED to have a weapon that transports people a few hundred meters in the air and then drops them, then brings them back to life all limbs crippled, or strips off all of their clothes and causes them to flee. and then maybe use that actors refid to get other actor refids in the cell and have them pelt rotten fruit while saying random things. so many things to do directly to an actor ::drools:: I have a tendency to run around in games finding creative ways to kill (or just mess with) everyone, and always found myself thinking "man, i wish i could do X..."so why not? have plans to do similar mods for the newer and future Bethesda games as well, so FO3 is my starting point (spent hours in there running around tossing mines, training NPCs into caravans...this mod is a vision coming to fruition haha)rofl just stand on the balcony arcing grenades down onto confessor cromwell... *ahem* anyways so yeah getting an exact reference to an actor/object is crucial haha ^_^ STILL AMAZED you can't get lastDamagedByPlayer or actor.lastdamaged! i mean, you know it gets it anyways >_< huh maybe there's a way to extend FOSE. ::looks down into the rabbit hole:: Link to comment Share on other sites More sharing options...
Mktavish Posted December 30, 2016 Share Posted December 30, 2016 I tried to use ScriptEffectStart to resolve the problem as well, because that's just nifty, but the issue with that was it wasn't clear how to associate a custom script to a weapon. there's built-in effects, but if you make an enchantment, select Script Effect, there's no clear method to actually associate the script with the enchant. On the Base Effect screen ... you select "Script" in the drop down of "Effect Archetype"And just below that is another drop down "Assoc Item" Which is where you are able to scroll through all the scripts which are labeled "Effect" in their header drop down. So if your script is not an "Effect" script ... it will not show in that list. You also need to flag the base effect correctly depending on what it does. Self,touch,target are a good bet is needed.And I like to flag it with "Display Name Only" That way ... what I name the effect , is what will show on the object effect and subsequently on the weapon with that enchantment. You also in most cases want to flag it as no magnitudeAnd maybe no duration depending on what you are doing. But anyways you then make an object effect , that then uses your script archetype base effect ... and put your object effect (enchanment) on a weapon. And I'm thinking maybe you want to have this "ScriptEffectStart" block add packages to the Ref-ID it returns ???Not really sure ... I think you may end up doing various methods to achieve end results. Link to comment Share on other sites More sharing options...
belowturistas Posted December 30, 2016 Author Share Posted December 30, 2016 (edited) added those flags, the rest was set up similarly (i forgot to mention i did make the base effect..) Ok i've attached my setup. do you see any reason that this shouldn't fire the script when target is hit? I know i'm doing something simple wrong lol as far as i can tell when target is hit it should simply display testMessage.I'm concerned about Enchant having "touch", but that's the only option it gives aside from apparel, and I assume it means "if object touches" the message is set up correctly, to mention. I used it a great deal when I first started. *sigh* ok tried to do an inline image, keep getting You are not allowed to use that image extension on this community. tried jpg and png. i'll just attach it. EDIT: ok it showed it when i told it to add to post hah that works ^_^ Edited December 30, 2016 by belowturistas Link to comment Share on other sites More sharing options...
Mktavish Posted December 30, 2016 Share Posted December 30, 2016 (edited) It looks like you selected the generic base effect , that is a script archetype , instead of your custom base effect. Are you sure you got the right one ... lose the Script Effect in its name to be sure. And you shouldn't be seeing anything for Area nor Duration .Plus get rid of the hostile flag. Edited December 30, 2016 by Mktavish Link to comment Share on other sites More sharing options...
Recommended Posts