Jump to content

Need a script? Maybe I can help.


fg109

Recommended Posts

Hey again, fg. First of all, thanks for helping me earlier. Now I have 2 ideas, choose the one being the most practical.

 

I need a script that shows a textbox when you activate a certain misc. object. Remember my older topic where I asked something like a textbox that shows up when you reach certain level? I changed the idea, and now you have to use a misc. object for the script to run, and it will show you a textbox depending on your level.

 

e.g. you activate the misc object - the script runs, checks your level, if it is less than 8, it shows x, if not and your level is less than, say, 20 then it displays y, if not and your level is less than 32 it displays z, etc.

 

Also, I'm not sure if this is going to be easier than the first idea, but what about a book that displays the text inside it depending on your level? Just like the above script, but when you read the book. I mean, you can attach scripts to books, is it possible to make this script?

Edited by Omeletter
Link to comment
Share on other sites

  • Replies 272
  • Created
  • Last Reply

Top Posters In This Topic

@Omeletter

 

You cant activate any MiscObjects (technically equipping). You get the message "You cannot equip this item" if you try anyway so I know that MiscObjects recognize mouse clicks in inventory. I wonder if there is a way to make an exception.

 

If you check out my last post you can use what you can from my script. You can run expressions when a MiscObject is picked up or dropped by the player. :psyduck:

Link to comment
Share on other sites

@kryptopyr

 

I suggest that you try lowering the follower's aggressiveness first, and then try to use a hold position package. Perhaps you should even make a new package instead of using the regular default package. Make a package template with the follow procedure (following the player) with the condition "IsInCombat == 0", and a hold position procedure (location near PlayerRef) when "IsInCombat == 1". Then check the flag for "Ignore Combat".

 

His aggressiveness is already set to Unaggressive. I'll try the Hold Position package set as you described and see if that works. Thanks!

Link to comment
Share on other sites

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment

;NEXT FRAGMENT INDEX 1

Scriptname PF_NomadHealingSpell1_01001D9F Extends Package Hidden

 

;BEGIN FRAGMENT Fragment_0

Function Fragment_0(Actor akActor)

;BEGIN CODE

akActor.SetFactionRank(000TestFaction1)1

akActor.EvaluatePackage()

;END CODE

EndFunction

;END FRAGMENT

 

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

 

Fixed everything but the "RPAREN" order. the error is displayed as follows:

 

Starting 1 compile threads for 1 files...

Compiling "PF_NomadHealingSpell1_01001D9F"...

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PF_NomadHealingSpell1_01001D9F.psc(8,26): extraneous input 'TestFaction1' expecting RPAREN

No output generated for PF_NomadHealingSpell1_01001D9F, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on PF_NomadHealingSpell1_01001D9F

 

Not sure what I'm missing, but sounds relatively simple, at least! Thanks for your time!

 

PS: All the spellscripts have the exact same error messages, so I think I might have mis-typed something, but not sure what...

Link to comment
Share on other sites

@ArcaneSmith

 

After doing some tests, I'm inclined to agree that the RemoveAddedForm function is bugged. I think you might have to change to using arrays.

 

 

@Omeletter (and scrivener07)

 

Activating misc objects in the inventory does fire the OnEquipped event. Yes, the message "You cannot equip this item." is shown, but whatever code you have in the script of that item still runs.

 

 

Message Property MessageBox01 Auto
Message Property MessageBox02 Auto
Message Property MessageBox03 Auto
;etc.

Event OnEquipped(Actor akActor)
if (akActor.GetLevel() < 8)
	MessageBox01.Show()
elseif (akActor.GetLevel() < 20)
	MessageBox02.Show()
elseif (akActor.GetLevel() < 32)
	MessageBox03.Show()
else
	;etc.
endif
EndEvent

 

 

A warning though, don't try to attach a script like this to something with a lot of instances in the world (eg lockpicks or gold). As for books, I suggest silently removing and adding books to the player depending on what level he/she is. Otherwise, you might want to take a look at Text Replacement.

 

 

@avenger404

 

akActor.SetFactionRank(000TestFaction1)1

 

should be

 

akActor.SetFactionRank(000TestFaction1, 1)

