Page 1 of 1

need some help with a script

PostPosted: Fri Aug 21, 2009 8:09 am
by Cesar Gomez
So i'm trying to create a script that adds a spell to the player's list when wraithguard is equipped. that works fine. however the next part of the script is supposed to have an amulet that the player can wear instead of wraithguard while removing the guantlet wraithguard from the player's inventory. i created a spell and created a script to workj when the spell's effects are active, however i can not get it to work. I continue to get an EXPRESSION and Left Eval error when i start up the game. here's what the script currently looks like, i haven't tried to finish it yet. any help would be appreciated.

begin wraithguard_change


if ( Player->HasItemEquipped "wraithguard" == 1 )
Player->AddSpell "wraithguard_change"
endif

if ( Player->HasItemEquipped "wraithguard" == 0 )
Player->RemoveSpell "wraithguard_change"
endif

if ( Player->HasItemEquipped "wraithguard" == 1 )
if ( Player->GetSpellEffects, "wraithguard_change" == 1 )
player->additem "wraithguard_amulet" 1
player->removeitem "wraithguard" 1
endif
endif

end


need some help with a script

PostPosted: Fri Aug 21, 2009 8:33 am
by BEl J
Your syntax isn't very consistent, and I think that is the problem. Here are some examples:

if ( Player->HasItemEquipped "wraithguard" == 1 )    if ( Player->GetSpellEffects, "wraithguard_change" == 1 )


When calling the HasItemEquipped function, you had no comma. When calling the GetSpellEffects function, you did.

        player->additem "wraithguard_amulet" 1        player->removeitem "wraithguard" 1


These two calls are inconsistent with the rest of the script because you used different cases.

TES Scripting tolerates different casing and use of commas, etc, so long as you are consistent. If you aren't, sometimes the compiler will return errors. Hope that helps.

need some help with a script

PostPosted: Thu Aug 20, 2009 7:08 pm
by joeK
i fixed what you said, however that didn't stop the error. I've tried to fix the error with a different script, however i still get it.

begin wraithguard_changeif ( Player->HasItemEquipped "wraithguard" == 1 )	Player->AddSpell "wraithguard_change"endifif ( Player->HasItemEquipped "wraithguard" == 0 )	Player->RemoveSpell "wraithguard_change"endifif ( Player->HasItemEquipped "wraithguard" == 1 )	if ( Player->GetSpellEffects "wraithguard_change" == 1 )		player->additem "wraithguard_amulet" 1	endifendifif ( Player->HasItemEquipped "wraithguard" == 1 )	if ( Player->GetSpellEffects "wraithguard_change" == 1 )		player->removeitem "wraithguard" 1	endif	endifend


this still does not add the amulet to the inventory as hoped

need some help with a script

PostPosted: Fri Aug 21, 2009 4:52 am
by Steve Bates
Do you mean that Expression and Left Eval error still are displayed, or that the script simply doesn't do what it must? If the former, I can only recommend you to comment out some parts of your script (no matter that it won't be functional) and try the game until you localize the part that causes the error.

As for the script itself, it won't work. As soon as you wear the amulet it causes removing the gauntlet *completely* from your inventory. As soon as the gauntlet is removed, it causes the spell to be removed as well. try to follow the logic of your script, and remember that it runs every frame.

need some help with a script

PostPosted: Thu Aug 20, 2009 11:42 pm
by Chris Duncan
Just to be extra nice to the compiler, try this:

begin wraithguard_changeshort useWGshort hasSpellSet useWG To "player"->HasItemEquipped "wraithguard"Set hasSpell To "player"->GetSpell "wraithguard_change"Set useSpell To "player"->GetSpellEffects "wraithguard_change"if ( useWG > 0 )    if ( hasSpell == 0 )        "player"->AddSpell "wraithguard_change"        Set hasSpell To 1    else        if ( useSpell > 0 )            "player"->RemoveItem "wraithguard"            "player"->AddItem "wraithguard_amulet"            "player"->RemoveSpell "wraithguard_change"            Set useWG To 0            Set hasSpell To 0            Set useSpell To 0        endif    endifelse    if ( hasSpell == 1 )        "player"->RemoveSpell "wraithguard_change"        Set hasSpell To 0    endifendifend