Begging for help with scripting with Placeactoratme

Post » Mon Jun 18, 2012 8:19 am

Hi all,

I really didn't want to have to resort to publicly begging for help, but I'm afraid that I'm just at my wits end. :( I've spent waaay too long frustrating myself to pieces trying to work this out, but this scripting business is just too far over my head right now.

So here's the short version: I want to create a player-craftable object (an "inert dwemer spider") that can be dropped into the worldspace and when activated will disappear and leave a specified actor (a friendly dwemer spider) in its place. Most of the basic CK parts of that are easy, and I've already got the basic framework of the system worked out, but I just can't wrap my head around the scripting.

I don't think it sounds very difficult, and I've been trying to work through the tutorials on the wiki to help me figure out the syntax, but the examples don't seem to be pointing me in the right direction.

From what I've managed to figure out, the script should look something like this:

Event OnActivate(ItemID.placeactoratme(actorID), ObjectReference ItemID.delete)
endEvent

....I think. I know it's wrong, but I feel like I'm close and just not getting something obvious, and important. :(

I'd be really really grateful to anyone who can help me out with this and keep from pulling out what's left of my hair. :D

Thanks!
-Phayze
User avatar
roxanna matoorah
 
Posts: 3368
Joined: Fri Oct 13, 2006 6:01 am

Post » Mon Jun 18, 2012 4:44 pm

On Activate does not return the reference to the object being activated it only returns the actor that activates said object.

If you want to get the objects reference use "Self"

basically

Event OnActivate (ObjectReference akActionRef) ;->ObjectReference declares akActionRef as an ObjectReference -> and akActionRef is the variable to be filled you can name this anything you want     If Game.GetPlayer() == akActionRef          Self.DoStuff     EndifEndEvent
User avatar
abi
 
Posts: 3405
Joined: Sat Nov 11, 2006 7:17 am

Post » Mon Jun 18, 2012 9:35 am

My brain hurts . . .

Thanks for the reply! I'm not sure that I fully understand, though. What you're example says, in plain English, is this:

"If the player activates [whatever the script is attached to], then [whatever the script is attached to] will do stuff."

Am I on the right track here? I hope so, because that's actually starting to make some sense to me . . . I'm getting nervous! :wink:

So, that means that I need to figure out the syntax for the "do stuff" part - that's the placeactoratme and delete parts. So

Event OnActivate (ObjectReference DwemerSpiderStartup) ;
If Game.GetPlayer() == DwemerSpiderStartup
Self.PlaceActorAtMe([formid for friendly spider])
Selt.delete
Endif
EndEvent

Is that even close? I'm going to try it out and see what kind of mayhem ensues.

Thanks again for helping me out with this! I haven't done any programming outside of a little QBasic 16 years ago. O_o

EDIT: Okay, so I'm still wrong. :(

I keep staring at the wiki entry for placeactoratme and I'm just not seeing how what I'm doing here is wrong. I've tried the FormID, and that doesn't work, and I've tried to EditorID, and that doesn't work. It says to use the actorbase one the wiki, but that doesn't work either (and wouldn't spawn the modified spiders that I made for the mod, anyway).

I used "ObjectReference [EditorID of friendlyspider]" at the top of the script to declare the name of my actor as a variable - that got me once less error, but I'm not really convinced that it'll do what I want it to. Even if it does, I still have these errors which I don't even understand:


[path]\PDAMspiderguardianscript.psc(8,7): type mismatch on parameter 1 (did you forget a cast?)
[path]\PDAMspiderguardianscript.psc(9,7): Delete is not a property on script pdamspiderguardianscript or one of its parents
No output generated for PDAMspiderguardianscript, compilation failed.

I hope I'm not overly imposing on the kindness of the forums by being so dense about this, but I would be extremely grateful for any assistance I can get!
User avatar
CRuzIta LUVz grlz
 
Posts: 3388
Joined: Fri Aug 24, 2007 11:44 am

Post » Mon Jun 18, 2012 11:29 am

Actor Property Spider Auto ; we use this to point to the spider actor we want to spawn.Event OnActivate (ObjectReference DwemerSpiderStartup) ; you should keep this something specific to what it returns it will make your life easier     If Game.GetPlayer() == DwemerSpiderStartup ; this checks to make sure the activator of this object is the player          Self.PlaceActorAtMe(Spider) ; this spawns the dwemer spider actor you linked into the property          Self.Delete()     EndifEndEvent
User avatar
Genocidal Cry
 
