Kryyss Posted March 21, 2016 Share Posted March 21, 2016 Hi again all. I finally got PlaceAtMe working properly and wanted to tweak it so that items are not spawning directly under the actor being targeted. However, I'm running across an unusual issue. Here's the script: Ref rMyTarget Float fPosX Float fPosY Float fPosZ Ref rSpawned Int iSpawnRdy Begin OnFire Let rMyTarget := Player.GetCombatTarget if rMyTarget.IsActor Let rSpawned := rMyTarget.PlaceAtMe TXRDebugItem 1 0 0 endif ; Ref Valid? Ready... if IsReference rSpawned Let fPosX := rMyTarget.GetPos X Let fPosY := rMyTarget.GetPos Y + 50 Let fPosZ := rMyTarget.GetPos Z + 200 Let iSpawnRdy := 1 endif ; Go! if iSpawnRdy == 1 rSpawned.SetPos X fPosX rSpawned.SetPos Y fPosY rSpawned.SetPos Z fPosZ ShowMessage TXRDebug00 else ShowMessage TXRDebug01 endif ShowMessage TXRDebug02 fPosX fPosY fPosZ ;rSpawned.Disable ;rSpawned.MarkForDelete End I've put in some debugging messages to see what parts of the script were executing. That is why I'm now confused. According to the Debug02 message, the GetPos are working fine and storing the actor's location without any issues. Also the Debug00 is displaying so I know that the SetPos parts are also running. This script is being tested on a weapon and what makes no sense is that the item created by PlaceAtMe is only relocated by SetPos on the first time the weapon is used on an actor. From that point on the item created is always placed at the actors feet. Does anyone have any idea please why the SetPos is running each time thw weapon is fired. but only the first item being placed is in the correct position? Link to comment Share on other sites More sharing options...
Kryyss Posted March 21, 2016 Author Share Posted March 21, 2016 (edited) Additionally. I've also found that MoveTo only works once as well. So basically, I have no idea what is going on here. Any insight would be greatly appreciated. (Updated)Just putting this here should anyone else run into similar problems when it comes to placing items using weapons. After looking through the NV scripts I finally figured out how PlaceAtReticle functions. If you are familiar with the Euclid C-Finder you'll know where I'm coming from with this. All info on this function is almost zero on the internet so hopefully Google may pick up this topic in future. PlaceAtReticle does exactly what it says on the tin. Like PlaceAtMe it puts the item mentioned where you are currently looking. However unlike PlaceAtMe which depreciated the distance functions, PlaceAtReticle did not. In Short it works like this. Set rTempRef to Player.PlaceAtReticle [youritem] [quantity] [minimum distance] [maximum distance] So for example, if you wanted to have a melee weapon place an explosion at exactly the point where you are striking an actor, you'd have something like: Set rTempRef to Player.PlaceAtReticle ElectricBoxExplosion 1 0 20 This would mean that if you were swinging at the actor from a distance outside of 20 units from the player, you'd not cause any explosions. Of course you could put further checks in here to prevent that but essentially this PlaceAtReticle allows you to set the min and max range for the item to appear. This was basically the same functionality I was trying to achieve with the MoveTo/SetPos but does it in a far more simple way. The only drawback is that it probably doesn't work for NPCs, but only further testing will tell with regards to that. Probably it will not. NVSE really needs more ways to place items, get RefIDs and positional data. Edited March 21, 2016 by Kryyss Link to comment Share on other sites More sharing options...
vforvic Posted March 24, 2016 Share Posted March 24, 2016 Just wanted to say thanks and a kudo for you for explaining this and not just saying something generic like never mind I figured it out. This always helps when people search later for the same or similar issues. Link to comment Share on other sites More sharing options...
Recommended Posts