Jump to content

Fallout New Vegas GECK & Scripting Help 101


Recommended Posts

Guest tomm434
Posted

I decided for him to spawn while dialogue , then stand in one place and wait for player to approach him(at the range of 300 he starts dialogue)

 

Now about Quest script again - Now I left 2 IF-IFend blocks there and they work.

 

Scriptname aamq05ghoulsscript


short CruckSpawn
short CruckHelps ;1 -after player dialogue; 3 - after MQ05Completed
short GhoulNokill
short CruckDirty ; if player greeted Cruck not nice
short CruckName; player told Cruck her name
short CruckCompliment; player talked to Cruck without mask
short TunnelTaftspawn - In TunnelTaft1 Ghouls spawned only once
short CruckSpeech; to tell him that time to talk is come
short Cruckfate; 1 - He stays in tunnels; 2 - he goes with player


Begin gamemode

;MQ05Quest - After Tunnels
if CruckHelps ==2 && GetQuestCompleted Mq05 ==1
garzaref.removefromfaction playerfaction
AlexDargonref.removefromfaction playerfaction
DanielAgincourtref.removefromfaction playerfaction
DoctorLIref.removefromfaction playerfaction
set CruckHelps to 3
endif



if Cruckhelps ==1 && TunnelTaftspawn ==0 && GetStage Mq05 ==100
mq05TaftStairAmbushEnclave01.placeatme aaamq05ghoultrooper 6
set TunnelTaftspawn to 1
if GhoulNokill ==1
setessential mq05TaftStairAmbushEnclave 1
garzaref.setav aggression 0
AlexDargonref.setav aggression 0
DanielAgincourtref.setav aggression 0
DoctorLIref.setav aggression 0
garzaref.setav confidence 4
AlexDargonref.setav confidence 4
DanielAgincourtref.setav confidence 4
DoctorLIref.setav confidence 4
endif
endif
end

 

 

But when I try to add any other IF-EndIf Block - no block works at all.

 

 

Scriptname aamq05ghoulsscript


short CruckSpawn
short CruckHelps ;1 -after player dialogue; 3 - after MQ05Completed
short GhoulNokill
short CruckDirty ; if player greeted Cruck not nice
short CruckName; player told Cruck her name
short CruckCompliment; player talked to Cruck without mask
short TunnelTaftspawn - In TunnelTaft1 Ghouls spawned only once
short CruckSpeech; to tell him that time to talk is come
short Cruckfate; 1 - He stays in tunnels; 2 - he goes with player


Begin gamemode

;MQ05Quest - After Tunnels
if CruckHelps ==2 && GetQuestCompleted Mq05 ==1
garzaref.removefromfaction playerfaction
AlexDargonref.removefromfaction playerfaction
DanielAgincourtref.removefromfaction playerfaction
DoctorLIref.removefromfaction playerfaction
set CruckHelps to 3
endif

 

If Cruckspeech ==1

setstage aamq05ghouls 10

endif


if Cruckhelps ==1 && TunnelTaftspawn ==0 && GetStage Mq05 ==100
mq05TaftStairAmbushEnclave01.placeatme aaamq05ghoultrooper 6
set TunnelTaftspawn to 1
if GhoulNokill ==1
setessential mq05TaftStairAmbushEnclave 1
garzaref.setav aggression 0
AlexDargonref.setav aggression 0
DanielAgincourtref.setav aggression 0
DoctorLIref.setav aggression 0
garzaref.setav confidence 4
AlexDargonref.setav confidence 4
DanielAgincourtref.setav confidence 4
DoctorLIref.setav confidence 4
endif
endif
end

 

 

 

 

That's not a question(not asking for help ). Maybe it's my game, maybe this happens because of TTW. I'm just frustrated over this whole thing.

Posted
Maybe it's my game, maybe this happens because of TTW. I'm just frustrated over this whole thing.

 

This is the magic world of GECK, welcome abroad! :) seriously, I don't think script issues come out from TTW, I more think there's some... quite hidden... mistake, or what else, somewhere. I'm sure that you'll find it and you will feel definetely better!

Posted

Also, if I haven't asked before:  Are you using the Geck Power-Up Fork from the Nexus?  The one that gives you error when scripts don't compile?

Guest tomm434
Posted

 

Maybe it's my game, maybe this happens because of TTW. I'm just frustrated over this whole thing.

 

This is the magic world of GECK, welcome abroad! :) seriously, I don't think script issues come out from TTW, I more think there's some... quite hidden... mistake, or what else, somewhere. I'm sure that you'll find it and you will feel definetely better!

 

 

This ship need some serious repair =). Kidding, it's just me.

