Need help with script for inheriting cell ownership

Post » Thu Jul 03, 2014 7:29 pm

Basically I am trying to write a script that will be attached to a spell. When the player casts the spell inside an interior cell, then they will own the cell.

I have no prior scripting knowledge, but I have something that at least somewhat resembles code at this point.

My problem now is that when I try to compile it fails with the message "no viable alternative at input '=' "

I was hoping someone here with more knowledge than me could look over my script and explain why it would say that, and maybe tell me if it looks like my script is doomed in other areas.

Spoiler
ScriptName ClaimSkyrimInterior Extends ActiveMagicEffectActor Property NewOwner AutoObjectReference Property NewHome AutoNewHome = Game.GetPlayer().GetParentCell()NewOwner = Game.GetPlayer() EVENT OnSpellCast(Actor NewOwner)   Claim()EndEVENT FUNCTION Claim(Actor NewOwner, ObjectReference NewHome)   If NewOwner.IsInterior()     NewHome.SetActorOwner(NewOwner) && Debug.Trace("Claimed!")   EndIfEndFUNCTION
User avatar
Brooks Hardison
 
Posts: 3410
Joined: Fri Sep 07, 2007 3:14 am

Post » Fri Jul 04, 2014 12:04 am

You have three different kinds of variables with the same two names (NewOwner and NewHome).

And OnSpellCast is meant for actor scripts, not activemagiceffect scripts.

So your script should look more like this:

ScriptName ClaimSkyrimInterior Extends ActiveMagicEffect Event OnEffectStart(Actor akTarget, Actor akCaster)   Claim()EndEVENT FUNCTION Claim(Actor NewOwner, Cell NewHome)NewHome = Game.GetPlayer().GetParentCell()NewOwner = Game.GetPlayer()   If NewOwner.IsInterior()     NewHome.SetActorOwner(NewOwner) && Debug.Trace("Claimed!")   EndIfEndFUNCTION
User avatar
loste juliana
 
Posts: 3417
Joined: Sun Mar 18, 2007 7:37 pm


Return to V - Skyrim