Jump to content

Quick Questions, Quick Answers


Mattiewagg

Recommended Posts

 

 

 

 

If the notification isn't triggering then chances are the event isn't even firing. Are you testing this on a new save or a save that has not seen your mod yet? Sometimes the game won't use updated aspects but rather what was baked into the save file.

 

Also, I think you might want to consider using PlaceActorAtMe instead of PlaceAtMe.

Yep, that was correct. Thanks!

 

Another 2 questions.

 

I have an actor that the player controls temporarily and I need 2 things from to happen and I can't quite figure out the correct events and syntax. This code is on the actor that is being controlled.

Event OnActivate(ObjectReference akActionRef)

	If akActionRef == PlayerRef ;If the player is being activated

		Self.Disable()

	ElseIf akActionRef == !PlayerRef ;If any other Actor is being activated
		
		akActionRef.ShowGiftMenu(true, AllFood)
		
	EndIf

EndEvent

Did you mean to disable the actor the script is attached to when the player activates them?

Edit: Reworded my question for clarity...

 

 

No, when the actor that is being controlled by the player activates the PlayerRef, I want the actor to disappear so the player can control their own actor once more. Right now, activating doesn't do anything.

 

Then I think you might be confused because right now, it will only disable the actor the script is attached to when the player activates them... the OnActivate() Event is called when the object* the script is attached to is activated, not when they activate something else; just in case you didn't realize.

*in this your script is attached to an actor, so when that actor is activated is when OnActivate() triggers

Link to comment
Share on other sites

  • Replies 2.6k
  • Created
  • Last Reply

Top Posters In This Topic

 

Then I think you might be confused because right now, it will only disable the actor the script is attached to when the player activates them... the OnActivate() Event is called when the object* the script is attached to is activated, not when they activate something else; just in case you didn't realize.

*in this your script is attached to an actor, so when that actor is activated is when OnActivate() triggers

 

Yes, that's why I said I can't quite figure out the correct events and syntax to use. That's what I need help with. My code is basically there to show what I'm trying to do and someone with more scripting experience could fix it up or point me in the right direction.

I will try to clear things up with more information.

 

 

I have an actor that the player controls temporarily and I need 2 separate things to happen and I can't quite figure out the correct events and syntax. This code is on the actor that is being controlled.

Event OnActivate(ObjectReference akActionRef)

	If akActionRef == PlayerRef ;If the player is being activated by the player controlled actor

		Self.Disable()

	ElseIf akActionRef == !PlayerRef ;If any other Actor is being activated by the player controlled actor
		
		akActionRef.ShowGiftMenu(true, AllFood) ;This doesn't allow me to compile: ShowGiftMenu is not a function or does not exist
		
	EndIf

EndEvent

I want the player controlled actor to be able to open the gift menu on other actors when they're activated. If the player controlled actor activates the original player character, the actor is disabled in which will activate my other event that puts the player in control of the original player character.

The only other method I could think of is to have a spell being constantly cast by the controlled actor that will do the same thing but I'd prefer to have the player be able to press activate and do it themselves.

Edited by Elias555
Link to comment
Share on other sites

@Elias555

I don't know of an event that can be used in a script attached to an actor to reference something they are activating... you could always try attaching the script to the player actor instead, and check if the akActionRef is the actor being controlled by the player when the player is activated, disabling that actor if true.

ShowGiftMenu() is only usable on an Actor, which is why it isn't compiling when you try to use in with akActionRef... you would have to cast akActionRef as an Actor before using ShowGiftMenu(); which would require casting it to a form before casting to actor.

 

Sorry I can't be more help.

Edited by Darkxenoth
Link to comment
Share on other sites

@Elias555

I don't know of an event that can be used in a script attached to an actor to reference something they are activating... you could always try attaching the script to the player actor instead, and check if the akActionRef is the actor being controlled by the player when the player is activated, disabling that actor if true.

ShowGiftMenu() is only usable on an Actor, which is why it isn't compiling when you try to use in with akActionRef... you would have to cast akActionRef as an Actor before using ShowGiftMenu(); which would require casting it to a form before casting to actor.

 

Sorry I can't be more help.

I suspect a quest is necessary but I have never used them. I don't think attaching anything to the player is a good idea.

As for the ShowGiftMenu(), I was hoping someone would know how to convert it within the script, but since there's no OnActivatED(), it'll have to be done another way.

Link to comment
Share on other sites

Actor extends ObjectReference therefore you do not need to cast into Form before using the ObjectReference as an Actor.

(akActionRef as Actor).ShowGiftMenu(true,AllFood)

Should pass the compiler. No idea tho if it helps achieve what you want.

It wouldn't help achieve what I want but it's still helpful. Anyway, I tried it, it doesn't compile; type mismatch on parameter 2 (did you forget a cast?)

Link to comment
Share on other sites

What's wrong with this script? Every time I save it and then reopen it, all the text is gone.

 

scn PacifistModScript

Begin GameMode
set iXPRewardDiscoverMapMarker to 10000
End

 

In this case, I'm trying to write a script that will adjust a game value called iXPRewardDiscoverMapMarker to give you 10000 experience points whenever you discover a new place.

Link to comment
Share on other sites

What's wrong with this script? Every time I save it and then reopen it, all the text is gone.

 

scn PacifistModScript

 

Begin GameMode

set iXPRewardDiscoverMapMarker to 10000

End

 

In this case, I'm trying to write a script that will adjust a game value called iXPRewardDiscoverMapMarker to give you 10000 experience points whenever you discover a new place.

That's written in the scripting language used by previous games. Skyrim uses a new language called Papyrus.

 

But you probably shouldn't be trying to use a script for this anyway. Although there are functions provided by SKSE (Skyrim Script Extender) there aren't any provided by the game itself. You are expected to set those values in your mod directly using the CK not by setting them in scripts. The only reason to use a script would be if you wanted to temporarily change the value. And there's also a very good chance that value does absolutely nothing in the game, many of the game setting variables are leftover from previous games but unused by Skyrim.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...