[?] Adding abilities via scripts.

Post » Mon Mar 14, 2011 4:46 pm

Since I got no replies on the other forum, I'm bringing a very stupid question here.

With Auriana_Valoria1's blessing, I've decided to modify the "Nerevarine's Powers" mod so that rather than just gaining the abilities by console, you'll gain the Nerevar's Spirit ability after obtaining Moon and Star, and the Azura's Blessing ability after beating Dagoth Ur. Now I want to be certain I don't screw anything up when I work these in. Any suggestions on what the most low-impact way to add these is?



Now, normally this would be a very simple operation. The problem I'm having is that everything I've looked at that could be used to do this already seems to have a script attached to it. I'm worried that inserting the little bit of code needed to make this work will cause problems down the road. Advice please?
User avatar
Rachie Stout
 
Posts: 3480
Joined: Sun Jun 25, 2006 2:19 pm

Post » Mon Mar 14, 2011 9:52 pm

aren't there journal indexes associated with those points in the main quest?

have a global startup script with two do-once type variables that constantly checks for those journal indexes, and once reached gives the power.

then when both conditions are met, you'd have the script self-terminate.
User avatar
Blackdrak
 
Posts: 3451
Joined: Thu May 17, 2007 11:40 pm

Post » Mon Mar 14, 2011 7:22 pm

I thought of that, but since the time-frame would be the entire Morrowind main quest, it isn't ideal.
User avatar
Inol Wakhid
 
Posts: 3403
Joined: Wed Jun 27, 2007 5:47 am

Post » Mon Mar 14, 2011 3:26 pm

I thought of that, but since the time-frame would be the entire Morrowind main quest, it isn't ideal.


You are touching the scripting for the main quest. Fear should be your constant companion.

That said, examine the game logic carefully to learn how it is currently done - and see if there is room to tweak it. Just keep in mind, this could severely screw up someone's save game.
User avatar
Alberto Aguilera
 
Posts: 3472
Joined: Wed Aug 29, 2007 12:42 am

Post » Mon Mar 14, 2011 11:41 pm

You are touching the scripting for the main quest. Fear should be your constant companion.


I couldn't agree more.

That said, examine the game logic carefully to learn how it is currently done - and see if there is room to tweak it. Just keep in mind, this could severely screw up someone's save game.


I have been doing this. Both the "MoonAndStar" and "AzuraEnd" scripts look like they have sections of one time instructions that I could slip in the addition of an ability to, but I'm not sure if the scripts will function as I expect, and though doing it this way is efficient, it's also harder to test. Unless someone has saves right before each of those points to send me. :rofl:
User avatar
Neko Jenny
 
Posts: 3409
Joined: Thu Jun 22, 2006 4:29 am

Post » Mon Mar 14, 2011 4:41 pm

I couldn't agree more.



I couldn't agree less. Just because it is a main quest script doesn't make it any important than any other quest. That being said, anyone who knows what he's doing with scripting can edit those scripts to add abilities as easy as a pie.

Testing each step trough the main quest....that's another thing. You might want to write down all the script names and item codes into a notebook and simply console your way trough quests in 5 seconds you don't need to test, maybe there's an even easier way.
User avatar
.X chantelle .x Smith
 
Posts: 3399
Joined: Thu Jun 15, 2006 6:25 pm

Post » Tue Mar 15, 2011 1:08 am

I couldn't agree less. Just because it is a main quest script doesn't make it any important than any other quest. That being said, anyone who knows what he's doing with scripting can edit those scripts to add abilities as easy as a pie.

Testing each step trough the main quest....that's another thing. You might want to write down all the script names and item codes into a notebook and simply console your way trough quests in 5 seconds you don't need to test, maybe there's an even easier way.


It's just a pretty common concern, given the Main Quest is (at least in theory) the longest and most intensive quest you'll do...and technically the whole point of the game. Technically.


Anyway, you're right. There is a much easier, and even lazier way to test it. Beta version's done. Cleaned in TESAME.
http://www.4shared.com/file/ca-9RBN0/Beta_of_Nerevarines_Powers_MQ.html
User avatar
Carlos Rojas
 
Posts: 3391
Joined: Thu Aug 16, 2007 11:19 am

Post » Mon Mar 14, 2011 9:27 pm

It's just a pretty common concern, given the Main Quest is (at least in theory) the longest and most intensive quest you'll do...and technically the whole point of the game. Technically.


