Jump to content

Need Help Bad


Ranokoa

Recommended Posts

Well I have a mod that uses 2 small scripts. One is supposed to give the player a permanent +10 magicka on cast given certain conditions, and another is supposed to add that spell that does that to the player

 

Well it 75% works. The item giving the spell is a book, but when you activate it, it certainly gives the spell, and only one time, but it will not open the book to read it ever. Not before, or after you get the spell. If you already have the spell and activate the book nothin happens, if not.. well you get the spell.

 

The spell works half way. It reads the conditions and does give the player 10 more magicka, but not a permanent 10. So my char gets a 270/260 magicka, rather than 260/270.

 

I used the Return command on the book after the spell is given and if the spell is already given in hopes that that is what I use to make you able to read the book. Apparently not. What command do I use so that the book is read when activated but the script runs?

 

Also, its obviously not player.modav magicka 10, cause thats just temporary magicka. Setav would just force it down to 10 permanentally, do I use set +10? or what?

 

Be well, sleep well, fight well, live long.

~Ranokoa

Link to comment
Share on other sites

Well I have a mod that uses 2 small scripts. One is supposed to give the player a permanent +10 magicka on cast given certain conditions, and another is supposed to add that spell that does that to the player

 

Well it 75% works. The item giving the spell is a book, but when you activate it, it certainly gives the spell, and only one time, but it will not open the book to read it ever. Not before, or after you get the spell. If you already have the spell and activate the book nothin happens, if not.. well you get the spell.

 

The spell works half way. It reads the conditions and does give the player 10 more magicka, but not a permanent 10. So my char gets a 270/260 magicka, rather than 260/270.

 

I used the Return command on the book after the spell is given and if the spell is already given in hopes that that is what I use to make you able to read the book. Apparently not. What command do I use so that the book is read when activated but the script runs?

 

Also, its obviously not player.modav magicka 10, cause thats just temporary magicka. Setav would just force it down to 10 permanentally, do I use set +10? or what?

 

Be well, sleep well, fight well, live long.

~Ranokoa

Setav and Modav don't work too reliably with scripting. Your best bet is to just impart an ability with 10 fortify magicka.

 

For the book script. Books and most inventory items can be triggered in 2 ways, either through an onactivate block or onequip block. onactivate will trigger when the book is targeted and used from within the world, onequip will trigger when the book is used from inventory. Both will interfere with reading the book, so should be followed by an activate or equipitem this to continue with normal function.

 

I use something like this within my halloween mod, and coulda sworn we talked about this when you were cluttering one of the houses for The Colored Rooms (adding gems to inventory when reading a book).

 

The script from my halloween mod (begun upon reading a book on a stand, with the effect occuring after the book has been read and closed)

 

scn VG0RiotBookEnterScript

short count
short count2
short delay

Begin Onactivate
If count == 0
If count2 == 0
	set count to 1
	activate
endif
endif
end

Begin menumode
if count == 1
	if count2 == 0
		set count2 to 1
	endif
elseif count == 2
	set count2 to 2
endif
end

Begin Gamemode
if count == 1
	if count2 == 1
		Set count to 2
		set delay to 8
		triggerhitshader 1
		startquest VG0RiotTrackerQUEST
		messagebox "You feel a sudden onset of dizziness wash over you."
	endif
elseif count == 2
	if count2 == 2
		if delay <= 1
			if VG0RiotResetguy.getfactionrank VG0Riottestfaction == 1
					VG0RiotResetguy.setfactionrank VG0Riottestfaction 2
					player.setfactionrank VG0Spawncounter 0
			elseif VG0RiotResetguy.getfactionrank VG0Riottestfaction == 2
					VG0RiotResetguy.setfactionrank VG0Riottestfaction 1
					player.setfactionrank VG0Spawncounter 0
			endif
		set count to 0
		set count2 to 0
		player.moveto VG0RiotEnteranceMarker
		elseif delay > 1
			triggerhitshader 1
			set delay to delay - 1
		endif
	endif
endif
end

 

Try not to be too confused by the faction stuff, that was just needed in this case to handle a simple logic check.

 

Hope this helps.

Link to comment
Share on other sites

I know I way you could make the book readable AND give you a spell (I think), but not really the details. What you should try is making a script so when you read the book, it gives you a message box which will give you a choice or something, then give you the spell if you select yes. I don't know how to do that, but I've seen it in another mod so I know it's possible.
Link to comment
Share on other sites

ya the whole tomes from the dlc.

 

The book script you are thinking about is this:

scn bookscript

short hasread
short button
short doonce
short messageread

Begin Onactivate
if isActionRef player == 1
	if doonce == 0
		Messagebox "Upon opening the book you find a hallowed out hole with a few shiny gems inside." "Take the gems" "Leave them alone"
		set messageread to 1
endif
	if doonce == 1
		activate
	endif
endif
end

Begin Gamemode
if messageread == 1
		set button to GetButtonPressed
if ( Button == 0 )
	player.additem Gem5Emerald 2
	player.additem Gem1Pearl 1
	player.additem Gem3RubyFlawed 1
	set doonce to 1
	set messageread to 2
endif
if ( Button == 1 )
	set messageread to 0
endif
endif
end

 

Actually.. I think I will just use this script lol. Much simpler. And yes it was used for a bakery in the Colored Rooms, I believe. Coulda been a library... idk.

 

Anyways it can not be a magicka multiplier for several reasons, all of which will be apparent when the mod is complete shortly. I'll find a way, I suppose.

 

