Looking for Scripting Help (again..)

Post » Mon Jun 18, 2012 3:53 pm

Edit2: Both problems are now Solved, thanks everyone for the help.

Edit: Oh and I can't figure out how to use spoiler boxes on the forum, would love to throw the code into them if anyone knows how.

So I'm stuck, again. Got two problems this time, same as before did searches on here and looked all over the wiki still not sure what to do. If anyone can take a look and tell me what I'm doing wrong this time, I'd be much obliged.



First problem: SOLVED I have a Message Box script, thats firing fine. Pops up like it should, buttons all work like they should. My problem is actually pretty simple (and leaves me feeling really silly for getting hung up). I can't get a .additem to fire.
Scriptname aaSerStudyDifBoxScript extends QuestMessage Property aaSerStudyDifficultyCheck AutoQuest Property aaSerDenethsStudy01  AutoBook Property aaSerStudySpellTomeTeleport  AutoInt Property Version Autoint InitEVENT OnInit()  RegisterForUpdate(5)EndEVENTEVENT OnUpdate()  if ( Init == 0 )	RegisterForUpdate(1)	Init += 1  elseif ( Init == 1 )	Version = aaSerStudyDifficultyCheck.Show()  if ( Version == 0 )	Debug.Notification("--Picked Free--")	aaSerDenethsStudy01.SetStage(40)	Game.GetPlayer().AddItem(aaSerStudySpellTomeTeleport, 1)	Init += 1  elseif ( Version == 1 )	Debug.Notification("--Picked Purchase--")	Init += 1  elseif ( Version == 2 )	Debug.Notification("--Picked Quest--")	Init += 1  endifendifEndEVENT
Its the Game.GetPlayer().AddItem(aaSerStudySpellTomeTeleport, 1) thats the problem. It just won't fire, nothing happens. Everything else runs, it compiles fine but if I pick option no book.

I'm guessing its the Book Property aaSerStudySpellTomeTeleport Auto bit thats wrong. I set it up like all my other Propertys, but I'm not actually sure if Book was the right option. The item I'm trying to give is a book so its what I went with.