I'm not going to give up now - I've come this far.

 

 

Also, if I haven't asked before: Are you using the Geck Power-Up Fork from the Nexus? The one that gives you error when scripts don't compile?

 

Yes.

Posted

Is there anything special that I need to know about XMarkers?

 

  1. I put one in a test cell and marked as persistent reference.
  2. In a script, under certain conditions, I have "refname.moveto Player."
  3. In my post-SO clean-up spell, I have "actor.moveto ref

 

When I move to the NPC in game, the XMarker is still in that Test Cell. 

Posted

Well as far as a scanner goes I use this in SistersOfChastity to have each belt wearer add targets to a group formlist:

				Set iCnt to 0
				Set iNumRefs to GetNumRefs 200 1
				Label 1
				if iCnt < 1
					Set rTemp to rZActor.GetFirstRef 200 1 1								
				else
					Set rTemp to rZActor.GetNextRef
				endif
				Set fTargDist to rZActor.GetDistance rTemp
				if fTargDist < 5000 && rTemp.GetEquipped SOCStimBelts == 0 && rTemp.GetInFaction SOCFaction == 0
					if rTemp.GetIsCreature < 1 && rTemp.GetDead == 0 && rTemp.GetDisabled == 0
;						DebugPrint "%n Target %3.0f / %3.0f, %n at %8.0f" rZActor iCnt iNumRefs rTemp fTargDist
						if (NX_IsInList SOCPotentialTargets rTemp == 0)
							ListAddForm SOCPotentialTargets rTemp
							DebugPrint "%n Target added %3.0f of %3.0f, %n at %8.0f" rZActor iCnt iNumRefs rTemp fTargDist
						endif
					endif
				endif
				Set iCnt to iCnt + 1
				if iCnt < iNumRefs
					goto 1
				endif
Posted

So, I'm having 2 issues.  One, being the aforementioned XMarker not working.

 

 

 

scn SexoutBang2pMenuSCRIPT

int iButton0
int iButton1
int iMenuLevel
int iMenuSubLevel
int iMFPlayer
int iMFQPartner
int iStrapOnNow
ref rQPartner

Begin OnAdd
	playerREF.NX_SetEVFl "Sexout:Start::CallVer" 1	
	Set rQPartner to SexoutBangMain.rPartner
	Set iMFPlayer to player.GetIsSex Female
	Set iMFQPartner to rQPartner.GetIsSex Female
	ShowMessage SexoutBang2pSelect
End	


Begin GameMode
	if (0 == iMenuLevel) ;Select Menu for 2p
		Set iButton0 to GetButtonPressed
		if (-1 == iButton0)
			Return
		elseif (0 == iButton0)
			ShowMessage SexoutBang2pOral1
			Set iMenuLevel to 1			
			Return
		elseif (1 == iButton0)	;Missionary
			Set iStrapOnNow to 1
			Call SexoutBangSetActors2PFxnSCRIPT rQPartner iMFPlayer iMFQPartner iStrapOnNow
			ShowMessage SexoutBang2pVagAnalMiss1
			Set iMenuLevel to 1
			Return
		elseif (2 == iButton0)	;Doggie
			Set iStrapOnNow to 1
			Call SexoutBangSetActors2PFxnSCRIPT rQPartner iMFPlayer iMFQPartner iStrapOnNow
			ShowMessage SexoutBang2pVagAnalDog1
			Set iMenuLevel to 1
			Return
		elseif (3 == iButton0)	;Cowgirl
			Set iStrapOnNow to 1
			Call SexoutBangSetActors2PFxnSCRIPT rQPartner iMFPlayer iMFQPartner iStrapOnNow
			ShowMessage SexoutBang2pVagAnalCowgirl
			Set iMenuLevel to 1
			Return
		elseif (4 == iButton0)	;Toys
			Call SexoutBangSetActors2PFxnSCRIPT rQPartner iMFPlayer iMFQPartner iStrapOnNow
			ShowMessage SexoutBang2pToys
			Set iMenuLevel to 1
			Return
		elseif (5 == iButton0)              ;<-----------------Button #5 allows the player to pick another NPC for a 3some
			Set SexoutBangMain.i3some to 1
			Set SexoutBangMain.iStage to 2   
			SexoutBangXMarkerNPCREF.MoveTo Player           ;<-----------------This is where the XMarker is moved
			RemoveMe
		endif
;etc...........

 

 

 

Two - Specifically SO:  When I do move to the marker (which is only used in the event of a threesome so that the original NPC can be moved back to their starting point if they are from a completely different cell), the NPC is naked but standing.  However, the Character Resize never happens, so it seems like something is only half processed?  Is there some range outside of which SO spells (or spells in general, I guess?) won't work?

 

