need some help with a script

Post » Fri Aug 21, 2009 8:09 am

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

User avatar
Cesar Gomez
 
Posts: 3344
Joined: Thu Aug 02, 2007 11:06 am

Post » Fri Aug 21, 2009 8:33 am

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.
User avatar
BEl J
 
Posts: 3397
Joined: Tue Feb 13, 2007 8:12 am

Post » Thu Aug 20, 2009 7:08 pm

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
User avatar
joeK
 
Posts: 3370
Joined: Tue Jul 10, 2007 10:22 am

Post » Fri Aug 21, 2009 4:52 am

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.
User avatar
Steve Bates
 
Posts: 3447
Joined: Sun Aug 26, 2007 2:51 pm

Post » Thu Aug 20, 2009 11:42 pm

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

User avatar
Chris Duncan
 
Posts: 3471
Joined: Sun Jun 24, 2007 2:31 am


Return to III - Morrowind