Anyway, you're right. There is a much easier, and even lazier way to test it. Beta version's done. Cleaned in TESAME.
http://www.4shared.com/file/ca-9RBN0/Beta_of_Nerevarines_Powers_MQ.html


Hah. Glad you sorted it out :)
User avatar
Kat Ives
 
Posts: 3408
Joined: Tue Aug 28, 2007 2:11 pm

Post » Mon Mar 14, 2011 7:41 pm

Semi-sorted. I figure the fastest way to spot problems is to let other people see if it works.
I'm fairly sure that Nerevar's Spirit will assign correctly, but I have doubts about Azura's Blessing.
User avatar
WYatt REed
 
Posts: 3409
Joined: Mon Jun 18, 2007 3:06 pm

Post » Tue Mar 15, 2011 1:34 am

This would probably better be moved to the http://www.gamesas.com/index.php?/forum/11-construction-set-morrowind/. Anyway.
To add abilities to player, you are missing player-> reference before addspell
Also there is no need to touch standards scripts.
1) attach a local script like this to a invisible activator (for instance the same invisible mesh used by menu sound emitters, EditorMarker.nif) put in "Cavern of the Incarnate" interior cell
begin ketwAANP1ScriptDontSaveObjectfloat timerif ( MenuMode )	returnendifif ( timer < 1 )	set timer to ( timer + GetSecondsPassed )	returnendifset timer to 0if ( GetJournalIndex A2_6_Incarnate < 50 )	returnendifif ( player->GetSpellEffects "avkw_np_nerevarspirit" )	returnendifplayer->addspell "avkw_np_nerevarspirit"	end


2) attach your script to an invisible activator near the "azura spirit" activator in "Dagoth Ur, Facility Cavern"

begin ketwAANP2ScriptDontSaveObjectfloat timerif ( MenuMode )	returnendifif ( timer < 1 )	set timer to ( timer + GetSecondsPassed )	returnendifset timer to 0if ( GetJournalIndex C3_DestroyDagoth < 50 )	returnendifif ( player->GetSpellEffects "avkw_np_azurabless" )	returnendifplayer->addspell "avkw_np_azurabless"	end

User avatar
Claire Lynham
 
Posts: 3432
Joined: Mon Feb 12, 2007 9:42 am

Post » Mon Mar 14, 2011 7:49 pm

say, what is the purpose of the timer variable in those scripts? it doesent look to my novice eyes like it does anything.
User avatar
Princess Johnson
 
Posts: 3435
Joined: Wed Feb 07, 2007 5:44 pm

Post » Tue Mar 15, 2011 12:51 am

Sorry. It was a quick and dirty way to generate some feedback, I'm afraid. I didn't honestly think that was a good way of doing it in the first place, and quite frankly, I apologize for it.

EDIT:
say, what is the purpose of the timer variable in those scripts? it doesent look to my novice eyes like it does anything.



If I'm reading it right, it forces a delay on the activation of the script. To reduce the likelihood of errors, I think? In any case, thank you abot, those scripts look much better than the templates I've been smacking my brain against. Which means I'm either clueless, sleep deprived...or more likely both.

I think the only possible change I could make to those is to add in some sort of indicator to tell you the ability was added, and it isn't really necessary.
User avatar
sally R
 
Posts: 3503
Joined: Mon Sep 25, 2006 10:34 pm

Post » Mon Mar 14, 2011 9:24 pm

