Jump to content

Problems With Activator


ModderIsLife

Recommended Posts

I am having problems with an activator, if I use placeAtMe, the object is sunk in the ground, to try to solve it, I have tried with this code but it does not work, the object is still sunk in the ground.

 

Scn ExampleActivatorLoadScript

 

ref placedObject

 

float position

 

Begin ScriptEffectStart

 

Player.PlaceAtMe ExampleActivator 1

 

set placedObject to Player.PlaceAtMe ExampleActivator 1

 

set position to (Player.getpos z) + 30

 

placedObject.setpos z position

 

End

 

Begin ScriptEffectFinish

Player.AddItem ExampleActivatorIngestible 1

 

End

 

If I create the object, hide it, and simply move it whenever I want, with the movetoplayer function, it inexplicably stops being interactive.

 

Regardless of how ugly the object is half sunk in the ground, it is not what worries me the most, part of it stands out and being the lesser evil, you can still use it, the problem is that as the code above does not work for To identify the object, I can not use the function disable and MarkForDelete, since my mod would create many of these objects and I do not want to have hundreds of objects created in the game.

 

I hope someone can help me out.

 

Thank you.

Link to comment
Share on other sites

Well for starters ... you don't want to run all that code behind "PlaceAtMe"

 

The item needs a few frames before it is stable enough to manipulate with code.

 

But beyond that , for every step in your script ... you could use a stop gate variable.

like this ...

 

Int stage

 

Begin ScriptEffectStart

 

If stage == 0
Player.PlaceAtMe ExampleActivator 1

Set stage to 1

If Stage == 1

set placedObject to Player.PlaceAtMe ExampleActivator 1

Set stage to 2

If Stage == 2

set position to (Player.getpos z) + 30

Set stage to 3

If Stage == 3

placedObject.setpos z position

set Stage to 4

endif

endif

endif

endif

 

End

~~~~~~~~~~~~~~~~~~~~~~

 

Then the code wont hit all at once , but cascade as the stop gate variable becomes true.

 

Also using script effect block might not work for this situation. Inwhich case , just use GameMode. But then of course you need attatch the script somewhere else.

Link to comment
Share on other sites

OH WAIT! I can't believe I missed it.

 

Change "Begin ScriptEffectStart" To "Begin ScriptEffectUpdate"

 

ScriptEffectStart is a one time read on the code ... it is the same as "Begin OnActivate"

 

Not that it will for surely fix it ... but you should definitely try it with a continuous read block.

Then we can go from there to fix it.

Link to comment
Share on other sites

Thanks Mktavish, but it does not work, I think the problem is not the structure of the code, but the conflict generated by the functions setpos and placeAtMe, since the first specifies exact coordinates and the second creates something exactly in the player's position, so As much as I put setpos, it will always create the object where the player.

Do you know how I can achieve that if I create the object physically and only move it, do not lose interactivity ?, is that moving it instead of creating it, it is perfect height, but of course, it can not be used anymore.

Link to comment
Share on other sites

For GamerRick: Thanks, if I understand you correctly, you have to deactivate it before declaring the setpos, I've tried it in these 4 ways, to try all the forms ...

 

Player.PlaceAtMe ExampleActivator 1

 

set placedObject to Player.PlaceAtMe ExampleActivator 1

 

placedObject.disable

 

set Position to (Player.getpos z) + 30

 

placedObject.setpos z Position

 

placedobject.enable

 

End

 

The activator is physically created but with the "Initially Disabled" option checked ...

 

set placedObject to ExampleActivator1

 

set Position to (Player.getpos z) + 30

 

placedObject.setpos z Position

 

placedobject.enable

 

End

 

Same as above, unlike the first line ...

 

ExampleActivator1.moveTo Player

 

set placedObject to ExampleActivator1

 

set Position to (Player.getpos z) + 30

 

placedObject.setpos z Position

 

placedobject.enable

 

End

 

The object created physically and activated ...

 

ExampleActivator1.disable

 

set placedObject to ExampleActivator1

 

set Position to (Player.getpos z) + 30

 

placedObject.setpos z Position

 

placedobject.enable

 

End

 

None works ... there is no way that the object appears before me without being sunk in the ground, I think that although visually it looks bad, I will end up leaving it like that, always stands out a part, it can be used perfectly without complications and not It affects your behavior, it's just an aesthetic question, and the mod I'm creating is too big to keep wasting timeÃÂ with this...

 

 

 

EDIT:

 

In the end I added the code I had for the activator, to a new option that I added to the pipboy, because if you found enemies, you could not stop trying to activate a half-buried object on the ground, thanks to Mktavish and GamerRick for trying help me.

 

Greetings.

Edited by ModderIsLife
Link to comment
Share on other sites

For Mktavish:

 

Sorry, I did not think anyone else would answer in the thread.

Yes, indeed, then I checked and if the nif was broken, but even if it had not been, it is impossible to erase things created with placeAtMe and then the game would be filled with objects and hang up.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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