Jump to content

[LE] perk entry point needs a script - but what to put in?


Tasheni

Recommended Posts

I'm happy, script compiles and when I activate that horse, I can chose Talk, Ride or cancel :) I klick on Talk and dialog shows up :)

And immediately after the lines are spoken, player jumps on the back and that should not be. :( It looks weird, if he puts the saddle on that mount after he's sitting on it. I need sleep now, it's late in germany. Thank you for that script, I'm glad to have it. I will credit you for it, of course, and if you have any other ideas - great. I will rack my brain to get this to work.

Good night. Tasheni

Link to comment
Share on other sites

Another day, another idea. If it is simply not possible to remove that ActorTypeHorse from the actor, perhaps it is possible to replace the whole actor with another one.

So I have to make a second horse, similar to the first horse, but with ActorTypeNPC on it. This could be the base horse, that I'm able to talk to. If I tell him, that I want to ride, the dialog could trigger a script, that replaces the actor with the horse type. Is there a function to replace actors?

Link to comment
Share on other sites

I was thinking along similar lines last night when I read the previous posts. But instead of replacing the actor I was simply thinking that you could have a separate quest with an alias for the horse that applies the ActorTypeHorse keyword. This quest could be started with a dialog option to ride the horse and then stopped whenever the player has dismounted or so many seconds after dismount (in case player just wants to hop off to loot a corpse quick).

Link to comment
Share on other sites

Hi Ishara,

 

that would work? I will try out and report back. But it could be that there are problems with some situations, as you mentioned the fast dismount to loot or something like that. I could make a script that resets the quest, so it could stay start enabled. Have to think about. If that works, it would be the simplest solution one could wish to have. Thanks for posting.

Edited by Tasheni
Link to comment
Share on other sites

Es ist schön, dass der Dialog mit dem Pferd funktioniert. I think the actor script could be much easier. Maybe as follow, no guarantee of working as expected:

 

Scriptname Tasheni_HorseActivatorSCRIPT extends Actor  
{v2.0 written by ReDragon 2017}

; https://forums.nexusmods.com/index.php?/topic/5464827-perk-entry-point-needs-a-script-but-what-to-put-in/
; template is the script "MannequinActivatorSCRIPT.psc"

  Quest PROPERTY myQuest auto                     ; the quest you have created for talking
  {your talking quest}

  Race PROPERTY HorseRace_NPC auto                ; new horse race with keyword ActorTypeNPC

  Message PROPERTY HorseActivateMESSAGE auto      ; make a clone of "MannequinActivateMESSAGE"  FormID 0x000D7511
  {Msg that appears upon activating your horse}   ; and use that here

; change the button text like that:
; Button0: "Talking"
; Button1: "Riding"
; Button2: "Cancel"

  Int iSwitchRace     ; variable to control race switch


; -- EVENTs -- 4

EVENT OnCellLoad()
; http://www.creationkit.com/index.php?title=BlockActivation_-_ObjectReference
    self.BlockActivation(TRUE)        ; maybe useful
ENDEVENT


EVENT OnUnLoad()
    self.BlockActivation(False)        ; maybe useful
ENDEVENT


EVENT OnRaceSwitchComplete()
    iSwitchRace += 1
    Debug.Notification("Horse race switch completed! " +iSwitchRace)
ENDEVENT


EVENT OnActivate(ObjectReference actionRef)
IF (actionRef == Game.GetPlayer() as ObjectReference)
ELSE
    RETURN    ; - STOP - / -2    not the player
ENDIF
;---------------------
IF (actionRef as Actor).IsSneaking()
    Debug.Notification("HorseActivator: Sneaking not allowed!")
    RETURN    ; - STOP - / -1    player is sneaking the horse
ENDIF
;---------------------
    int i = HorseActivateMESSAGE.Show()

IF (i == 0)
;;; myF_Talking()
    myQuest.setStage(10)    ; let us talk
    myF_SwitchRace()
    self.Activate(self as ObjectReference, TRUE)    ; activate the horse by itself
    RETURN    ; - STOP - /0    activate for talking with this horse
ENDIF
;---------------------
IF (i == 1)
;;; myF_Riding(actionRef)
    self.Activate(actionRef, TRUE)                  ; activate the horse by the player, like normal horse activation
    RETURN    ; - STOP - /1    activate for horse riding
ENDIF
;---------------------
IF (i == 2)
    RETURN    ; - STOP - /2    do nothing
ENDIF
;---------------------
    Debug.Notification("HorseActivator: Unexpected button!")
ENDEVENT

; -- FUNCTION --

FUNCTION myF_SwitchRace()
;------------------------
;;; actor aRef = self.GetRace()        ; store the current race

    iSwitchRace = 0
    self.SetRace(HorseRace_NPC)
    self.EvaluatePackage()

;int i = 10
;    WHILE (iSwitchRace == 0) && (i > 0)
         Utility.Wait(0.25)            ; wait a bit
;        i = i - 1
;    ENDWHILE

;;; self.SetRace(aRef)                ; back to normal horse race
    self.SetRace()                    ; "The default will set the actors race back to the original race." (wiki)
    self.EvaluatePackage()
ENDFUNCTION

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

:) Cool, man kann die Rasse einfach austauschen?

