Delzaron Posted April 3, 2017 Posted April 3, 2017 Hi I'm working on a quest where a creature will hunt the player... So, if the player goes into a space (out or in) outside town and villages, the creature will teleport near the player, and follow him. I tired something, but it's not working... Here's the hunting script : Event OnLocationChange(Location akOldLoc, Location akNewLoc) if (Game.GetPlayer().GetCurrentLocation() == akOldLoc && (aNovel_werewolf as aNovel_werewolfScript).WerewolfHunt == 0) debug.notification("The werewolf is hunting you...") If akOldLoc != (WhiterunLocation && akNewLoc != WindhelmLocation && akNewLoc != SolitudeLocation && akNewLoc != MarkarthLocation && akNewLoc != RiftenLocation && akNewLoc != MorthalLocation && akNewLoc != RiverwoodLocation && akNewLoc != DragonBridgeLocation && akNewLoc != RoriksteadLocation && akNewLoc != HelgenLocation) debug.notification("Something is lurking...") If akNewLoc != (WhiterunLocation && akNewLoc != WindhelmLocation && akNewLoc != SolitudeLocation && akNewLoc != MarkarthLocation && akNewLoc != RiftenLocation && akNewLoc != MorthalLocation && akNewLoc != RiverwoodLocation && akNewLoc != DragonBridgeLocation && akNewLoc != RoriksteadLocation && akNewLoc != HelgenLocation) debug.messagebox("The Werewolf jumped on you!") aNovel_WerewolfREF.Moveto(playerref) utility.wait(2) (aNovel_werewolf as aNovel_werewolfScript).WerewolfRapePlayer() Else ;Nothing Happens EndIf EndIf endIfendEvent I also wish to force that beast to follow the player (actually, it doesn't move his ass), and to teleport not on the player, but near him...
vinfamy Posted April 3, 2017 Posted April 3, 2017 Haven't tested myself but maybe use an optional Quest Alias set to Forced:None. Add a Follow/ Travel package, tweaked to your likings, to that alias. Then ReferenceAlias property FollowAlias auto FollowAlias.ForceRefTo(aNovel_WerewolfREF) aNovel_WerewolfREF.EvaluatePackage() ; this line might not be needed On appearing near the player but not right on the player. Doesn't MoveTo have parameter for this? From CreationKit website: Function MoveTo(ObjectReference akTarget, float afXOffset = 0.0, float afYOffset = 0.0, float afZOffset = 0.0, bool abMatchRotation = true) native ; Moves a portal 120 units in front of the player, 35 units under their height Actor PlayerRef = Game.GetPlayer() Portal.MoveTo(PlayerRef, 120.0 * Math.Sin(PlayerRef.GetAngleZ()), 120.0 * Math.Cos(PlayerRef.GetAngleZ()), PlayerRef.GetHeight() - 35.0) On why your event is not working, I could only guess that it's because a location can be quite big (a few cells combined). Try OnCellLoad instead. There is also the IsInInterior() function that might be useful
Delzaron Posted April 3, 2017 Author Posted April 3, 2017 Hum... he still doesn't want to move to the player... I'll try to just set the city smallworlds as forbidden zones, I'll see...
Delzaron Posted April 3, 2017 Author Posted April 3, 2017 Now this fucking creatrure is timid, and never attacks... I set her as aggresive as possible, for god sake !
Delzaron Posted April 3, 2017 Author Posted April 3, 2017 I got a new idea... is player sleep, the creature found him... it's work... Now I wish to check if player is in interior cell, and if the cell is owned by player... And finnaly, if player is in wilderness... edit : the two fist conditions works easily, now I just need to check if player is outside a city, or in wilderness...
vinfamy Posted April 3, 2017 Posted April 3, 2017 edit : the two fist conditions works easily, now I just need to check if player is outside a city, or in wilderness... I had this condition for Kidnapped Location[] Property TownLocations Auto; add all the towns and exterior cities in the properties (Riverwood, Falkreath, etc) If !PlayerRef.IsInInterior() && TownLocations.Find(PlayerRef.GetCurrentLocation()) < 0 ; .... endif
Delzaron Posted April 3, 2017 Author Posted April 3, 2017 edit : the two fist conditions works easily, now I just need to check if player is outside a city, or in wilderness... I had this condition for Kidnapped Location[] Property TownLocations Auto; add all the towns and exterior cities in the properties (Riverwood, Falkreath, etc) If !PlayerRef.IsInInterior() && TownLocations.Find(PlayerRef.GetCurrentLocation()) < 0 ; .... endif If !PlayerRef.IsInInterior() && TownLocations.Find(PlayerRef.GetCurrentLocation()) < 0 Do you think this line will work ? (!PlayerRef.IsInInterior() && TownLocations.Find(PlayerRef.GetCurrentLocation()) seems better, no ? I'll try your solution... At least, the Hound find the player when he reaches home... Edit : thanks, it's working quite well ! nothing will stop the Hound !
Recommended Posts
Archived
This topic is now archived and is closed to further replies.