Here's the CallBack spell that clears the quest's vars and moves the 1st NPC to the marker.

 

 

 

scn SexoutBangResetMainQuestVarsEFFSCRIPT

int iDoOnce
int iTimer
ref rActor

Begin ScriptEffectStart
	if (0 == iDoOnce)
		Set SexoutBangMain.iStage to 0
		Set SexoutBangMain.rPartner3 to 0
		Set SexoutBangMain.iConsentType to 0
		Set SexoutBangMain.iConsentType3 to 0
		Set SexoutBangMain.iCreatureType to 0
		if (SexoutBangMain.iHad3some)
			Set rActor to SexoutBangMain.rPartner
			rActor.MoveTo SexoutBangXMarkerNPCREF
			Set iDoOnce to 2
		else
			Set SexoutBangMain.rPartner to 0
			Set SexoutBangMain.iHad3some to 0
			Dispel SexoutBangResetMainQuestVarsSPELL
		       Set iDoOnce to 1
		endif
	endif
End

Begin ScriptEffectUpdate
	if (2 == iDoOnce)
		if 10 > iTimer
			Set iTimer to iTimer + ScriptEffectElapsedSeconds
		else
			Set rActor to SexoutBangMain.rPartner
			rActor.MoveTo SexoutBangXMarkerNPCREF
			Set SexoutBangMain.rPartner to 0
			Set SexoutBangMain.iHad3some to 0
			Dispel SexoutBangResetMainQuestVarsSPELL
			Set iDoOnce to 3
		endif
	endif
End

 

 

Posted

So, the XMarker is in an off map cell initially, correct?

 

I would suggest adding a check to the update block, just before you do the NPC MoveTo, to ensure the marker has moved already. Something like:

 

 

 

Begin ScriptEffectUpdate

    if (2 == iDoOnce)

        if 10 > iTimer
            Set iTimer to iTimer + ScriptEffectElapsedSeconds

        else
            ; * Check the marker has been moved
            if SexoutBangXMarkerNPCREF.GetInCell MyOffMapCell
                SexoutBangXMarkerNPCREF.MoveTo WhereIWantYou
                set iTimer to 9
                return
            endif

            Set rActor to SexoutBangMain.rPartner
            rActor.MoveTo SexoutBangXMarkerNPCREF
            Set SexoutBangMain.rPartner to 0
            Set SexoutBangMain.iHad3some to 0
            Dispel SexoutBangResetMainQuestVarsSPELL

            Set iDoOnce to 3

        endif
    endif

End

 

 

 

I try to make a habit of adding error handling code whenever I think there is the possibility the engine will be ornery (Assuming it isn't very frequently run code, the performance hit of a couple of extra checks should be negligible)

 

 

 

EDIT: Does this work?

 

int iTimer

Set iTimer to iTimer + ScriptEffectElapsedSeconds

 

I thought ScriptEffectElapsedSeconds returned the time since the update block last run (not first run), which rounded down to an int will be zero. It works if you use a float (you probably already knew that.. and were just tired when you wrote it ;))

Posted

 

Well as far as a scanner goes I use this in SistersOfChastity to have each belt wearer add targets to a group formlist:

 

 

				Set iCnt to 0
				Set iNumRefs to GetNumRefs 200 1
				Label 1
				if iCnt < 1
					Set rTemp to rZActor.GetFirstRef 200 1 1								
				else
					Set rTemp to rZActor.GetNextRef
				endif
				Set fTargDist to rZActor.GetDistance rTemp
				if fTargDist < 5000 && rTemp.GetEquipped SOCStimBelts == 0 && rTemp.GetInFaction SOCFaction == 0
					if rTemp.GetIsCreature < 1 && rTemp.GetDead == 0 && rTemp.GetDisabled == 0
;						DebugPrint "%n Target %3.0f / %3.0f, %n at %8.0f" rZActor iCnt iNumRefs rTemp fTargDist
						if (NX_IsInList SOCPotentialTargets rTemp == 0)
							ListAddForm SOCPotentialTargets rTemp
							DebugPrint "%n Target added %3.0f of %3.0f, %n at %8.0f" rZActor iCnt iNumRefs rTemp fTargDist
						endif
					endif
				endif
				Set iCnt to iCnt + 1
				if iCnt < iNumRefs
					goto 1
				endif

 

 

 

How do you handle that list of potential targets? is it in the same script or it is in another script?

Posted

 

 

How do you handle that list of potential targets? is it in the same script or it is in another script?

 

