Jump to content

[Script] Activator activating Activator problem


Recommended Posts

I have a hard time getting an Activator passed as user activating another Activator.

 

This page suggests that it should be possible:

https://cs.elderscrolls.com/index.php?title=Activator

 

Here is a line that I'm trying to use.

ECTCompanionNonCombatOrderExecution.Activate ECTCompanionController01 1

- It is being called from ScriptEffectStart block of a self-cast spell.

- I am 100% sure that both ECTCompanionNonCombatOrderExecution and ECTCompanionController01 are persistent references.

- ECTCompanionController01 in it's OnActivate does nothing else, other than printing a debug console message.

- The code line works if I replace ECTCompanionController01 with Player.

 

Is there something I'm missing/misunderstanding about Activators?

 

 

Here is the complete code that I'm trying to use:

scn ECTCompanionCombatOrderMenu01Script

ref companionController

Begin ScriptEffectStart

	;// Works - OnActivate is executed.	
	ECTCompanionNonCombatOrderExecution.Activate Player, 1

	;// Doesnt work - nothing happens.
	; set companionController to ECTCompanionController01
	; ECTCompanionNonCombatOrderExecution.Activate companionController, 1
End

Edited by Eillis
Link to comment
Share on other sites

You can't activate something unless it is in the same cell as the player. Object scripts must be in the same cell (or whatever it would be in the exterior world), to run.

 

So, if you have two activators that you have given RefIDs Activator1Ref and Activator2Ref, to activate Activator2Ref from the other script, you would use:

ref rSelf 

......
set rSelf to GetSelf
Activator2Ref.activate rSelf 1

(You can use another RefID if you want:
Activator2Ref.activate SomeOtherRef 1

Also, take a look at the vanilla script used by Activator ARWallSwitch01. It shows how to daisy-chain scripts. A good example of where a button triggers one wall, which triggers the next, and so on.

Edited by GamerRick
Link to comment
Share on other sites

 

You can't activate something unless it is in the same cell as the player. Object scripts must be in the same cell (or whatever it would be in the exterior world), to run.

 

So, if you have two activators that you have given RefIDs Activator1Ref and Activator2Ref, to activate Activator2Ref from the other script, you would use:

ref rSelf 

......
set rSelf to GetSelf
Activator2Ref.activate rSelf 1

Oh. So persistent activators need to be in the same cell as player as well?

This would mean that I need to move them to player constantly, right? (Assuming that player can use the spell at any time.)

 

To clarify, I only need the OnActivate call.

I don't need to run other sections.

 

Actually, the code worked as expected when I used Player as the activating user, instead of the other Activator.

It worked, even though the used Activator was not in player's cell.

 

Anyway, I just tried with moving all these activators towards the player and that didn't help.

 

 

I think you slightly misunderstood what I'm trying to do.

Now I notice, that the topic title is misleading. Sorry.

 

I have spell X and activators A and B.

Inside spell X I want to activate A, while passing B as it's activating object.

I am not trying to activate one activator inside another.

Only one of the activators is activated. The other does nothing, excepting being passed over by reference.

TL; DR is that I can't use GetSelf. The code is inside a spell.

I included complete code in my first post.

 

By the way, I tried passing the activator from reference variable. That made no difference.

Edited by Eillis
Link to comment
Share on other sites

It will actually work on something in another cell ONLY if you were just in that cell and the game hasn't purged it from memory yet. If you did a PCB console command, it would purge that other cell and its activators from memory.

 

What is ECTCompanionController01? It needs to be a Ref-ID there (something you placed somewhere, set to persistent and gave a Ref-ID to), not the Form-ID of a base object.

Edited by GamerRick
Link to comment
Share on other sites

You can activate the player from any reference anywhere, but that's it.

 

Have you tried making a quest script that do it instead? But their scripts will still not run if they have any that is, not if the reference is not in the same cell as you are. An actor with low level processing activated will run their scripts but it can take many in game hours before they do it as they have very low priority if they are not in the same cell as you are. It is like they stand still completely, well at least almost.

 

I do have some actors that should send a mail or rather a scroll to the player as soon as they get activated and it sure takes a very long time until that scroll pops up.

Link to comment
Share on other sites

I figured out a better way to do what I wanted.

 

Basically I was trying to use one activator as data-holding "object"

and use the other as a "function" to make operations on that data.

 

I recently learned that you can make actual functions in script.

That makes my use case much easier.

 

 

Still, thank you for your help guys!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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