scripting woes

Post » Tue Dec 29, 2009 8:09 am

first, the sequence of events, so that if anyone has advice or spots me doing something wrong, you can.

i'm making a mod to make companions available to players for advancing in factions (and eventually to add some nifty functions to being the head of any given faction.) at first, i was going to write a script that allows the player to make any faction member he outranks a tribunal style companion. after this did not work out that well (and after noticing that most faction members would not make ideal companions) i decided that i'd make respawning generic companions available based on rank.

my thought is that i should have the same script handle all of a faction's companions, by attaching the script to each companion NPC. i plan on introducing persistent elements to these companions, so i wrote a global "keepvars" script. i want all companions for a faction to use the same timer variables, so i included timer scripts to my global keepvars script.

i'm using a variable within the local script and dialog to ensure the companion shares and follows (or doesent) according to my stipulations.

for testing purposes, i'm only working with the fighters guild, and only adding the first tier companion to balmora's guildhall. i am only working with the main game and expansions in my data files.

my current scripts look like this-
keepvars:
Spoiler
begin 1rak_gvats  ;global variable and timer systemshort Rlocaldayspassedshort Rcurrentdayshort gfighterupdateshort RkeepVarsshort Rupdatefsvif ( Rupdatefsv == 0 ) ; update fighter minion    if ( scriptrunning 1rak_fighter_minion == 0 ) ;here's the problem        set 1rak_fighter_minion.keepvars to 1 ;local doonce variable, also broken        startscript 1rak_fighter_minion        set Rupdatefsv to 1 ;global doonce for keepvar    endifendifif ( RcurrentDay != Day ) ;whenever Day changes         set RcurrentDay to Day ;(presumably increasing)…        set RlocaldaysPassed to RlocaldaysPassed + 1 ;add one to the counterendifstopscript 1rak_gvatsend


and main companion script:
Spoiler
Begin 1rak_fighter_minionshort companion  ;companion sharefloat minimumprofit  ;underlings get grumpy without a paycheckshort rak_fighter  ;0= no companion, 1=accompnied, 2=wait till respawn, 3=deadshort isdeadshort raktimershort raktimerDshort keepvarsif ( keepvars == 1 ) ;keepvars snippit    set keepvars to 0    stopscript 1rak_fighter_minion    returnendifif ( menumode == 1 ) ;dont run the script in menus    returnendifif ( gethealth < 1 ) ;checking if dead    set isdead to 1    set rak_fighter to 3    set raktimerD to 1endifif ( ondeath == 1 ) ;checking if dead    set isdead to 1    set rak_fighter to 3    set raktimerD to 1endifif ( rak_fighter == 0 )  ;first time script is run, sets this to enable the companion.    set rak_fighter to 1 ;values >1 will result in a respawn in 3 (or more) dayselseif ( rak_fighter == 1 )    if ( player->getpcrank, "fighters guild" > 2 ) ;only if you outrank the npc by 3         addtopic "travel together"                 ;will you get companion topic    endif    if ( minimumprofit < 0 ) ;no profits        set rak_fighter to 4        set companion to 0 ;no companion        aiwander 0 0 0 0 0 0 0 0 0 0 0 0 ;he stays in place        set raktimer to 1    endifelseif ( rak_fighter == 2 )    set companion to 0 ;no companion    set raktimer to 1endifif ( rak_fighter > 1 )        if ( 1rak_gvats.Rlocaldayspassed >= 3 ) ;calls global variable             if ( isdead == 1 ) ;only ressurect when dead            resurrect            set isdead to 0            endif        PositionCell, 545, -383, 378, 0, "Balmora, guild of fighters" ; move back to spawnpoint        set rak_fighter to 1        endifendifif ( raktimer == 1 )    set 1rak_gvats.Rlocaldayspassed to 0 ;resets global timer    set raktimer to 0elseif ( raktimerD == 1 ) ;resets global timer with death penalty    set 1rak_gvats.Rlocaldayspassed to -3    set raktimerD to 0endifend