Posts: 3357
Joined: Fri Jun 22, 2007 10:02 pm

Post » Mon Jun 18, 2012 1:09 am

Just a warning... You may run into this issue if you are dropping items. For some reason Items dont update the position...I had already posted this a few times asking for help and got ignored :/
But take a look: http://www.youtube.com/watch?v=464kK2HX9L0
User avatar
*Chloe*
 
Posts: 3538
Joined: Fri Jul 07, 2006 4:34 am

Post » Mon Jun 18, 2012 5:21 am

Saidenstorm, Would it out of line for me to say that I love you? I mean that in a completely platonic, but no less genuine sense. :smile: I'll put your name at the top of my mod's credits.

This actually makes perfect sense to me now, and I can see where I went wrong for the most part, but I'm still getting an error on the placeactoratme line. What does it mean by cast?

[path]\PDAMspiderguardianscript.psc(8,7): type mismatch on parameter 1 (did you forget a cast?)

Any ideas? I swear, the code looks right compared to what's on the wiki entry.

EDIT:

Severed Skulls: How odd . . . I'll let you know if that same thing happens to me. Thanks for the warning! :)
User avatar
Kirsty Wood
 
Posts: 3461
Joined: Tue Aug 15, 2006 10:41 am

Post » Mon Jun 18, 2012 7:37 am


I tested this script it works.... I got the same PlaceActorAtMe error -> I thinks its because this function is looking for a leveled Actor so if you alter the actor to be leveled then you will most likily need to switch back.

Scriptname ssScriptSpawnDwemerSpiders extends ObjectReference  ActorBase Property Spider  Auto ; ActorBase does not require you to pop the actor someone where in world before is selectable in the PropertyEvent OnActivate (ObjectReference akActivator)     If Game.GetPlayer() == akActivator          Self.PlaceAtMe(Spider)          Self.Delete()     EndifEndEvent
User avatar
Julie Ann
 
Posts: 3383
Joined: Thu Aug 23, 2007 5:17 am

Post » Mon Jun 18, 2012 4:41 am

*hangs head in shame*


