AstralFire Posted June 12, 2012 Share Posted June 12, 2012 I can manually arrive at this cell just fine with the console code. In the script, however, it just fails and leaves me at my original location when casting. Scriptname Astral_AutoHypnosis extends activemagiceffect Cell Property MindMansion Auto ImageSpaceModifier Property akISM auto Cell Property OriginalCell Auto Spell Property AutoHypSpell Auto Actor PlayerRef Float OriginalLocationX Float OriginalLocationY Float OriginalLocationZ Float OriginalAngleX Float OriginalAngleY Float OriginalAngleZ Float OriHealth Float OriMagicka Float OriStamina Event OnEffectStart(actor akTarget, actor akCaster) if(akCaster==Game.GetPlayer()) PlayerRef = akCaster OriHealth = PlayerRef.getavpercentage("health") OriMagicka = PlayerRef.getavpercentage("magicka") OriStamina = PlayerRef.getavpercentage("stamina") MindMansion.Reset() OriginalCell = GetTargetActor().GetParentCell() OriginalLocationX = GetTargetActor().GetPositionX() OriginalLocationY = GetTargetActor().GetPositionY() OriginalLocationZ = GetTargetActor().GetPositionZ() OriginalAngleX = GetTargetActor().GetAngleX() OriginalAngleY = GetTargetActor().GetAngleY() OriginalAngleZ = GetTargetActor().GetAngleZ() debug.CenteronCell(MindMansion) akISM.apply() debug.MessageBox("The chair before you calls to you.") else endif EndEvent Event OnEffectFinish(actor akTarget, actor akCaster) if(akCaster==Game.GetPlayer()) debug.CenteronCell(OriginalCell) akCaster.SetPosition(OriginalLocationX, OriginalLocationY, OriginalLocationZ) akCaster.SetAngle(OriginalAngleX, OriginalAngleY, OriginalAngleZ) PlayerRef.restoreav("health", 10000) float fullHealth = PlayerRef.getav("health") PlayerRef.damageav("health", fullhealth*(1-OriHealth)) PlayerRef.restoreav("stamina", 10000) float fullStamina = PlayerRef.getav("stamina") PlayerRef.damageav("stamina", fullStamina*(1-OriStamina)) PlayerRef.restoreav("magicka", 10000) float fullMagicka = PlayerRef.getav("magicka") PlayerRef.damageav("magicka", fullMagicka*(1-OriMagicka)) akISM.remove() endif EndEvent Event OnSit(ObjectReference akFurniture) if(PlayerRef==Game.GetPlayer()) Debug.MessageBox("Sitting here, you suddenly feel a shift within your soul. Somehow, you know that when you rise, you will return to the outside world... regardless of whether or not you are ready for it.") endif EndEvent Event OnGetUp(ObjectReference akFurniture) PlayerRef.dispelspell(AutoHypSpell) EndEvent Link to comment Share on other sites More sharing options...
David Brasher Posted June 12, 2012 Share Posted June 12, 2012 (edited) This line isn't supposed to read this way is it? debug.CenteronCell(MindMansion) I would expect that "debug" would turn whatever follows it into text rather than executable code. I haven't tested this syntax, but maybe it would work to do something like: PlayerRef.MoveTo(AAMyXMarkerHeading) Edited June 12, 2012 by David Brasher Link to comment Share on other sites More sharing options...
AstralFire Posted June 12, 2012 Author Share Posted June 12, 2012 I'm purely following how it's supposed to work in the Wiki (which has been known to be wrong.) The problem with the MarkerHeading is that I can get it to work just fine for moving to a static point, but at the end of the spell, you're supposed to be transported back to where you originally cast it - I can't figure out how to make that work with a MarkerHeading. By the way, I used some of your tutorials when I was starting out - thanks. Link to comment Share on other sites More sharing options...
steve40 Posted June 13, 2012 Share Posted June 13, 2012 (edited) According to the wiki, COC is for debugging purposes only, not a good idea to use it in a mod. When the spell is first cast, place an xmarker reference at yourself, then when you want to transport back, just place yourself at that xmarker: ObjectReference home = Game.GetPlayer().PlaceAtMe(XMarker) ; place a marker at the player Game.GetPlayer().MoveTo(home) ; move the player back to the marker Plus at the beginning of your script you will need to add a property for the marker: ObjectReference Property XMarker auto Edited June 13, 2012 by steve40 Link to comment Share on other sites More sharing options...
Recommended Posts