That should work like to change the actor. I try it out. But not this evening - I'm so tired from my other project, that is this one (sorry, german only :) )

http://tafel-des-schicksals.de/

Site is old, but the project I've started since ten years is going on full time now, and I want to finish this at the end of year. So I'm writing the whole day (if something cool performs in my head) and at the evenings I'm working on this mod, which is very much fun to me and hopefully for others too.

 

I will try both options, from Ishara and that from you, because both could be very useful in future things. And I have to look, what at the end will be easier to handle. For now, thank you very much.

Greetings, Tasheni

Link to comment
Share on other sites

Now I have tested all possibilities of your advices, but neither of them works. Player jumps on the horse directly after talking to it.

@ReDragon2013: Here is a sample what happend after using your script. It has compiled right, but the ActorTypeHorse keyword initializes at the moment I'm activating the horse (you hear the sound of mounting) and player falls half down the floor. When I klick again on talk, player mounts. In this short video I have two Valas: First as the npc, second as the horse that should switch race:

https://www.youtube.com/watch?v=8uh4qgQH9os&feature=youtu.be

 

@Ishara: I tried to put the keywords at the alias but that makes no difference. I deleted all keywords under the actor and under the race and switched to different constellations, but no success.

 

Than I had another idea and that works for the first race switching, but not for switch back:

https://www.youtube.com/watch?v=3MNALmbG3gU&feature=youtu.be My horse is first the npc. Quest is start enabled. No need anymore for the activation menu. I talk to the horse and than script runs to switch the horse to horserace and saddles it up. Now my question is, how can I get it switched back to the npc race with a script in the quest or attached to the actor. Best timing would be, everytime player dismounts. But there's no event for on player dismount or such thing.

 

What would be possible?

 

Thank you for your time. Greetings, Tasheni

 

Edit: No. it's not a good idea to change the race when dismounting. I could try it because I activated the "allow player dialog" checkbox in the horse race, and so dialog shows up and gives me the opportunity to change race back to npc, but than the saddle vanishes immediately and it throws me off the horse.

 

Next idea is, I could realise it with an equiped item like a ring or necklace. Everytime it's equiped by player, it changes the horse back to npc. What I can't avoid is, that the saddle is removed immediately with the changing of the race, so player couldn't do it himself, but is it worth to fumble around with that? No, I don't think so. And my follower are able to remove the saddle of the player horse, too, so what the heck.

 

I appreciate your ideas, if you have better ones in mind , for now thank you very much for your kind help.

Edited by Tasheni
Link to comment
Share on other sites

When the player mounts the horse register for a single update. Then in the update check if the player is still mounted (IsOnMount), if still mounted re-register for a single update. If not, do your switch.

 

Something like:

 

 

Bool Function IsHorseDismountedByPlayer()
  If Game.GetPlayer().IsOnMount() == true
    RegisterForSingleUpdate(2.5)
    Return False
  Else
    Return True
  EndIf
EndFunction

Event OnUpdate()
  If IsHorseDismountedByPlayer() == true
    ;change horse race
  EndIf
EndEvent

simply call the IsHorseDismountedByPlayer function and then every 2.5 seconds the game will check to see if the player has dismounted, if they have change the race. if they have not, keep checking. You can of course change the time between checks if desired.

 

 

 

I'm not sure what script it would be best on. You could try whatever current script you have that switches the horses and causes the player to mount.

 

Saw you edited your last post, since this is a different approach than the one you tried it may be worth testing.

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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