kenseikenshin Posted October 17, 2021 Posted October 17, 2021 Hey guys i'm new to scripting btw i'm trying to make a non vanilla Activator appear preferably in front of an actor or the player but for the love me cannot get it to work the script compiles fine but when the spells casted nothing appears can anybody help me Scriptname zzWallOrientationScript extends activemagiceffect Actor Property Ray Auto Actor Property PlayerRef Auto ;-- Variables --------------------------------------- ObjectReference Property WallReference Auto Form MyBaseObject Event OnInit() MyBaseObject = WallReference.GetBaseObject() Ray.PlaceAtMe(MyBaseObject) PlayerRef.PlaceAtMe(MyBaseObject) EndEvent
Seijin8 Posted October 17, 2021 Posted October 17, 2021 10 minutes ago, kenseikenshin said: Are the properties filled?
kenseikenshin Posted October 17, 2021 Author Posted October 17, 2021 (edited) yeah properties are filled, does the code look like it should work? Edited October 17, 2021 by kenseikenshin
Seijin8 Posted October 17, 2021 Posted October 17, 2021 (edited) 19 minutes ago, kenseikenshin said: yeah properties are filled, does the code look like it should work? PlaceAtMe is a console command. The papyrus equivalent would be MoveTo() Edited October 17, 2021 by Seijin8
kenseikenshin Posted October 17, 2021 Author Posted October 17, 2021 okay so do i have to place a version of my activator into the world to be moved? Thanks i'll give it a try in a minute and i'll post the results
kenseikenshin Posted October 17, 2021 Author Posted October 17, 2021 yeah updated the same things happening mmm.. i cant even think of an example script to study Scriptname zzWallOrientationScript extends activemagiceffect Actor Property Ray Auto Actor Property PlayerRef Auto ;-- Variables --------------------------------------- Actor CasterActor ObjectReference Property WallReference Auto Form MyBaseObject Activator Property wall Auto Event OnInit() MyBaseObject = WallReference.GetBaseObject() WallReference.MoveTo(Ray) WallReference.MoveTo(PlayerRef) EndEvent
Seijin8 Posted October 17, 2021 Posted October 17, 2021 11 minutes ago, kenseikenshin said: yeah updated the same things happening mmm.. i cant even think of an example script to study Scriptname zzWallOrientationScript extends activemagiceffect Actor Property Ray Auto Actor Property PlayerRef Auto ;-- Variables --------------------------------------- Actor CasterActor ObjectReference Property WallReference Auto Form MyBaseObject Activator Property wall Auto Event OnInit() MyBaseObject = WallReference.GetBaseObject() WallReference.MoveTo(Ray) WallReference.MoveTo(PlayerRef) EndEvent Got a screenshot of the properties page from the CK?
Seijin8 Posted October 17, 2021 Posted October 17, 2021 Also, "Activator property Wall" is not referenced in the script. Why is it there? GetBaseObject() does different things depending on the type of script it is extending. It may not work for an ActiveMagicEffect in the way you are using it. Finally, add some debug code to have the system spit out what it is doing to console or notification, so you can see which step is failing.
kenseikenshin Posted October 17, 2021 Author Posted October 17, 2021 (edited) at the start i tried to spawn the activator in its raw form didnt work so i created the object reference 13 minutes ago, Seijin8 said: GetBaseObject() does different things depending on the type of script it is extending. It may not work for an ActiveMagicEffect in the way you are using it. ok fair enough, thought i needed the objects id form number to spawn it 13 minutes ago, Seijin8 said: Finally, add some debug code to have the system spit out what it is doing to console or notification, so you can see which step is failing. ok ill give it a try but my scripting is weak :L thanks for the help btw Edited October 17, 2021 by kenseikenshin
Seijin8 Posted October 17, 2021 Posted October 17, 2021 19 minutes ago, Seijin8 said: Event OnInit() MyBaseObject = WallReference.GetBaseObject() WallReference.MoveTo(Ray) WallReference.MoveTo(PlayerRef) EndEvent Okay, so what this is doing right now is defining MyBaseObject, but then never using it. Why? You are telling WallReference to moveto Ray, then immediately telling it to move to PlayerRef. Why is it moving to Ray at all? It isn't doing anything for the millisecond that it is there. Not trying to crap on you as you are learning (been there done that), but asking what precisely you are trying to do? If all you want is to move an object to the player when a spell is cast, then: ObjectReference Property ObjectToMove auto Event OnEffectStart(Actor akTarget, Actor akCaster) ObjectToMove.MoveTo(akCaster) EndEvent Should be all it takes. 1
kenseikenshin Posted October 17, 2021 Author Posted October 17, 2021 (edited) no go ahead man all criticism is helpful, honestly i'm just looking for a simple method to summon an item wasnt really to trying to move an existing item, i wanted to spawn a fresh item and after i get better at scripting ill be able to manipulate its positioning Scriptname zzEarthWallOrientationScript extends activemagiceffect ;-- Variables --------------------------------------- ObjectReference Property WallReference Auto Event OnEffectStart(Actor akTarget, Actor akCaster) WallReference.MoveTo(akCaster) EndEvent the one property is filled in the item still won't spawn :l Edited October 17, 2021 by kenseikenshin
s3ngine Posted October 17, 2021 Posted October 17, 2021 Greetings, I think the issue might be the state of persistence of your placed WallReference. From what I understand, the property WallReference references a placed object in the 000HoldingCell. In order to be able to call the object via script and move it to your position, the object needs to be either a) set to persistent (dunno how this works in the CK, tho, I only use xEdit) or b) at the time of casting the spell must be in the same cell as you are, which is usually not the case. Alternatively, PlaceAtMe is indeed also a script function (tho I had to look it up to be certain, ngl). In order to use it, you need the have your Activator record (NOT the placed ObjectReference in the cell) as a property. So bascially your property "wall" as seen earlier. Then it could look like this: Scriptname zzEarthWallOrientationScript extends activemagiceffect ;-- Variables --------------------------------------- Form Property Wall Auto Event OnEffectStart(Actor akTarget, Actor akCaster) ObjectReference tmp = akCaster.PlaceAtMe(akFormToPlace = Wall, aiCount = 1, abForcePersist = false, abInitiallyDisabled = false) EndEvent In this case, however, you need to think about cleaning up afterwards, so the object does not stay in the save or something (tho I have to admit I don't know much about this). Depending on what you are trying to do, it might still be the better solution to have one persistent object, like I described earlier, which you move around. You could do something like this: Scriptname zzEarthWallOrientationScript extends activemagiceffect ;-- Variables --------------------------------------- ObjectReference Property WallReference Auto Event OnEffectStart(Actor akTarget, Actor akCaster) ;move the wall to me WallReference.MoveTo(akCaster) EndEvent event OnEffectFinish(Actor akTarget, Actor akCaster) ;move the wall back home WallReference.MoveToMyEditorLocation() endevent MoveToMyEditorLocation does exactly what it says, it moves the object back to its position as designated in the CK. So in our example, you would have a spell with a duration, and once the duration wears of, the wall disappears again. Sorry for the long post, but I hope this may be of help to you. Regards, s3ngine 1
kenseikenshin Posted October 17, 2021 Author Posted October 17, 2021 Hi s3ngine 1 hour ago, s3ngine said: I think the issue might be the state of persistence of your placed WallReference. From what I understand, the property WallReference references a placed object in the 000HoldingCell. In order to be able to call the object via script and move it to your position, the object needs to be either a) set to persistent (dunno how this works in the CK, tho, I only use xEdit) or b) at the time of casting the spell must be in the same cell as you are, which is usually not the case. ok that makes sense 1 hour ago, s3ngine said: Alternatively, PlaceAtMe is indeed also a script function (tho I had to look it up to be certain, ngl). In order to use it, you need the have your Activator record (NOT the placed ObjectReference in the cell) as a property. So bascially your property "wall" as seen earlier. Then it could look like this: Scriptname zzEarthWallOrientationScript extends activemagiceffect ;-- Variables --------------------------------------- Form Property Wall Auto Event OnEffectStart(Actor akTarget, Actor akCaster) ObjectReference tmp = akCaster.PlaceAtMe(akFormToPlace = Wall, aiCount = 1, abForcePersist = false, abInitiallyDisabled = false) EndEvent Thank you ideally thats what i was looking for 1 hour ago, s3ngine said: In this case, however, you need to think about cleaning up afterwards, so the object does not stay in the save or something (tho I have to admit I don't know much about this). It will be ok the activator is destructable 1 hour ago, s3ngine said: Scriptname zzEarthWallOrientationScript extends activemagiceffect ;-- Variables --------------------------------------- ObjectReference Property WallReference Auto Event OnEffectStart(Actor akTarget, Actor akCaster) ;move the wall to me WallReference.MoveTo(akCaster) EndEvent event OnEffectFinish(Actor akTarget, Actor akCaster) ;move the wall back home WallReference.MoveToMyEditorLocation() endevent Honestly i have uses for both the scripts so Thank you
kenseikenshin Posted October 17, 2021 Author Posted October 17, 2021 I'm starting to think theres something wrong with my spell itself. i changed it to script i know works, and it still wont execute the script. even though i can see the visuals of the magic effect
kenseikenshin Posted October 17, 2021 Author Posted October 17, 2021 (edited) s3ngine You legend works like a charm i can see why my original attempts failed Thank you to both of you for your time and expetise 11 hours ago, s3ngine said: Scriptname zzEarthWallOrientationScript extends activemagiceffect ;-- Variables --------------------------------------- Form Property Wall Auto Event OnEffectStart(Actor akTarget, Actor akCaster) ObjectReference tmp = akCaster.PlaceAtMe(akFormToPlace = Wall, aiCount = 1, abForcePersist = false, abInitiallyDisabled = false) EndEvent Edited October 17, 2021 by kenseikenshin 1
s3ngine Posted October 21, 2021 Posted October 21, 2021 On 10/17/2021 at 7:19 PM, kenseikenshin said: s3ngine You legend works like a charm Thanks, glad to be of help
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now