[Scripting Help] Creating a GameMode script to add X item

Post » Mon Jun 18, 2012 2:28 pm

Hello, simple question:

How do I add something (I want to doa spell) to the player instantly as they load a save, one time only?
I didn't see anything about GameMode in the tuts. What would be the script I would use?

Total noob here! Cheers!
User avatar
Penny Courture
 
Posts: 3438
Joined: Sat Dec 23, 2006 11:59 pm

Post » Mon Jun 18, 2012 8:34 am

You need to create a quest which is start game enabled, then attach a script to it with OnInit() event, and put all your code there.
User avatar
Ymani Hood
 
Posts: 3514
Joined: Fri Oct 26, 2007 3:22 am

Post » Mon Jun 18, 2012 10:40 am

Thanks, but can you give a quick code example?

I am VERY new to this. I'm not even sure of the add spell code I would need to put in.

Edit:

THANKS Lozzi! :thumbsup:
User avatar
Jade Payton
 
Posts: 3417
Joined: Mon Sep 11, 2006 1:01 pm

Post » Mon Jun 18, 2012 4:26 pm

Here:
Scriptname Script extends FormSpell Property MySpell Autoevent OnInit()  Game.GetPlayer().AddSpell(MySpell)endevent

That should work if you attach it to a quest
User avatar
Natalie Taylor
 
Posts: 3301
Joined: Mon Sep 11, 2006 7:54 pm

Post » Mon Jun 18, 2012 2:11 pm

Okay I still can't get it to work. I put your code in. Made a SPELL property, everything compiled okay...

The quest is set up so it is start game enabled and runs once. I tried it without run once and it's the same.
It is at 50 priority...

This is silly
User avatar
Luis Longoria
 
Posts: 3323
Joined: Fri Sep 07, 2007 1:21 am

Post » Mon Jun 18, 2012 3:44 pm

Anyone? Can you give me your setup? It just does not want to run.
User avatar
claire ley
 
Posts: 3454
Joined: Fri Aug 04, 2006 7:48 pm

Post » Mon Jun 18, 2012 11:15 am

First, change the header of your script to:

Scriptname MyScriptName extends Quest

Then make sure there's not only a black plus sign icon next to your script name but also a yellow marker.
If the yellow marker is not present then highlight your script and click "Properties" button on the right side.
Then in the next window just highlight the property name you have in there and make sure that Pick Object field points to Editor ID of your spell.
User avatar
Elisabete Gaspar
 
Posts: 3558
Joined: Thu Aug 31, 2006 1:15 pm

Post » Mon Jun 18, 2012 5:21 pm

bump
User avatar
NAtIVe GOddess
 
Posts: 3348
Joined: Tue Aug 15, 2006 6:46 am

Post » Mon Jun 18, 2012 2:00 pm

Darn, thanks!

Missed out the extends bit!

Thank you kindly! =) Works now.
User avatar
Krystal Wilson
 
Posts: 3450
Joined: Wed Jan 17, 2007 9:40 am


Return to V - Skyrim