What is the equivalent of "Begin GameMode" in Skyrim

Post » Mon Jun 18, 2012 2:09 pm

I have my old Oblivion Script that I'm trying to transfer over to Skyrim and it basically is a sword that adds an "ability" constant magic effect to the player as long as the player has the sword in his inventory. I'm having a hard time initialization the script though. Any help would be appreciated.

Old Oblivion Script:


scn ChrysamereScript

short hasChrysamere

Begin GameMode
if ( player.GetDead == 0 )
if ( player.getitemcount Chrysamere == 1 )
if ( player.isspelltarget ChrysamereSpell == 0 )
player.addspell ChrysamereSpell
endif
elseif ( player.getitemcount Chrysamere == 0 )
if ( player.isspelltarget ChrysamereSpell == 1 )
player.removespell ChrysamereSpell
endif
endif
endif

End

New Skyrim Script: (thus far)


Event
if (Game.GetPlayer().IsDead == 0)
if (Game.GetPlayer().GetItemCount(pSword) == 1)
if (Game.GetPlayer().HasSpell(pAbility) == 0)
Game.GetPlayer().AddSpell(pAbility)
endif
elseif (Game.GetPlayer().GetItemCount(pSword) == 0)
if (Game.GetPlayer().HasSpell(pAbility) == 1)
Game.GetPlayer().RemoveSpell(pAbility)
endif
endif
endif


EndEvent
User avatar
The Time Car
 
Posts: 3435
Joined: Sat Oct 27, 2007 7:13 pm

Post » Mon Jun 18, 2012 6:23 am

From the wiki: http://www.creationkit.com/Differences_from_Previous_Scripting#Replacing_GameMode

Also, please use code tags when posting scripts so we can take a look at them with proper formatting, especially indentation. You do indent your scripts correctly, right?

Cipscis
User avatar
Manuela Ribeiro Pereira
 
Posts: 3423
Joined: Fri Nov 17, 2006 10:24 pm

Post » Mon Jun 18, 2012 2:48 am

I'm still learning the ropes, but if you're just detecting whether the player has the item or not, wouldn't it be more beneficial to just attach an item script that checks for container change?


Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)  if (newContainer == Game.GetPlayer())	Game.GetPlayer().AddSpell(pAbility)  else	Game.GetPlayer().RemoveSpell(pAbility)  endifEndEvent

So I just tested it myself and this script does indeed work fine, should do exactly what it sounds like you're after.
User avatar
Judy Lynch
 
Posts: 3504
Joined: Fri Oct 20, 2006 8:31 am


Return to V - Skyrim