EDIT: Here is the new script.

 

scriptname RSoulScript

short hasread
short button
short doonce
short messageread

Begin Onactivate
if isActionRef player == 1
	if doonce == 0
		Messagebox "You feel a power wanting to take hold of you." "Let the power in" "Fight the power off."
		set messageread to 1
	endif
		if doonce == 1
		activate
	endif
endif
end

Begin Gamemode
if messageread == 1
	set button to GetButtonPressed
if ( Button == 0 )
	player.addspell RSoulSpell
	set doonce to 1
	set messageread to 2
endif
	if ( Button == 1 )
	set messageread to 0
endif
endif
end

Link to comment
Share on other sites

Make it as Vagrant0 says, define another spell in the CS of the type "Ability", and give it Fortify Magicka 10. Then you'd need a script for the spell the player learns, so when s/he casts it, the script adds that ability spell to the player.

 

PS: to make it clear, spell of the type "ability" can't be cast, they simply apply.

Link to comment
Share on other sites

I know very well about spell types and such. The problem is, as I suppose I will elaborate but hate to, this:

 

For one, the reason I do not elaborate normally is to not ruin the surprise of the mod itself. But here is what happens.

 

The book adds a spell, the spell makes it so when you cast it you "consume" the soul within a black soulgem to make yourself more powerful little by little. Basically, every "soul" is 10 magicka, and if it is an ability it will either stack awkwardly and you will plainly see each and every add, and if given a certain number of adds will be too long of a list. Or it will simply replace the first ability with the same one, making you only ever able to have +10 magicka no matter how many "souls" you consume.

 

What I do not know, is anything about "fortify magicka multiplier".. What does this do, never knew, never needed to, and could it solve this problem?

Link to comment
Share on other sites

If I can't get it to work right I will just use OBSE.

That just might be the only solution here, then you can just increment the effect of the ability. Anything else, even those using setav and modav OBSE variants is still prone to issues if the actor has any effects on them that change magicka value.

 

Unfortunately, I can't help you much on that end of things.

Edited by Vagrant0
Link to comment
Share on other sites

Sorry about this but in scripts why do they have these gaps, is there a need for this... is so then what?

 

Example.

Begin Onactivate

here if isActionRef player == 1

and here if doonce == 0

 

?

 

Thanks in advance for a helpful answer.

Link to comment
Share on other sites

You mean the spacing? Or the indentations.

 

Two reasons for both:

 

One:

This is just simpler to read. If the code is like a block paragraph it makes it harder to read. Example of easier to read:

Scriptname Example1

Short DoOnce

Begin OnActivate
  if DoOnce == 0
   if (player.getitemcount Gold001 >= 100)
	  Player.removeitem gold001 100
	  player.additem somesword 1
	  message "you have purchased a sword"
	  set DoOnce to 1
   elseif DoOnce == 1
	  message "You have already bought this item"
   elseif (player.getitemcount gold 001 <= 99)
	  message "You do not have enough money"
   endif
endif
endif
endif
end

 

It's readable, and easy to understand and not get lost.

 

If you just have

Scriptname Example2

Short DoOnce

Begin OnActivate
if DoOnce == 0
if (player.getitemcount Gold001 >= 100)
Player.removeitem gold001 100
player.additem somesword 1
message "you have purchased a sword"
set DoOnce to 1
elseif DoOnce == 1
message "You have already bought this item"
elseif (player.getitemcount gold 001 <= 99)
message "You do not have enough money"
endif
endif
endif
endif
end

 

It's a little harder to read, and depending on the length of the script, can be impossible.

 

The spacing between

scriptname example3

Short DoOnce

Begin OnActive

 

is absolutely essential. the script will not work properly without that indentation. But the spacing from the line beginning to the first letter is technically optional. Generally the "ifs" "else" "elseif" and "endif" are going to begin a new indentation amount so you can easily find quickly the new variables to the function. Capitalization is also optional, but just makes things easier. For all the script cares you can make it say BeGiN oNaCtIvAtE, but simply Begin OnActivate makes it easier to read. This is especially useful when the line of code is pretty long for its function, it allows you to quickly spot the places of change and variable.

 

I am not sure if this script will run, lol. I wrote it quickly and my hands are freezing, I might have messed up somewhere. Also I really need to urinate so I was rushed. I think it's right but it doesn't matter, it is just an example of script indentation and spacing, not function.

 

Little elaboration:

Generally for each new if, you indent a little more. Most scripters use the Tab key, cause its quick. Can't do that here though cause tab doesn't space in the forums it selects a new link. For each endif, or Else, or Elseif, scripters usually subtract one indent.

 

Example 3

scriptname example3

Short DoOnce

Begin GameMode
if DoOnce == 0
	if (player.getav health <= 80)
		Message "you are dieing"
		set DoOnce to 1
endif
endif
if DoOnce == 1
	if (player.getav health >= 20)
		message "you are close to death and are being teleported to safety"
		Player.coc safetyworld
		set DoOnce to 2
	endif
endif
	if DoOnce == 2
		Set DoOnce to 0
endif
end

 

A lot of that script is hooey but it is another example with less really going on and a lot more "if"s to show you the purpose of indentation and it's usage. Again, the script will work regardless of how little or much the spacing is.

 

Be well, sleep well, fight well, live long.

~Ranokoa

 

Feel free to Kudos if this was helpful enough to solve your problem and inquiry and worth a kudos.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...