I'm so sorry, SaidenStorm . . . I wanted to post an elaborate thank you, but I've spent all friggin evening trying to figure out why this won't work and it's just not making sense to me. :( Would you mind offering just one last bit of help?

The script you posted compiles and seems to run, in part, but the PlaceAtMe command still isn't doing anything for me. I attached the script to my craftable object, loaded the game, built one, and dropped it, but when I activate it the thing just vanishes... which it's supposed to, but nothing appears in its place. I've been trying to work out some sort of fix, but nothing that I try seems to work.

Here's what I'm using right now:

Scriptname PDAMspiderguardianscript extends ObjectReference
{Causes an inert spider guardian to disappear and spawn a PDAM spider guardian in its place}

Event OnLoad()
BlockActivation(true) ;prevent inert spider from returning to inventory
EndEvent

Event OnActivate (ObjectReference AutomatonActivator)
If Game.GetPlayer() == AutomatonActivator
Self.PlaceAtMe(Game.GetForm(0x01000D62)) ;spawns friendly spider
Self.Delete() ;deletes inert spider
Endif
EndEvent

I thought the GetForm option might help to streamline things by making it painfully obvious what I wanted to spawn here, but for some reason nothing is spawning at all. I'm just at a complete loss . . . ;_;

Once again, I will be eternally grateful for any help I can get on this!
User avatar
Katy Hogben
 
Posts: 3457
Joined: Mon Oct 30, 2006 12:20 am

Post » Mon Jun 18, 2012 4:35 pm

*hangs head in shame*


I'm so sorry, SaidenStorm . . . I wanted to post an elaborate thank you, but I've spent all friggin evening trying to figure out why this won't work and it's just not making sense to me. :( Would you mind offering just one last bit of help?

The script you posted compiles and seems to run, in part, but the PlaceAtMe command still isn't doing anything for me. I attached the script to my craftable object, loaded the game, built one, and dropped it, but when I activate it the thing just vanishes... which it's supposed to, but nothing appears in its place. I've been trying to work out some sort of fix, but nothing that I try seems to work.

Here's what I'm using right now:



I thought the GetForm option might help to streamline things by making it painfully obvious what I wanted to spawn here, but for some reason nothing is spawning at all. I'm just at a complete loss . . . ;_;

Once again, I will be eternally grateful for any help I can get on this!
Try using Game.GetPlayer().PlaceAtMe() instead of Self.PlaceAtMe(). Might not make a difference but it's worth a shot anways.

Also, (not entirely related) you can place scripts in code tags to make them more readable.

[code] and [//code], but with only one /
User avatar
Farrah Lee
 
Posts: 3488
Joined: Fri Aug 17, 2007 10:32 pm

Post » Mon Jun 18, 2012 6:42 am

Have you tried using http://www.creationkit.com/PlaceActorAtMe_-_ObjectReference for this? If that doesn't work (I expect it would, but then again I expect SaidenStorm's code to work too) then try this:
PlaceAtMe(Spider as Form)
Or, alternately, declare "Spider" as type "Form" to begin with.

Also, just in case you're not aware - the following syntax is never actually necessary for any function that can be called like this, although it should work just the same:
Self.Delete()
The following syntax works just the same, with the only difference being that less code is required. I expect, although I haven't tested it, that the Papyrus compiler is good enough that both bits of code will be optimised just as well:
Delete()

Cipscis
User avatar
Stephanie Nieves
 
Posts: 3407
Joined: Mon Apr 02, 2007 10:52 pm

Post » Mon Jun 18, 2012 8:18 am

Thanks for the fast replies, folks. :smile: I really appreciate the tips and ideas.

Try using Game.GetPlayer().PlaceAtMe() instead of Self.PlaceAtMe(). Might not make a difference but it's worth a shot anways.

Also, (not entirely related) you can place scripts in code tags to make them more readable.

Actually, I did try that and it didn't work either. I had a similar thought - that calling placeatme on the item was causing some sort of problem, apparently that wasn't the case.

Thanks for both tips, though. I'll remember the trick with the code tags in the future. :)


Have you tried using PlaceActorAtMe for this? If that doesn't work (I expect it would, but then again I expect SaidenStorm's code to work too) then try this:
PlaceAtMe(Spider as Form)
Or, alternately, declare "Spider" as type "Form" to begin with.

Also, just in case you're not aware - the following syntax is never actually necessary for any function that can be called like this, although it should work just the same:
Self.Delete()
The following syntax works just the same, with the only difference being that less code is required. I expect, although I haven't tested it, that the Papyrus compiler is good enough that both bits of code will be optimised just as well:
Delete()

Cipscis

I did try PlaceActorAtMe as well, with the same results, and I just tried your idea of declaring the spider as a form, also with the same results. I just can't understand what I'm doing wrong - everything looks right to me, but whenever I activate my item in-game, it just deletes itself and nothing spawns.

Just to be clear, when we use "spider" generically in conversation here, the actual script should be using the EditorID for the spider, correct? I was a little uncertain about that, which is why I switched to GetForm originally.

Thanks for the tip on the delete syntax - I didn't think it was necessary, but I'm still at the "I'm new to this so I'm going to over-do everything and not cut any corners" stage of learning. :wink:
User avatar
Breautiful
 
Posts: 3539
Joined: Tue Jan 16, 2007 6:51 am

Post » Mon Jun 18, 2012 2:02 pm

Take a look at this tutorial I've written, which describes how Papyrus handles editorIDs - http://www.cipscis.com/skyrim/tutorials/editorids.aspx

Cipscis
User avatar
Tikarma Vodicka-McPherson
 
Posts: 3426
Joined: Fri Feb 02, 2007 9:15 am

Post » Mon Jun 18, 2012 1:48 pm

Take a look at this tutorial I've written, which describes how Papyrus handles editorIDs

Cipscis

*Facepalm*

Holy crap . . . I don't even want to think about how many hours I've wasted, tearing my hair out over this when the answer was so simple! And, I might add, obvious, if I'd remembered the warning about properties in the Wiki tutorials. >_<

Thank you so much for your help with this! Once I get it posted, I'll be adding you and SaidenStorm to the credits for my mod. :D I couldn't have done it without you guys!
User avatar
Cody Banks
 
Posts: 3393
Joined: Thu Nov 22, 2007 9:30 am


Return to V - Skyrim