I then have a quest script sort through the list every 5 seconds and divide it into 6 other formlists by checking the status/hp/sex of the targets then the NPC scripts pick targets from those lists depending on their rank & abilitites. I did that so I can keep the script sizes in the NPC's control item manageable as there could be 20 of them running and I also have many target options Subdue, Stimulte, Strip, Enslave, Knockout, Kill etc

Posted

One more question, since I seem to be running out of options. I need to add some items to NPCs, mainly some armors, however I don't want to use AddItemToLeveled list and I don't want to run a scanner to check for the particular NPCs I need to add this to. I also don't want to have to do it manually through GECK, I want to avoid having incompatibilities because of alterations to leveled lists. Does anyone know any way of adding through script without using those things? 

 

I'd be grateful if anyone could give me any other options. 

Posted

however I don't want to use AddItemToLeveled list

 

Is it because they share the same lists with others NPCs which you don't want to touch their inventories?

...

I don't see many other ways, but well I think it depends by who you want to change. I mean if you don't want to manually change their inventory on GECK, the only other option I know would be creating a one-shot script, with all the npcref.additem etc. but I don't really know what exactly you want to do, nor what are the side effects or limitations in doing this. do you have some specific example as base ID of actor you want to change?

Posted

 I don't want to use AddItemToLeveled list and I don't want to run a scanner to check for the particular NPCs I need to add this to. I also don't want to have to do it manually through GECK, I want to avoid having incompatibilities because of alterations to leveled lists. Does anyone know any way of adding through script without using those things? 

 

I think that excludes all the easy options.

 

1) If you are only adding to persistent references, you can do it in a DoOnce Quest script. Remove items and add items.

 

2) Instead of adding armor (etc) to a leveled list, add a token. Give the token an OnAdd script that checks the actors faction (and/or whatever) and either gives them 1 armor or another. You may need to include EquipItem in the script.

Posted

How am I supposed to use ScriptEffectElapsedSeconds in a ScriptEffectUpdate block?

 

I've tried different variants of it (just using it as if it was a variable [if 5 < ScriptEffectElapsedSeconds] and setting a timer var to timer + ScriptEffectElapsedSeconds and checking the timer var in a condition).  The script in the condition either goes off immediately or doesn't go off at all.

Posted

 

 

 

 

I think that excludes all the easy options.

 

1) If you are only adding to persistent references, you can do it in a DoOnce Quest script. Remove items and add items.

 

2) Instead of adding armor (etc) to a leveled list, add a token. Give the token an OnAdd script that checks the actors faction (and/or whatever) and either gives them 1 armor or another. You may need to include EquipItem in the script.

 

 

The easy options may end up being more damaging than helpful, and not just for the users, I'm not at all worried about them, more like whenever I or someone else decides to update this mod and wants to remove something. Regardless, these seem like good ideas, seems like I might have to scan again though, since this involves regular NPCs, not any named ones. 

 
 

 

 

 

 

Is it because they share the same lists with others NPCs which you don't want to touch their inventories?

...

I don't see many other ways, but well I think it depends by who you want to change. I mean if you don't want to manually change their inventory on GECK, the only other option I know would be creating a one-shot script, with all the npcref.additem etc. but I don't really know what exactly you want to do, nor what are the side effects or limitations in doing this. do you have some specific example as base ID of actor you want to change?

 

 

I don't want to modify their lists because I want to create the least possible conflicts as possible. If AddItemToLeveledList didn't wreck anything, I'd just add the Power Armor I have in mind to legion lists and be done with it. Nonetheless, this is never simple. If it comes to it though, I will do it manually, anyone who doesn't like that will just have to resort to merged patches. 

 

EDIT: I should also point out that these armors will be added to specific NPCs such as Veteran Legionaries and Legion Assassins or their equivalents in other factions. 

Posted

 

I don't want to modify their lists because I want to create the least possible conflicts as possible. If AddItemToLeveledList didn't wreck anything, I'd just add the Power Armor I have in mind to legion lists and be done with it.

 

 

I admit I didn't question myself on why you were using a scanner instead of a leveled list, but if it's the real reason, well... hats off to you. I suppose that scanner won't conflict with anything, in that way.

 

But now I ask to myself: was it really necessary? is it really necessary that the modder's work must avoid conflicts at the point that his mod screws another mod which does the same effect in game? is it necessary than a mod which changes an armor to a npc won't replace another mod which changes the armor on the same npc?

 

I think the duties of a modder finish when we start to walk over the line of the common sense of the user. Probably that thin line is different for anyone, but mine wouldn't be there, mine would be before, mine ends when I write on the description something like "my mod will conflict with another mod that does the same thing". So in your specific case, I would have used the same solution that weapon modders usually use, adding an item to a list by one-shot script in game.

