Jump to content

A problem with PlaceAtMe in packages


anlashok

Recommended Posts

(I'm still not sure if I should post these kind of general scripting problems to Modification Troubleshooting or General Modification Talk)

 

I have a travel package that has a script in onend block that is supposed to place an item to feet of the npc running the package using "placeatme itemname 1, 0, 0". However, nothing gets placed. If I change that to "player.placeatme itemname 1, 0, 0" the item gets placed to the feet of the player as expected. The other reference function calls in the onend block work, so I am clueless about what's wrong with placeatme. I also tried changing the direction and distance parameters of placeatme to something else, but it didn't change anything.

 

Thank you if you can help. I promise to consider starting making preparations to create a draft of WIP topic when this issue is resolved.

 

 

Edit:

I tried giving the test NPC a reference editor id and using [ref ed id].placeatme in the script, but it still didn't spawn anything.

 

Edit2:

Okay, this is really weird. I changed nothing in the npc running the package or the package itself, but added some navmeshes to the same cell but away from the npc (the route he is going is navmeshed) and added another npc to the same cell. Now when he first got to the designated travel target, the item spawned! Then he went to other place and reacquired the same package (it is repeating), but nothing spawned this time. After that I picked up the item lying in ground thinking it might somehow prevent him from spawning another, but it didn't help.

 

Edit3:

Another test. He spawned the item twice and then none. After second no-spawnings I picked the items up but not totally unexpectedly it didn't help.

Link to comment
Share on other sites

Now I am really confused. I changed the placed item to bigger one, and more importantly, one that gives a clank when it hits the ground. The item actually appeared this time, but to my surprise, at a position not related to the npc running the package in any way. The location was the cell's COC marker and when I moved the marker the location of the spawned items changed too. I though about this for some time and remembered I duplicated the actor and replaced the duplicate with COC marker, which might with some really perverse logic cause this.

 

I deleted the marker and duplicated it from a floor tile. Nothing changed. The marker was in a different place like it was supposed to be, but the items still appeared in it's location. I tried also explicit ref self; set self to getself; self.placeatme item, 1, 0, 0; but it made no difference. Then I changed the 0's to 150 and 1 (which probably should place the item 150 units behind the npc). Now the first spawned item was placed at the npc's exact position(???) and the rest were placed at the COC marker. Does anyone else think this is some crazy feces? And more importantly, does anyone have any guesses what might be causing this and more importantly, how to get this to work. I am running all three DLC's and no mods.

 

Edit:

I also did the most obvious thing to do and deleted the npc reference and created a new one. He spawned four items to his feet (and not 150 units behind him), after which I went and picked them up and this caused him to spawn the next item to COC marker.

Link to comment
Share on other sites

placeatme places the item wherever it sees fit... the distance and direction setting is only viable if you are on a plane which is absolutely planar/flat... as everytime it ends up in midair or inside another object it gets placed somewhere else, usually at the reference's feet to which the direction and distance values are called at

 

maybe turn the spawned item into a reference (see wiki for the code i forgot the exact spelling) and then "moveto" that reference to where you want

Link to comment
Share on other sites

I really don't want to accept that this is impossible to get to work. If it is I have to do some really ugly container-using script which is not nearly as nice as this would be. It would even be helpful if someone could confirm they are getting the same kind of odd behavior. Just create two markers and set a npc to have two travel packages, one to each. Add to the onend block of one lines additem mytoken 1 and placeatme itemofyourchoice 1 0 0 and to the onend block of the another removeitem mytoken 1. Then set the conditions so that the package in which the token is added has getitemcount mytoken < 1 and the other has condition getitemcount mytoken > 0.

 

Now when the npc is travelling between the two markers see if it spawns items to it's feet when it reaches one of the markers. Be sure to wait at least 5 spawnings. Then report your observations to me :) Thanks to anyone willing to do this.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...