Second problem: SOLVED This is the same script I was battling yesterday, although a new problem. Figure I should put it here rather then necro the other thread.
Scriptname aaSerStudyRecallScript extends activemagiceffect{Recalls the caster to Deneth's Study}ObjectReference Property aaSerStudyRecallMarker AutoObjectReference Property aaSerStudyMarkMarker AutoLocationRefType Property aaSerDenethExt AutoEvent OnEffectStart(Actor akTarget, Actor akCaster)  if akCaster.IsInLocation(aaSerDenethExt)	return  else	aaSerStudyMarkMarker.MoveTo(akCaster)	akCaster.MoveTo(aaSerStudyRecallMarker)  endifendEvent
Problem here is my if statement. Won't compile after I added that. The exact error is "(9,13): type mismatch on parameter 1 (did you forget a cast?)".

The example on the wiki is
; Is the box in the house location?if Box.IsInLocation(House)  Debug.Trace("Box is in the house!")endIf
As far as I can tell I copyed it perfectly so not sure what to do about this one.
The goal of that the script will teleport someone to the marker in a special cell. And then theres a door with a script to teleport them back to the casting location. That all works but if they cast the spell in the cell they get stuck in there. That IsInLocation was my attempt to fix that.




So those are my new problems. Three threads in three days and I feel mighty dumb. I was getting decent at CS scripting but Papyrus is messing me about pretty hard. My main problem is I learned most of my CS scripting by downloading mods close to what I wanted to do and looking at how they did it. I learn much better by taking things apart then trying to read a manual about putting them together. CK Mods seem to have the scripts packaged away some where, and my attempts to do this have been meet with error messages. So here I am, again.

Thanks for taking the time to look this over
-Mike
User avatar
Marcus Jordan
 
Posts: 3474
Joined: Fri Jun 29, 2007 1:16 am

Post » Mon Jun 18, 2012 4:07 am

Hmm on your second problem: Strangely the error is refering to aaSerStudyMarkMarker.MoveTo(akCaster). But I cannot see what should be wrong with it since it was working before building the if around it.

No Idea on the first problem, given you setup the property for the script correctly it should work.
User avatar
Emily Rose
 
Posts: 3482
Joined: Sat Feb 17, 2007 5:56 pm

Post » Mon Jun 18, 2012 11:51 am

For the first one, you say you don't know if book was the right option, but weren't you able to set the property to your book in the property manager?

And on the second, the error does give you a clue as to the problem. It doesn't seem to like you used akCaster as the parameter. Not sure why that is though. Looks perfectly fine.
User avatar
Luis Longoria
 
Posts: 3323
Joined: Fri Sep 07, 2007 1:21 am

Post » Mon Jun 18, 2012 8:36 am

Hmm on your second problem: Strangely the error is refering to aaSerStudyMarkMarker.MoveTo(akCaster). But I cannot see what should be wrong with it since it was working before building the if around it.

No Idea on the first problem, given you setup the property for the script correctly it should work.

As to the error yes and no. The code is 20 lines long in the CK, posting the script into the code box on the forum got rid of a lot of spaces for some reason. In the actually script the 12th line is indeed
if akCaster.IsInLocation(aaSerDenethExt)
Edit: I changed the error code to 9 to compinsate.

For the first one, you say you don't know if book was the right option, but weren't you able to set the property to your book in the property manager?

And on the second, the error does give you a clue as to the problem. It doesn't seem to like you used akCaster as the parameter. Not sure why that is though. Looks perfectly fine.

For the book yes, I attached the script to the book in the books main editor ID -> hit propertys -> add property -> Named it and for type picked book off the list. It came up with Int by default for type, should I have left it that? I'm never sure with that sort of thing as there are no articles (as far as I can tell) on the wiki about proper edicate on that. Does it default to the optimal choice? Should you pick one? Its driving me nuts. >.<

As to the second one I tried it with Game.GetPlayer() as well. Same error.
User avatar
Jenna Fields
 
Posts: 3396
Joined: Mon Dec 11, 2006 11:36 am

Post » Mon Jun 18, 2012 11:27 am

For the second one, should it be "LocationRefType Property aaSerDenethExt Auto" or "Location Property aaSerDenethExt Auto"?
User avatar
Charles Mckinna
 
Posts: 3511
Joined: Mon Nov 12, 2007 6:51 am

Post » Mon Jun 18, 2012 2:24 pm

hit properties -> add property
But isn't the property already in the script?
Book Property aaSerStudySpellTomeTeleport  Auto

Unless I'm misreading this, you already made the property, and only need to set it.

And as for the other thing, perhaps http://www.creationkit.com/GetParentCell_-_ObjectReference would would better rather than IsInLocation?
User avatar
Dona BlackHeart
 
Posts: 3405
Joined: Fri Dec 22, 2006 4:05 pm

Post » Mon Jun 18, 2012 9:57 am

For the second one, should it be "LocationRefType Property aaSerDenethExt Auto" or "Location Property aaSerDenethExt Auto"?

Hmm, just tried swapping it to Location and it compiled. I'll test to see if it works now in a sec.
Edit: Hmm, now I can't select my cell in the Property Manager. I don't see any of the Beth test cells in there either, not sure how that list works.

But isn't the property already in the script?
Book Property aaSerStudySpellTomeTeleport  Auto

Unless I'm misreading this, you already made the property, and only need to set it.

And as for the other thing, perhaps http://www.creationkit.com/GetParentCell_-_ObjectReference would would better rather than IsInLocation?

Erm, if you do the steps I outlined it fills in a property line into the script for you. Thats how I've been doing it thus far.

I'll give GetPartentCell a shot if the LocationRefType to Location swap doesent work.
Edit: Giving GetParentCell a try.
User avatar
Spencey!
 
Posts: 3221
Joined: Thu Aug 17, 2006 12:18 am

Post » Mon Jun 18, 2012 11:20 am

Erm, if you do the steps I outlined it fills in a property line into the script for you. Thats how I've been doing it thus far.

Oh, I get it now. Sorry. Seems I lack reading comprehension.
User avatar
Haley Cooper
 
Posts: 3490
Joined: Wed Jun 14, 2006 11:30 am

Post » Mon Jun 18, 2012 4:33 am

The GetPartenCell worked like a charm, thanks!
User avatar
Tom Flanagan
 
Posts: 3522
Joined: Sat Jul 21, 2007 1:51 am

Post » Mon Jun 18, 2012 7:55 am

Good to know.

And as for the other thing, I just made a script that gives the player a book. So perhaps you can figure out from this what needs to be different. It also makes sure the player is in the right cell, but you don't need that anymore.

Scriptname GetLocationScript extends ObjectReferenceBook Property bookToGive  AutoObjectReference Property locationMarker AutoEvent OnActivate(ObjectReference akActivator)If (locationMarker.GetParentCell() == Game.GetPlayer().GetParentCell())	Game.GetPlayer().AddItem(bookToGive)EndIfEndEvent
User avatar
sally R
 
Posts: 3503
Joined: Mon Sep 25, 2006 10:34 pm

Post » Mon Jun 18, 2012 8:18 pm

deleting
User avatar
Yama Pi
 
Posts: 3384
Joined: Wed Apr 18, 2007 3:51 am

Post » Mon Jun 18, 2012 12:00 pm

Good to know.

And as for the other thing, I just made a script that gives the player a book. So perhaps you can figure out from this what needs to be different. It also makes sure the player is in the right cell, but you don't need that anymore.

Scriptname GetLocationScript extends ObjectReferenceBook Property bookToGive  AutoObjectReference Property locationMarker AutoEvent OnActivate(ObjectReference akActivator)If (locationMarker.GetParentCell() == Game.GetPlayer().GetParentCell())	Game.GetPlayer().AddItem(bookToGive)EndIfEndEvent

Alright, its got to be something in the propertys that I'm messing up I'll fiddle around with it and post back if I get it working.

Edit: Got it working, turns out I never set the books propertys on the Quest the script was tied to, only on the book. I don't have no good excuse for not checking that sooner, I just seem to be having a hard time wrapping my head around the new Propery system. I guess the Declare it once at the top of the script system from Obliv is rooted deep or something.

Anyways, thanks for helping me again today. I really means a lot. There's going to be a sizable "And this ever getting finished is thanks to:" section in the credits when I get this finished believe me.

Oh and to anyone interested http://steamcommunity.com/sharedfiles/filedetails/?id=9243 is the project its for.
User avatar
Spaceman
 
Posts: 3429
Joined: Wed May 23, 2007 10:09 am


Return to V - Skyrim