Posted

@Nyaallich: Something like this:

float fTimer

Begin ScriptEffectUpdate

    let fTimer += ScriptEffectElapsedSeconds
 
    ; ** Run at most once per second
    if (fTimer < 1)
        return
    endif

    set fTimer to 0
.....

The same applies with GetSecondsPassed in object scripts.

 

If the frame rate is 30 per second, those two functions == 0.03333333 (1/30)

 

 

----

 

@ ArgusSCCT: I had a similar concern when I did my DLC weapon + special ammo integration, I wanted the mod to be reversible but still add to leveled lists. The solution I came up with is to never add vanilla forms to vanilla leveled lists: You can add mod-contained items to vanilla LLs, or you can add mod contained LLs (that contain the vanilla item(s)) to vanilla LLs.

 

Hope that makes sense.. might need to read it twice.

Posted

How am I supposed to use ScriptEffectElapsedSeconds in a ScriptEffectUpdate block?

 

I've tried different variants of it (just using it as if it was a variable [if 5 < ScriptEffectElapsedSeconds] and setting a timer var to timer + ScriptEffectElapsedSeconds and checking the timer var in a condition).  The script in the condition either goes off immediately or doesn't go off at all.

You have to get the value once at the top of the block and save it to a var, then only use that var.

 

It only returns a real value once, the first time it's called in a block. Every time after that it returns 0.

Posted

 

 

 

 

I admit I didn't question myself on why you were using a scanner instead of a leveled list, but if it's the real reason, well... hats off to you. I suppose that scanner won't conflict with anything, in that way.

 

But now I ask to myself: was it really necessary? is it really necessary that the modder's work must avoid conflicts at the point that his mod screws another mod which does the same effect in game? is it necessary than a mod which changes an armor to a npc won't replace another mod which changes the armor on the same npc?

 

I think the duties of a modder finish when we start to walk over the line of the common sense of the user. Probably that thin line is different for anyone, but mine wouldn't be there, mine would be before, mine ends when I write on the description something like "my mod will conflict with another mod that does the same thing". So in your specific case, I would have used the same solution that weapon modders usually use, adding an item to a list by one-shot script in game.

 

 

You're right, but this mod specifically has always had problems with other mods and I'm not making it compatible for the users, nor I making it for them. I started to update it because I wanted to have it fixed for me and some friends. I do plan to release it, but I'm not doing so that the nexus users can all enjoy it. Besides, when it comes to compatibility I'm only focusing the big things, FOOK, PN and NVEC to name a few. The conflicts are mostly minor, but they were annoying. 

 

 

 

 

@ ArgusSCCT: I had a similar concern when I did my DLC weapon + special ammo integration, I wanted the mod to be reversible but still add to leveled lists. The solution I came up with is to never add vanilla forms to vanilla leveled lists: You can add mod-contained items to vanilla LLs, or you can add mod contained LLs (that contain the vanilla item(s)) to vanilla LLs.

 

Hope that makes sense.. might need to read it twice.

 

 

Yeah, that might need more than one reading, but I appreciate it. Anything that can help will do. 

Posted

Like a ridiculously cute caterpillar, I am still a bit fuzzy on getting ScriptEffectElapsedSeconds to work.  All timer stuff is bypassed, and the Else condition goes off.  Shouldn't ScriptEffectElapsedSeconds have returned some fraction on the initial pass?

 

 

 

Begin ScriptEffectUpdate

	if (0 == fTimer)
		Set fTimer to ScriptEffectElapsedSeconds
	elseif (5 > fTimer)
		Set fTimer to fTimer + fTimer
	else
		if ((2 == iDoOnce) && (IsReference rXMarkerStartCell))
			rActor.MoveTo rXMarkerStartCell
			set iDoOnce to 3
		elseif (3 == iDoOnce)
			rXMarkerStartCell.disable
			rXMarkerStartCell.MarkForDelete		
			Set iDoOnce to 4
		elseif (4 == iDoOnce)
			Set SexoutBangMain.rPartner to 0
			Set SexoutBangMain.iHad3some to 0
			Set SexoutBangMain.rXMarker to 0
			Dispel SexoutBangResetMainQuestVarsSPELL
			Set iDoOnce to 5
		endif
	endif	
End

 

 

Posted

That is.. not going to do what you want. You want to do something like this...

 

float fTimer

Begin ScriptEffectStart
  set fTimer to 0
End
    
Begin ScriptEffectUpdate

  set fTimer to fTimer + GetSecondsPassed

  if fTimer >= 5
    ; do your stuff
  endif
End

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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