at this point, the major problem (in 1rak_gvats) is that when i try to save these scripts, the editor complains that it cannot find variable or function, in reference to me checking if "rak_fighter_minion" is running. adding quotation marks around the script name fixes this (note, it's not looking for 1rak_ just rak_) but then it complains that it cannot find the variable keepvars. this puzzles me, because in any number of scripting tutorials list the script as just how i wrote it.

so, any clue as to what i'm doing wrong here?
User avatar
Riky Carrasco
 
Posts: 3429
Joined: Tue Nov 06, 2007 12:17 am

Post » Tue Dec 29, 2009 1:02 pm

Two problems I can see are you've started an ID with a number and didn't quote it.
IDs should always start with an alphabetical character, after the first letter the full A-Z/0-9/_ set is safe. That first one needs to be a letter, or odd issues can come up.
Quotes are similar, you should always quote every ID appearing in your code (including "player"). Again, it might cause odd errors.

As far as the errors on the scriptrunning and such, you'll want to save each script with the attachment to the other commented out. Once both scripts are saved and compiled, then add the check again and save it again. The idea is you need them to exist before the checks can compile properly.
User avatar
Lavender Brown
 
Posts: 3448
Joined: Tue Jul 25, 2006 9:37 am

Post » Tue Dec 29, 2009 3:08 pm

Two problems I can see are you've started an ID with a number and didn't quote it.
IDs should always start with an alphabetical character, after the first letter the full A-Z/0-9/_ set is safe. That first one needs to be a letter, or odd issues can come up.
Quotes are similar, you should always quote every ID appearing in your code (including "player"). Again, it might cause odd errors.

As far as the errors on the scriptrunning and such, you'll want to save each script with the attachment to the other commented out. Once both scripts are saved and compiled, then add the check again and save it again. The idea is you need them to exist before the checks can compile properly.

so, every instance of every variable should be quoted?

so something like
set isdead to 1


should be:
set "isdead" to 1


right?

also, commenting out all references of the other script, saving, then uncommenting and attempting to save still returns the same "could not find variable" error in the global script, and "objectid/script not found" error on the local script.
User avatar
Hussnein Amin
 
Posts: 3557
Joined: Sun Aug 05, 2007 2:15 am

Post » Tue Dec 29, 2009 11:52 am

quotes should be used to help avoid possible ambiguity (confusing commands/operators) for the compiler
set "isdead" to 1
is not necessary, while
set "is dead" to 1
is

if ( GetTarget "player" == 0 )
is probably better than
if ( GetTarget player == 0 )


renaming your scripts as suggested (for instance a1rak_gvats and a1rak_fighter_minion) and probably removing comments from the same line as script name
begin a1rak_gvats;global variable and timer system
could help compiling. To ease things, I suggest you check your scripts under MWEdit strict syntax checking.

Real problem is, I don't think things would work anyway, because you are trying to use in a global targeted script some features working in local scripts.
I fear the short companion, float minimumprofit variables need to be in a local script to work, not in a global (=started with startscript) one
Also, only 1 instance at a time of a global script can run, so you should make multiple copies of the script and "dispense" them cyclically if you want to affect more than a npc with that global targeted script.
User avatar
Janette Segura
 
Posts: 3512
Joined: Wed Aug 22, 2007 12:36 am

Post » Tue Dec 29, 2009 8:58 am

yes, i'm starting to understand that now. seems i've misunderstood some of what ive read. i've also managed to get both scripts to save by judiciously adding quotes.

i'm using numbers at the start of my script names as recommended in the "morrowind scripting for dummies (9th edition)" to keep my script names at the top of the list.

and you are right, the scripts, in the form posted here, dont work. i've removed the "keepvars" part of both scripts (seems i didnt need it at all, the savegame seems to store the variables on the local scripts just fine.) now 1rak_gvats just holds a timer. i've removed the "if minimumprofit" block entirely, as this is actually handled just fine by the default companion behavior. i've added a new variable into 1rak_fighter_minion "spawnday" that is set to 1rak_gvats variable RlocaldaysPassed. the raktimer and raktimerD variables now handle resetting RlocaldaysPassed. any other time i need to reference RlocaldaysPassed in 1rak_fighter_minion, i use the local soawnday instead.

it still does not function in it's current form. i think i need to set the timer variables in 1rak_gvats as global variables, rather than local variables in a global script. i had thought that local variables in a global script were global variables, but it does not seem to work like that.

oh, and i dont have comments on the first line (or nearly as many comments) on my internal scripts. i added all that for the benefit of you guys here, so you can see what i'm trying to do. i will check out that formatting guide, thanks for bringing it to my attention.
User avatar
Lynne Hinton
 
Posts: 3388
Joined: Wed Nov 15, 2006 4:24 am

Post » Tue Dec 29, 2009 8:29 pm

update: i got it working as intended. setting RlocaldaysPassed as a global variable worked. i then puzzled my way though a few loops that kept resetting my timer. now the whole deal works as intended. now, once i build in a "they level when you do" part (shouldent be that hard) i can copy the script with small tweaks, to all companion NPCs i add.

for those who are interested, he's the "final" form.

Spoiler
Begin 1rak_fighter_minion; local script to control companion availability and respawnshort companion  ;companion sharefloat minimumprofit  ;underlings get grumpy without a paycheckshort rak_fighter  ;minion's state - 0= n/a, 1=accompnied/available, 2=wait till respawn, 3=dead, on timershort isdead ;dead flag. seems to persist after respawn until rak_fighter = 1short raktimer ;start flag for timer to prevent companion follow on dismissal, and after death respawnshort raktimerD ;start flag for timer to respawn companionshort spawnday ; set to global variable RlocaldaysPassed, controlled by 1rak_gvatsif ( spawnday != RlocaldaysPassed )  ;this if block keeps spawnday in synch with RlocaldaysPassed	set spawnday to RlocaldaysPassedendifif ( menumode == 1 ) ;dont run the script in menus	returnendifif ( isdead == 0 ) ;this if block checks for minion death	if ( gethealth < 1 ) ;checking if dead		set isdead to 1;sets dead flag		set rak_fighter to 3 ;minion dead state	endif	if ( ondeath == 1 ) ;checking if dead		set isdead to 1 ;sets dead flag		set rak_fighter to 3 ;minion dead state	endifelse ( isdead == 1 ) ;avoid a timer loop	set companion to 0endifif ( rak_fighter == 0 )  ;first time script is run, sets this to 1	set rak_fighter to 1 endifif ( rak_fighter == 1 ) ;this if block controls the avalability of the travel together topic	if ( "player"->getpcrank, "fighters guild" > 2 ) ;checks PC to make sure he is of proper rank		addtopic "travel together" 	endifelseif ( rak_fighter == 2 ) ;set by dialog.  minion is dissmissed and will no longer have the topic	set companion to 0 ;no sharing	set raktimer to 1 ;minion will stay where he is.	set rak_fighter to 4 ;prevents constant resetting of the timerelseif (rak_fighter == 3 ) ;set by death	set raktimerD to 1 ;starts respawn timerendifif ( rak_fighter > 1 ) ;this if block controls minion respawn	if ( spawnday >= 3 ) ;three days after timer flag is thrown		PositionCell, 545, -383, 378, 0, "Balmora, guild of fighters"  ;move actor to respawn		if ( isdead == 1 ) ;after movement, dead actor is ressurected, and death penalty is applied				resurrect				set rak_fighter to 4 ;penalty timer.  companion will not offer travel together topic for three more days				set isdead to 0 ;clear dead flag				set raktimer to 1 ;starts new timer		endif		if ( rak_fighter > 1 ) ;this ensures that rak_fighter is set to 1 at the proper time so that the travel together topic becomes available.			set rak_fighter to 1			set RlocaldaysPassed to 0 ;keeps timer from staying on day 3.  		endif	endifendifif ( raktimer == 1 )  ;this if block is in control of the timer	set RlocaldaysPassed to 0  ;timer reset	set raktimer to 0  ;flag reset	set rak_fighter to 4  ;prevents travel together topicelseif ( raktimerD == 1 ) ;this block is in control of the respawn if dead timer	set RlocaldaysPassed to 0  ;timer reset	set raktimerD to 0  ;flag reset	set  rak_fighter to 4 ;prevent constant timer reset if deadelseif (spawnday >= 3 ) ;keeps the timer from staying on day 3	set RlocaldaysPassed to 0  ;timer resetendif;i prevent the timer from sitting on day 3, as this causes unintentional behavior [corpse teleporting to the fighters guild for example]end

User avatar
SEXY QUEEN
 
Posts: 3417
Joined: Mon Aug 13, 2007 7:54 pm

Post » Tue Dec 29, 2009 6:48 pm

so, every instance of every variable should be quoted?

so something like
set isdead to 1


should be:
set "isdead" to 1


right?

No, just IDs. Variable names should not be in quotes, only reference IDs. It's a ridiculously complicated, detailed rule, but as you've seen, it's one you should probably follow. Even though Bethesda and 80% of modders don't. I've seen it break things and it's definitely a bug, but it's not an often-recurring one.

also, commenting out all references of the other script, saving, then uncommenting and attempting to save still returns the same "could not find variable" error in the global script, and "objectid/script not found" error on the local script.

Not sure what's up with that. Did it save and compile properly with them commented out?


set "isdead" to 1

Is a syntax error, while
set "is dead" to 1

Is an invalid variable name wrapped in a syntax error.

if ( GetTarget "player" == 0 )

is correct, while
if ( GetTarget player == 0 )

is a syntax error that will compile in 95% of cases.


The quotes rule applies only to IDs and applies to every ID. It's kind of technical, but it's really just a bug work-around, so we can't expect too much.

Neither variables nor IDs should start with anything but a letter, doing so may cause scripts to fail. Variables must be valid identifiers ([a-zA-Z0-9_]*, or the multiple alphanumeric(underscore)al characters) and IDs must be relatively simple strings (as variables, but with spaces and a few more characters legalized).

Using spaces in IDs is allowed, but generally underscores are preferable (the friendly-name field is there for a reason).
User avatar
Shelby McDonald
 
Posts: 3497
Joined: Sat Jan 13, 2007 2:29 pm

Post » Tue Dec 29, 2009 6:01 pm

elseif (rak_fighter == 3 )
and similar, probably better adding a space after bracket
elseif ( rak_fighter == 3 )



Not sure with NPCS, but creatures sometimes die having GetHealth returning something a little higher than 0.
Lately I'm using something like
if ( GetHealthGetRatio < 0.05 )    ModCurrentHealth -1000  ; forced killing, ensure GetHealth returns <= 0    set isdead to 1endif



set "is dead" to 1

thanks peachykeen :tops: , that was a really wrong example

I should avoid posting when I am sleepy...
User avatar
Dustin Brown
 
Posts: 3307
Joined: Sun Sep 30, 2007 6:55 am

Post » Tue Dec 29, 2009 7:10 am

Not sure with NPCS, but creatures sometimes die having GetHealth returning something a little higher than 0.
Lately I'm using something like
if ( GetHealthGetRatio < 0.05 )    ModCurrentHealth -1000  ; forced killing, ensure GetHealth returns <= 0    set isdead to 1endif

I've noticed that too, it seems like a health of 1 or 2 still counts as dead. Have you been able to pin it down to a definite value, or is it some rounding error, or what?


set "is dead" to 1

thanks peachykeen :tops: , that was a really wrong example

I should avoid posting when I am sleepy...

That one took me a bit my surprise, what with you knowing how to script and all, but no worries. Sleep happens to the best of us. :P
User avatar
CHangohh BOyy
 
Posts: 3462
Joined: Mon Aug 20, 2007 12:12 pm

Post » Tue Dec 29, 2009 4:59 pm

I've noticed that too, it seems like a health of 1 or 2 still counts as dead. Have you been able to pin it down to a definite value, or is it some rounding error, or what?
I would like to know, it may be some rounding error or some timing issue between dead animation, spell effects or whatnot.
Creatures with low health seems to remain in the 0-1 range, but creatures with around 250 medium nax health sometimes died with still 6/7 hp remaining , so I assumed the possible error is at least proportional to maximum health, I would think about 3 or 4 % of maximum health.
User avatar
Natasha Callaghan
 
Posts: 3523
Joined: Sat Dec 09, 2006 7:44 pm

Post » Tue Dec 29, 2009 7:52 pm

Not to hijack the thread, but I never realized that this could happen with GetHealth checks at/after death. Thanks for the information; it is nagging details like that which drive one crazy when the occur and aren't well known.
User avatar
Natalie Harvey
 
Posts: 3433
Joined: Fri Aug 18, 2006 12:15 pm

Post » Tue Dec 29, 2009 1:13 pm

allright, having changed my main script for companions again (this time making use of the minimumProfit value) i'm fairly well satisfied by it. but i'm left with a question.

instead of writing a script for each and every companion i add, is there any way to have just one script do it? it gets a bit labor intensive when i make a change that needs to be applied to all companions, or even just those of one faction. i'm thinking i can have one script that is attached to the NPC to hold a variable for controlling the availability of the companion topic, and having the dialog for accepting the companion start a targeted version of my "main" script on the NPC that is now a companion. the big issue with changing to this method is that currently, i rely on PositionCell to ensure each NPC is returned to his/her individual spawnpoint.

also, i'm having a bit of a problem with dialog. i'm adding in companions that offer services. i only want the NPC to offer services when the PC fufills the conditions of being able to recruit them. for the "travel together" topic, i have conditions set like this - local rak_fighter = 1, global Rhascomp = 0, function faction rank difference >= 2. the travel together topic works as intended. only my NPCs offer the topic, the topic disappears when rak_fighter != 1 (most often because of a timer i set), and the topic will not appear unless the PC is 2 ranks higher than the NPC in the faction.

to ensure services are refused, i made two new service refusals. the condition of one is that the PC is not in the same faction. the condition of the other mirrors the travel together topic, bar Rhascomp = 0. the problem is that service is never refused if the PC is in the same faction. am i missing something?
User avatar
Claudia Cook
 
Posts: 3450
Joined: Mon Oct 30, 2006 10:22 am

Post » Tue Dec 29, 2009 7:26 pm

horray four back to back posts!

i got service refusals working (had to review a few of the finer points of dialog editing. to get the refusal to work, i had to use <= 2 rather than >= 2. also changed where the dialog was in the list to follow conventions)

i've been thinking of the other point in my last post. i'm thinking it would be possible to have the scripts tied to the place (and reduce them from three to one) by having one leveled spawnpoint per guildhall, and then attaching a script to the NPC from there, most likely by invisible activator.

i got to thinking about doing it this way because some guildhalls will become quite cramped with both my mod and MCA enabled. i'm trying to avoid screwing around with the leveled lists though, i want to be as compatible as possible and i want to require as little as possible from the user.
User avatar
Hayley O'Gara
 
Posts: 3465
Joined: Wed Nov 22, 2006 2:53 am

Post » Tue Dec 29, 2009 7:13 pm

here's a question, if i ADD to the leveled list, will my mod cause conflict with mods that modify the default leveled lists? if i load such a mod up when editing my own, then save it as a "compatible with x" version, will it cause doubling or other undesired behavior? if i just add to the leveled list, and a user has one of these mods, will it cause conflicts based on load order?

as i mentioned, i'm trying to require less of the end user, but i've really been considering making a "patch version" for those that dont mind the step of merging the leveled lists.
User avatar
Aman Bhattal
 
Posts: 3424
Joined: Sun Dec 17, 2006 12:01 am

Post » Tue Dec 29, 2009 6:20 pm

Yes, possibly, yes.

The only way to handle level lists is to have the end user merge them. You can include a tool and a script to automate it, but you need to merge them with the user's current load order or Bad Things Will Happen.
User avatar
Rachyroo
 
Posts: 3415
Joined: Tue Jun 20, 2006 11:23 pm

Post » Tue Dec 29, 2009 2:09 pm

ah, thanks for the reply.

so if i went ahead with my "for 'x' mod" version, i'd just want to load the main game masters (morrowind, bloodmoon and tribunal) and the other mod i am making the compatibility version for, make the changes (in this case, the invisible activator, changing from multiple static spawns to a single leveled one, taking advantage of the other mod's leveled list changes, etc) and with my mod as the active file, when i save, my mod will include the other in its list of masters, and the user will have to merge his lists, correct?

