Creating another script, now im better... but for this one..

Post » Tue May 08, 2012 2:51 am

Ok, hi again, now i want to do a new script, for transmutting a green glass set, into a blue one(not really transmutting).
So if i remember well, there is a catch to do something like that to avoid issue, when we play with the unequip function...
I need to know how to make a statement that will check if the item is enchented.
I need to know exactly what i need to do to avoid bug with unequip (if i remember well, there was something about unequiping when on a horse, and a lot more)
And i also need a way to detect if the item has a stolen flag, then applict the stolen flag again to the new item.

So basically, it will be a scroll or a potion, that when we drink it, it will check if the player got the corresponding armor part/weapon part, then it will check if its enchented. If its enchented, it will do nothing(i mean, custom made enchentement, since already enchented item are not the same item). If not enchented, it will do the appropriate way to unequip the item(need to know what is the appropriate way), check if its stolen, remove the item from player inventory, replace with the new one, then apply stolen flag if necessery.
But also, i don't want that if requirement is not meet that the scroll disappear without doing nothing.
User avatar
Flesh Tunnel
 
Posts: 3409
Joined: Mon Sep 18, 2006 7:43 pm

Post » Mon May 07, 2012 5:27 pm

You can check if an item is enchanted by using the OBSE function "GetEnchantment". If the item is not enchanted, then the function would return 0.

I don't know how you can solve the inability to unequip weapons while on a horse. Maybe you should just not allow the player to drink your potion while mounted.

And you can detect if an item is stolen with GetOwner. If the item has an owner and the owner is not the player, then it's stolen.
User avatar
AnDres MeZa
 
Posts: 3349
Joined: Thu Aug 16, 2007 1:39 pm

Post » Mon May 07, 2012 7:07 pm

How can i give a stolen flag? I remember that when navigating on the oficial CS wiki, i found a script for upgrading weapon, i will use it as a base, only need to modify it a little:

scn short LVLBegin GameMode	if ( LVL != player.getlevel )		set LVL to player.getlevel	endif	if ( player.IsRidingHorse == 0 )		if ( player.getitemcount IDofLowLevelItem > 0 && LVL >= MinLevelForReplacing )			if ( player.getequipped IDofLowLevelItem == 1 )				player.unequipitem IDofLowLevelItem				player.removeitem IDofLowLevelItem 1				player.additem IDofBetterItemOrLeveledList 1				player.equipitem IDofBetterItem			else				player.removeitem IDofLowLevelItem 1				player.additem IDofBetterItemOrLeveledList 1			endif		endif	endifend

Only need to replace the thing about lvl by check if enchanted, remove the lvl variable, and add the stolen thing, convert the script to a spell, add it to a scroll, and done. Ok so now i have a way to know if its stolen or not, but how can i make the given item stolen?
User avatar
Flesh Tunnel
 
Posts: 3409
Joined: Mon Sep 18, 2006 7:43 pm

Post » Tue May 08, 2012 2:33 am

My new version, not sure if it will work well, can someone said me if its written properly?

scn   short switchedBegin ScriptEffectStart         if ( player.IsRidingHorse == 0 && player.getitemcount OLDITEM > 0)                 if ( check if enchanted ) ;if not enchanted, continue, else, go to the next statement                        if ( player.getequipped IDofLowLevelItem == 1 )                                 player.unequipitem OLDITEM                                 player.removeitem OLDITEM 1                                 player.additem ITEM 1                                 player.equipitem ITEM				set switched to 1                        else                                 player.removeitem OLDITEM 1                                player.additem ITEM 1				set switched to 1                        endif                endif        endifendBegin ScriptEffectFinish	if (switched == 1)		player.additem SCROLL ;add scroll back, since it was unable to switch item		set switched to 0	endifend

Only need to adjust the check if enchented, and later, add the thing about ownership.
User avatar
Terry
 
Posts: 3368
Joined: Mon Jul 09, 2007 1:21 am


Return to IV - Oblivion