Center on Cell - Is there an issue?

Post » Thu Jun 21, 2012 11:08 am

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 AutoImageSpaceModifier Property akISM autoCell Property OriginalCell AutoSpell Property AutoHypSpell AutoActor PlayerRefFloat OriginalLocationXFloat OriginalLocationYFloat OriginalLocationZFloat OriginalAngleXFloat OriginalAngleYFloat OriginalAngleZFloat OriHealthFloat OriMagickaFloat OriStaminaEvent 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.")elseendifEndEventEvent 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()endifEndEventEvent 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.")endifEndEventEvent OnGetUp(ObjectReference akFurniture)  PlayerRef.dispelspell(AutoHypSpell)EndEvent
User avatar
Alycia Leann grace
 
Posts: 3539
Joined: Tue Jun 26, 2007 10:07 pm

Post » Fri Jun 22, 2012 1:09 am

Because at no point does your script call any function to move the player.

Debug.CenterOnCell doesn't move the player, its just a debugging command.

In order to move the player you need to set up an XMarkerHeading and use the MoveTo function
User avatar
Gaelle Courant
 
Posts: 3465
Joined: Fri Apr 06, 2007 11:06 pm

Post » Thu Jun 21, 2012 2:08 pm

So:

1) The Wiki is incorrect? Since it's supposed to be a mirror of the console command.
2) What exactly does Debug.CenterOnCell do?

Thanks for pointing me in the right direction, have no idea how to use the XMarkerHeading but I'll fool around in the Wiki.
User avatar
Nany Smith
 
Posts: 3419
Joined: Sat Mar 17, 2007 5:36 pm

Post » Thu Jun 21, 2012 5:25 pm

Ok, I take back what i said about the debug command. But regardless you should be using MoveTo rather then COC.

To set it up is super easy. Just plop down an XMarkerHeading where you want to teleport to, give it a RefID, add the property to the script referencing the marker, and use the MoveTo function to move to said marker.
User avatar
carrie roche
 
Posts: 3527
Joined: Mon Jul 17, 2006 7:18 pm

Post » Fri Jun 22, 2012 12:18 am

Alright, but what about the part where it's supposed to return the player to the exact spot they left? Can I drop an XMarkerHeading there and return to it within the same spell?
User avatar
kristy dunn
 
Posts: 3410
Joined: Thu Mar 01, 2007 2:08 am

Post » Thu Jun 21, 2012 1:36 pm

Yes. Every instance you want the player teleported can be done with the markers and the command.
User avatar
Noely Ulloa
 
Posts: 3596
Joined: Tue Jul 04, 2006 1:33 am

Post » Thu Jun 21, 2012 7:47 pm

Er, to be more specific - I don't have the foggiest idea how to drop an object or actor via script and then also refer back to it with that same script. I know how to place actors, and I know how to refer to them if they exist outside of the script, but I don't know how to place a new one and refer to it with the script. Can you help?
User avatar
Veronica Martinez
 
Posts: 3498
Joined: Tue Jun 20, 2006 9:43 am

Post » Thu Jun 21, 2012 11:07 pm

Drop refers to the literal act of clicking and dragging an object into the render window.

Place 2 xmarkersheadings. one to werhe you teleport to and one to where you teleport back to.

Add the markers in your list of properties so you can reference then in the script, just like any other object.

Replace the debug COC with "Player.MoveTo MyMarkerRef"
User avatar
Alexander Lee
 
Posts: 3481
Joined: Sun Nov 04, 2007 9:30 pm

Post » Thu Jun 21, 2012 11:56 pm

Yeah, this is my problem - the script is intended to allow the player to cast the spell anywhere and then return to exactly the spot they left, not simply return to a specific spot. How can I do -that-?
User avatar
Victor Oropeza
 
Posts: 3362
Joined: Sun Aug 12, 2007 4:23 pm

Post » Thu Jun 21, 2012 11:53 pm

Ah, i see.

Again you can use the MoveTo function to move the corresponding XMarkerHeadings to the players location for when they are teleported back. Then you call up MoveTo on the player to teleport them wherever it is, and the return location should be where you left.
User avatar
El Khatiri
 
Posts: 3568
Joined: Sat Sep 01, 2007 2:43 am

Post » Fri Jun 22, 2012 1:17 am

Ohh. Duh. So let me double-check to make sure I've got this right-

I create an XMarkerHeading object -anywhere-. (XMarkerHeading1)
I use MoveTo to bring it to the player.
I move the player to XMarkerHeading2 with MoveTo.
Then I use XMarkerHeading1 as a MoveTo anchor for the player?
User avatar
Ronald
 
Posts: 3319
Joined: Sun Aug 05, 2007 12:16 am

Post » Thu Jun 21, 2012 11:50 am

exactly.

You can put the XMarkerHeading1 within your custom cell location as a temporary holding location till it is called elsewhere.

It is all basically the same method of mark/recall spell mods.
User avatar
Silvia Gil
 
Posts: 3433
Joined: Mon Nov 20, 2006 9:31 pm

Post » Thu Jun 21, 2012 8:54 pm

Danke. You've been a big help.
User avatar
Mel E
 
Posts: 3354
Joined: Mon Apr 09, 2007 11:23 pm

Post » Thu Jun 21, 2012 11:02 pm

The irony i was able to help at all. Scripting boggles my mind half of the time. Took me 3 days to make a script that would detect the player smacking an object with a specific item.
User avatar
Robert Jr
 
Posts: 3447
Joined: Fri Nov 23, 2007 7:49 pm


Return to V - Skyrim