as i said, smaller guildhalls (i'm looking at you wolverine hall) get quite crowded with both my mod and MCA active. as all of my new NPCs are generic minion-types, i could reduce crowding, and keep my NPCs diverse for those who use MCA (which seems to be quite a few people it seems.
User avatar
KU Fint
 
Posts: 3402
Joined: Mon Dec 04, 2006 4:00 pm

Post » Tue Dec 29, 2009 12:25 pm

Each mod that defines a leveled list has a unique copy of that list stored in it. The last mod to load is the one that matters, all others are ignored.

The implication of that is that your mod adds critter X to the list and another mod adds Y, only X or Y will be added. Unless the lists are merged.

You could manually pre-merge the lists, but that means your mod will always have to load last, and you'll need to include a version for every other possible combination of mods that might have leveled lists that might need merged. Obviously that gets big fast, because (assuming nM is the number of mods with leveled lists the community has produced), the total number of combinations is the sum {x=0;x = nM} ( nCr with nM as n and x as r ). Considering nCr is n!/(n-r)!r!, that becomes: sum {x=0;x = nM} ( nM! / ( nM - x )!x! ), which exceeds Chrome's computation abilities for about 400 mods. And there are easily 10,000 around. Short answer, not possible.

You need only add your items to the original list and ship that, with a note that it must be merged.

An interesting note is that, due to the format and compressibility of Morrowind data files, while the possible combinations would have a good chance of overloading an NTFS filesystem and would easily take petabytes of space, they would very likely compress to a terabyte in a low-quality program like 7-zip, a gigabyte in a decent one like WinRAR (due to text-oriented and some other compression techniques), and possibly a matter of mere megabytes if you were to use a high-quality compression app like UHARC or better. A vast majority of the data would be repetitive, so simply storing differences would be much better.

However, as with sufficiently complex rainbow tables, the mere time required to pre-process all combinations in this case would probably exceed 2000 years, making the exercise again impossible. Not that you cared. :P

User avatar
Sweets Sweets
 
Posts: 3339
Joined: Tue Jun 13, 2006 3:26 am

Post » Tue Dec 29, 2009 10:31 am

peachykeen, my mind was blown.

now i'm kind of hitting a wall with leveled lists. i have my NPCs i had previously hand placed in the world added to leveled lists, one list per faction. it seems i cant have the same script used for everything that pops out of one spawn. it also seems i cannot declare variables like companion on a targeted script.

what i need is for each NPC that spawns from a given list to run a script that includes instructions to return to its point of origin. i can think of a few workarounds. i can set a new variable in my main script for place (determined by a check of its current cell when first loaded) and then add a large if-elseif block for each spawn location. in this way, i keep to one copy of each npc, and reduce to one script per faction.

alternately, i can make a copy of each npc for a leveled spawn unique to each spawnpoint. then i'd have a script for each spawnpoint. i'd then have roughly 4x the NPCs added, and will have 4 scripts per faction on average.

is there some other workaround i'm not seeing? am i misunderstanding what i'm reading and is it possible to attach my script, either by activator, or a "jumpstart" script attached that declares the needed variables, and then starts the appropriate script based on current cell?
User avatar
Katharine Newton
 
Posts: 3318
Joined: Tue Jun 13, 2006 12:33 pm

Post » Tue Dec 29, 2009 2:11 pm

seems the game automatically handles a lot of what i was trying to script, automatically. i ended up going with one script per faction, one copy of each NPC. i moved all timers to the gvats script, unchecked the "respawn" checkbox from each NPC, and removed resurrect and positioncell commands from the main scripts. i cleaned up my global variables (changed to RAK_ rather than just a R prefix) and made a couple of local variables from my main script into globals.

overall, my tests show that everything is behaving as intended for the most part. the respawning isnt as "strict" as it was before, but that's fine.
User avatar
Love iz not
 
Posts: 3377
Joined: Sat Aug 25, 2007 8:55 pm

Post » Tue Dec 29, 2009 8:49 pm

a two parter here, so bear with me.

first off, i have a script launched through dialog that disables NPCs for a set time. when they return they forcegreet and give the player one of 12 random items i created. the script gives a blank item i use as a condition of the forcegreet to get the NPC to "give" the item through dialog. will removeitem on a 0 weight item that the player does not have mess up encumbrance? i ask because i'd rather not remove the "activator" item through dialog and have the " was removed from your inventory" appear on the dialog.

second, i have a quest with a related global script. i want this quest to be repeatable. the quest has three possible outcomes. i marked the three "outcome" journal entries with finished, and marked the beginning stage as repeat, this is the correct usage, correct? because i use a global script to track variables, before i stop the script, i need to reset all values to 0,if i do not want them to be "remembered" the next time the dialog starts the script, right?

right now, my issues are that the journal says that it's updating, but no new entries are written the second go-through. also, a two step multiple choice dialog works properly the first run, but malfunctions the second run-through. this breaks the quest as the dialog that does not show when it should sets variables for the quest related global script, nor does it update the journal to the proper index. furthermore, it seems the script flat out stops processing. perhaps the answer is to have the global script run all the time and only execute when a global variable is tripped?
User avatar
Sarah Knight
 
Posts: 3416
Joined: Mon Jun 19, 2006 5:02 am

Post » Tue Dec 29, 2009 7:29 pm

will removeitem on a 0 weight item that the player does not have mess up encumbrance? i ask because i'd rather not remove the "activator" item through dialog and have the " was removed from your inventory" appear on the dialog.
For this, I think you could simply use something like
;dialog box codeplayer->startscript "rknRemoveItemScript"goodbye

begin rknRemoveItemScript; global targeted script on playerif ( MenuMode )     return ; wait until dialog closedendifif ( GetItemCount "rknItemToRemoVeID" > 0 )    removeitem "rknItemToRemoVeID" 1    returnendifstopscript "rknRemoveItemScript"end

User avatar
Dan Wright
 
Posts: 3308
Joined: Mon Jul 16, 2007 8:40 am

Post » Tue Dec 29, 2009 7:33 am

ah, thanks, i was thinking of doing something similar, adding into the quest script. seems i got some cut and paste work ahead of me.

also going to experiment with having the global quest script run all the time, but only be execute when a variable is set.

also going to play with the journal, i know there has to be a way to have it actually print the information out again.
User avatar
JD FROM HELL
 
Posts: 3473
Joined: Thu Aug 24, 2006 1:54 am

Post » Tue Dec 29, 2009 7:27 am

quick question,

it's possible to change the variables of global scripts that are not running through a targeted set command from a running script? i'm assuming it is, based off of the "keepvars" example of MWSFD. a little confirmation would be nice though.
User avatar
Kanaoka
 
Posts: 3416
Joined: Fri Jun 16, 2006 2:24 pm

Post » Tue Dec 29, 2009 4:33 pm

quick question,
it's possible to change the variables of global scripts that are not running through a targeted set command from a running script? i'm assuming it is, based off of the "keepvars" example of MWSFD. a little confirmation would be nice though.
yes
User avatar
Chloe Yarnall
 
Posts: 3461
Joined: Sun Oct 08, 2006 3:26 am

Post » Tue Dec 29, 2009 7:16 am

ah, good, thanks again.

it ended up moot though, i just merged into my timer and variable script.
User avatar
Trevi
 
Posts: 3404
Joined: Fri Apr 06, 2007 8:26 pm

Next

Return to III - Morrowind