choosing the highest out of 5 skills

Post » Sat Jul 16, 2011 4:44 am

Hi, ive been working on a small mod, that adds in Zanpaktou-like swords, from the anime bleach, at the moment im stuck with a single bit of script im trying to make a spell that gives you a different weapon depending on which of the 5 following skills are highest blade, blunt, marksman, destruction and alchemy

below is one of the attempts at getting this to work, any insights would be incredibly usefull, thanks in advance

Ogliss

if ( getav blade > getav blunt && getav marksman && getav destruction && getav alchemy )
player.additem ZPTBladeShikai 1
player.Equipitem ZPTBladeShikai
elseif ( getav blunt > getav blade && getav marksman && getav destruction && getav alchemy )
player.additem ZPTBluntShikai 1
player.Equipitem ZPTBluntShikai
elseif ( getav marksman > getav blade && getav blunt && getav destruction && getav alchemy )
player.additem ZPTMarksmanShikai 1
player.Equipitem ZPTMarksmanShikai
elseif ( getav destruction > getav blade && getav marksman && getav blunt && getav alchemy )
player.additem ZPTDestructionShikai 1
player.Equipitem ZPTDestructionShikai
elseif ( getav alchemy > getav blade && getav marksman && getav destruction && getav blunt )
player.additem ZPTAlchemyShikai 1
play
User avatar
Kim Bradley
 
Posts: 3427
Joined: Sat Aug 18, 2007 6:00 am

Post » Fri Jul 15, 2011 8:24 pm

You have to check every condition against something.
And making a variable for each attribute makes the coding easier and more effecient.
You also need to specify the reference as the player, unless you are running the script 'on' the player.
And what happens when your highest two attributes are the same value?
And lastly, you cannot equip an item in the same execution frame that you add it to the player. It will not work.

set mybla to player.getAv bladeset myblu to player.getAv bluntset mymar to player.getAv marksmanset mydes to player.getAv destructionset myalc to player.getAv alchemyif mybla >= myblu && mybla >= mymar && mybla >= mydes && mybla >= myalc	player.additem ZPTBladeShikai 1	player.Equipitem ZPTBladeShikaielseif myblu >= mybla && myblu >= mymar && myblu >= mydes && myblu >= myalc	player.additem ZPTBluntShikai 1	player.Equipitem ZPTBluntShikaielseif ...

User avatar
Betsy Humpledink
 
Posts: 3443
Joined: Wed Jun 28, 2006 11:56 am

Post » Fri Jul 15, 2011 6:19 pm

Given the above post, you want something like this:

scn examplescriptref weaponshort valueBegin OnActivate	set weapon to ZPTBladeShikai	set value to Player.GetAV Blade	if (value < Player.GetAV Blunt)		set weapon to ZPTBluntShikai		set value to Player.GetAV Blunt	endif	if (value < Player.GetAV Marksman)		set weapon to ZPTMarksmanShikai		set value to Player.GetAV Marksman	endif	if (value < Player.GetAV Destruction)		set weapon to ZPTDestructionShikai		set value to Player.GetAV Destruction	endif	if (value < Player.GetAV Alchemy)		set weapon to ZPTAlchemyShikai	endif		Player.AddItem weapon 1	EndBegin GameMode	if (weapon)		if (Player.GetEquipped weapon)			set weapon to 0		else			Player.EquipItem weapon		endif	endif	End

User avatar
Sierra Ritsuka
 
Posts: 3506
Joined: Mon Dec 11, 2006 7:56 am

Post » Fri Jul 15, 2011 6:10 pm

OnActivate and GameMode blocks do not run in a spell script.

You need to use ScriptEffectStart.
Finish the script I have above and it should work fine.

The next three elseif conditions will check if mymar, then mydes, then myalc are greater than the other abilities.
User avatar
MISS KEEP UR
 
Posts: 3384
Joined: Sat Aug 26, 2006 6:26 am


Return to IV - Oblivion