Link to comment
Share on other sites

Thanks for your time, mate. Arrays probably won't do for me because the ck wiki says I can only create them using literal integers. In other words, can't create them dynamically at run time, can I? My idea was to create a centralized reward system for my mod. People making plugins would have the following function fire up and add their books to the reward list (this one works just fine)

 

FUNCTION InjectList(FormList akToInject, FormList akInjected)

Debug.Messagebox(akInjected.GetSize())


int L1Size = akToInject.GetSize()
int L1Pos = 0


While (L1Pos < L1size)
akInjected.AddForm(akToInject.GetAt(L1Pos) as book)
L1Pos += 1
endwhile

lorecraftTestContainer.AddItem(akToInject)

Debug.Messagebox(akInjected.GetSize())


EndFunction

 

Then the reward script in the main mod would reward a random item from this list and remove it using removeAddedForm() like I have shown before. If the stupid function was working it would be pretty damn simple and elegant way of not giving repeated rewards.

 

How should I go about this using arrays then? Or any other way to get this done without using form lists?

 

 

If you can't help me or if i'm abusing the help, just let me know so I stop spamming you :P

 

(by the way would you know if form lists and leveled lists have a maximum length or if i can add stuff to them ad infinitum?)

Edited by ArcaneSmith
Link to comment
Share on other sites

Nothing. Here's the modified script again, followed by the error list. Have to go to work, but will check afterwards. So sorry this is being so picky. This is in the "Package window:Begin/End/Change Tab: On End papyrus fragment" section. It may have to be moved, which could be the issue.

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment

;NEXT FRAGMENT INDEX 1

Scriptname PF_NomadHealingSpell1_01001D9F Extends Package Hidden

 

;BEGIN FRAGMENT Fragment_0

Function Fragment_0(Actor akActor)

;BEGIN CODE

akActor.SetFactionRank(000TestFaction1, 1)

akActor.EvaluatePackage()

;END CODE

EndFunction

;END FRAGMENT

 

 

Followed by the Compiler errors

 

Starting 1 compile threads for 1 files...

Compiling "PF_NomadHealingSpell1_01001D9F"...

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PF_NomadHealingSpell1_01001D9F.psc(8,26): missing RPAREN at 'TestFaction1'

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PF_NomadHealingSpell1_01001D9F.psc(8,38): required (...)+ loop did not match anything at input ','

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PF_NomadHealingSpell1_01001D9F.psc(8,41): required (...)+ loop did not match anything at input ')'

No output generated for PF_NomadHealingSpell1_01001D9F, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on PF_NomadHealingSpell1_01001D9F

 

 

Whatever the error is, it's consistent with all the spells I'm trying to script. Thanks again for all your help thusfar...

Link to comment
Share on other sites

Unfortunately, the hold position package didn't work the way I wanted it to. I tried several of the HoldPositionWithTravel packages with the player as reference. I tried using the condition IsInCombat = 1. I tried using various combinations of flags including Ignore Combat, Always Sneaking, and No Combat Alert. I also tried both setting the package to Interrupt Override Combat and without.

 

There were three different types of behavior: My follower would either act no differently than normal...rushing into combat, running ahead to pursue enemies, etc. Or he would run toward the enemy, weapons drawn as if to attack, then stop when he got to the enemy, sheath weapons and stand there (sometimes running back toward me, only to repeat the process). And finally sometimes he would refuse to sneak or follow me at all. I don't want to completely prevent him from attacking. I was just hoping that I could get him to wait to attack until the enemy was within a certain distance...and/or only attack if the player was fully detected and any sneak advantage had been lost.

 

I also tried using the condition player IsSneaking = 1 instead of IsInCombat. Using this condition with the Override Combat was probably the closest to what I'm looking for. If my character was sneaking, then my follower wouldn't attack at all, even if he was being attacked. If I stood up out of sneak mode, then he would attack like normal. There was generally an obvious delay though; he wouldn't immediately respond to the player's actions. Is there any way to take this package and reduce the delay so he responds more quickly to the player's actions? And is there a way to get him to go into combat mode if he is directly attacked?

 

Thank you so much for your time and help!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...