If I'm reading it right, it forces a delay on the activation of the script. To reduce the likelihood of errors, I think?
Stripping the timer part would probably cause no errors, it is just something to avoid executing the core of the script ( if ( GetJournalIndex and below ) each and every frame. In this particular case, as the core of the script has only fast enough commands, the delay could be skipped, I used it mainly to show a simple way to add delay. Here is the simpler version, I think there would be no noticeable FPS difference between the 2 versions
begin ketwAANP1Scriptif ( MenuMode )	returnendifif ( GetJournalIndex A2_6_Incarnate < 50 )	returnendifif ( player->GetSpellEffects "avkw_np_nerevarspirit" )	returnendifplayer->addspell "avkw_np_nerevarspirit"	end
[EDIT]or, instead of a timer we could use the classic "do once" approach, this way we would have to store the doOnce variable in the saved game though, so no DontSaveObject, something like this for instance
begin ketwAANP1Scriptshort doOnceif ( doOnce )	returnendifif ( MenuMode )	returnendifif ( GetJournalIndex A2_6_Incarnate < 50 )	returnendifif ( player->GetSpellEffects "avkw_np_nerevarspirit" )	returnendifplayer->addspell "avkw_np_nerevarspirit"set doOnce to 1	end



P.S. it is not necessary to really finish the main quest to test the scripts; as the only real condition is related to a quest index, you can just go to the proper interior cells and set the quest index from game console writing
Journal A2_6_Incarnate 50
and
Journal C3_DestroyDagoth 50

User avatar
Lil'.KiiDD
 
Posts: 3566
Joined: Mon Nov 26, 2007 11:41 am

Post » Mon Mar 14, 2011 3:10 pm

oh, i get it now. but wouldent setting the timer to 0 right after you set it to GetSecondsPassed let the core execute every other frame anyway?

the flow of it, again, to my novice eyes looks like

check timer
set timer to GetSecondsPassed (timer starts at 0)
return

next iteration

check timer
set timer to 0
execute core

and from there, the script executes this sequence ad infinitum. basically getting to the core every other frame, or is there something i'm not understanding? is this a way to do smaller, more optimized "doonce" things, impacting save game size as little as possible?
User avatar
TASTY TRACY
 
Posts: 3282
Joined: Thu Jun 22, 2006 7:11 pm

Post » Mon Mar 14, 2011 8:14 pm

or is there something i'm not understanding?
the return command immediately stops script execution until next frame
User avatar
Dean
 
Posts: 3438
Joined: Fri Jul 27, 2007 4:58 pm

Post » Tue Mar 15, 2011 1:40 am

yes, i understand return stops script execution till next frame, where the script runs again from the beginning.

meaning that on the 2nd frame, 4th frame, 6th frame, and so on, to infinity, you have the "core" executing.

i would have done it a bit differently myself.

something like

begin ketwAANP1Scriptshort delayshort DoOnceif ( MenuMode == 1 )	returnendifif ( delay == 0 )	set delay to 1	returnendifif ( player->GetSpellEffects "avkw_np_nerevarspirit" )	stopscript ketwAANP1Script	returnendifif ( doonce == 0 )	if ( GetJournalIndex A2_6_Incarnate > 50 )		player->addspell "avkw_np_nerevarspirit"		set doonce to 1	endifelse	stopscript ketwAANP1Scriptendif	end


i guess it just showcases either my inexperience, or our different takes on performing the same action.
User avatar
Euan
 
Posts: 3376
Joined: Mon May 14, 2007 3:34 pm

Post » Tue Mar 15, 2011 4:50 am

yes, i understand return stops script execution till next frame, where the script runs again from the beginning.

meaning that on the 2nd frame, 4th frame, 6th frame, and so on, to infinity, you have the "core" executing.

i would have done it a bit differently myself.

something like

begin ketwAANP1Scriptshort delayshort DoOnceif ( MenuMode == 1 )	returnendifif ( delay == 0 )	set delay to 1	returnendifif ( player->GetSpellEffects "avkw_np_nerevarspirit" )	stopscript ketwAANP1Script	returnendifif ( doonce == 0 )	if ( GetJournalIndex A2_6_Incarnate > 50 )		player->addspell "avkw_np_nerevarspirit"		set doonce to 1	endifelse	stopscript ketwAANP1Scriptendif	end


i guess it just showcases either my inexperience, or our different takes on performing the same action.
Well, if you prefer to use a global script, there should be no real problem. I'd use local scripts, because quest actions (journal changes) already come from local scripts attached to activators in those cells, so there is no need to have a global script running.
User avatar
Jarrett Willis
 
Posts: 3409
Joined: Thu Jul 19, 2007 6:01 pm

Post » Mon Mar 14, 2011 6:50 pm

yes, i like to trigger globals from local activators. i'd guess it's the same effect as DontSaveObject. thanks for broadening my horizons, i've definitely learned something here =D
User avatar
Petr Jordy Zugar
 
Posts: 3497
Joined: Tue Jul 03, 2007 10:10 pm

Post » Tue Mar 15, 2011 2:23 am

global vs local script apart, which is a matter of preference, I think if maybe you have still not so clear how timer works, a messagebox to track vars could help, try something like
begin timerTestfloat timershort frameif ( timer < 5 )	set timer to ( timer + GetSecondsPassed )	set frame to ( frame + 1 )	messagebox "frame=%g, timer=%.4f"	returnendifmessagebox "frame=%g, timer=%.4f" "ok"set frame to 0set timer to 0end

User avatar
Karl harris
 
Posts: 3423
Joined: Thu May 17, 2007 3:17 pm


Return to III - Morrowind