Jump to content

Six's Love Shack Scripting help


Abinath

Recommended Posts

Ok so I'm making a house mod for New Vegas and I'm a noob at scripting (I have some experience with coding but basically none with the GECK). What I am trying to do right now is make a script that when NPCs walk into an area they unequip all their gear then re-equip it when they leave the area. I've been reading a little about it but can't quite figure it out. Any help would be appreciated.

Link to comment

First you need to create a simple script for a trigger.

For it you can check this links:

 

 

Second, create an new Activator and attach your script to this activator.

 

Third, open location in the Geck and create a new primitive, and after choose your activator.

how to create primitives - http://geck.bethsoft.com/index.php?title=Creating_Primitives

 

Simple scripts for trigger. For example GetEquippedObject getting equipped item from upperbody slot. If you will get an error with saving script, try to launch the Geck through nvse_loader with "-editor" flag.

 

 

For npcs only

scn SomeScriptName

ref rClothes
ref rNPCActor

Begin OnTriggerEnter

	if GetActionRef != player  ;all npcs exclude player
	
		Set rNPCActor to GetActionRef  ;get npc reference that entered in trigger
		set rClothes to rNPCActor.GetEquippedObject 2  ;get equipped reference from slot 2(upperbody) for npc
		rNPCActor.UnequipItem rClothes   ;unequip item for npc
		Return

	endif
	
END

Begin OnTriggerLeave

	if GetActionRef != player
	
		Set rNPCActor to GetActionRef ;get npc reference that entered in trigger
		rNPCActor.equipItem rClothes ;equip item for npc that you unequipped on enter
		Return

	endif
		
END
For especial npc(s) only

scn SomeScriptName

ref rClothes
ref rNPCActor

Begin OnTriggerEnter

	if GetActionRef == SomeRefName ;only if SomeRefName entered into the trigger
	
		Set rNPCActor to GetActionRef
		set rClothes to rNPCActor.GetEquippedObject 2
		rNPCActor.UnequipItem rClothes
		Return

	endif
	
END

Begin OnTriggerLeave

	if GetActionRef == SomeRefName 
	
		Set rNPCActor to GetActionRef
		rNPCActor.equipItem rClothes
		Return

	endif
		
END

 

Link to comment

I knew I needed a primitive and activator. Just didnt know how to write the script. I knew what I needed in the script and it was basically exact what you wrote I just didnt know the way to write it (Correct format and language). Thanks massively that was a big help :D You are definitely going in the Credits now :D

If I wanted to make the script also unequip other clothes like hats or necklaces would I just need to add more rclothes ref, set, equips and unequips for example

 

 

scn SomeScriptName

ref rClothes
ref rClothes2
ref rNPCActor

Begin OnTriggerEnter

if GetActionRef != player ;all npcs exclude player

Set rNPCActor to GetActionRef ;get npc reference that entered in trigger
set rClothes to rNPCActor.GetEquippedObject 2 ;get equipped reference from slot 2(upperbody) for npc
set rClothes2 to rNPCActor.GetEquippedObject 8
rNPCActor.UnequipItem rClothes ;unequip item for npc
rNPCActor.UnequipItem rClothes2
Return

endif

END

Begin OnTriggerLeave

if GetActionRef != player

Set rNPCActor to GetActionRef ;get npc reference that entered in trigger
rNPCActor.equipItem rClothes ;equip item for npc that you unequipped on enter
rNPCActor.equipItem rClothes2
Return

endif

END

 

 

or would I need to create different scripts with that function in it?

Link to comment

If I wanted to make the script also unequip other clothes like hats or necklaces would I just need to add more rclothes ref, set, equips and unequips...

Yeah, just add more things inside the blocks that you need
Link to comment

Ok so I need a little more help with two things actually. Without any spoilers.

I'm trying to make it so the player has to activate some message boxes then choose the option they want then the option does its effects and adds a number to a var. (first problem, I dont know how or where to script in the effects of their choice) Then when the var reaches a certain point it progresses the quest to the next stage. (second problem, I dont know how to make a quest script that checks the var)
I think what I need to do is have the script for their message box choice add +1 to the var (which I dont know where to write or apply the script) then have the quest script detect if it equals the needed number then advance the quest.

So basically

 

 

Script on Quest

 

scn QuestScript

int StoredVar

begin onTrigger

if StoredVar == 4

SetStage Quest 2

endif

end

 

Script on message box Choice

 

scn MBChoiceScript

 

getInt StoredVar

 

begin onActivate

set StoredVar to + 1

end

 

 

Link to comment

Ok so I need a little more help with two things actually. Without any spoilers.

I'm trying to make it so the player has to activate some message boxes then choose the option they want then the option does its effects and adds a number to a var. (first problem, I dont know how or where to script in the effects of their choice) Then when the var reaches a certain point it progresses the quest to the next stage. (second problem, I dont know how to make a quest script that checks the var)

I think what I need to do is have the script for their message box choice add +1 to the var (which I dont know where to write or apply the script) then have the quest script detect if it equals the needed number then advance the quest.

So basically

 

 

Script on Quest

 

scn QuestScript

int StoredVar

begin onTrigger

if StoredVar == 4

SetStage Quest 2

endif

end

 

Script on message box Choice

 

scn MBChoiceScript

 

getInt StoredVar

 

begin onActivate

set StoredVar to + 1

end

 

 

The first thing about messages it's - how you want to trigger this messages? By trigger or By interacting with some item or by a quest script? It's a bit hard to explain how todo, so, I just drop to you some script examples right down below

Second, if you want to manupulating with quest vars, check this example:

 

 

Quest Name - Some name
Quest Id - TestQuest123
Var from quest - Somevariabletocheck
In the non-quest script you can get/set/do something by this - <Quest Id>.<Var from quest>
Example - TestQuest123.Somevariabletocheck
Manipulating examples
let TestQuest123.Somevariabletocheck := some new value ;changing
let NewVar := TestQuest123.Somevariabletocheck ;copying value from this quest var to another
if TestQuest123.Somevariabletocheck == some value ;checking/comparing
endif

 

 

Some stuff from geck wiki to check

 

 

 

Example Scripts. 

 

 

scn QuestScript
int StoredVar
int SomeVar1
int SomeVar2
;more quest vars


begin gamemode

if StoredVar == somenumber
;do something

endif

if GetStage Quest == StageId
;do something

endif

;example for quest script after as the trigger sent result
if GetStage Quest == 2
	;do something
	;calling Messagescript for Player
	call MBChoiceScript player
endif

end
scn SomeTriggerScript

begin onTrigger
	if Quest.StoredVar == 4
		SetStage Quest 2
	endif

;example for trigger if you don't want to add this in the quest script
	if Quest.StoredVar == 4
		if GetActionRef == player
			call MBChoiceScript player
		ensid
	endif
end
Message Script that been called

scn MBChoiceScript

int MenuState
int oButton ;// -1=Wait Imput, 0=OptionA, 1=OptionB, ...  
ref rActor

begin function {rActor}
	
	Set oButton to -1

If rActor != Player
	return
elseif rActor == Player
	if MenuState == 0
		let MenuState := 1
		showmessage MessageID
	endif
endif
	
if MenuState == 1 
	set oButton to GetButtonPressed
	if oButton == 0 ; first button
		;do something
		let Quest.StoredVar := some value
	elseif oButton == 1 ; Second button
		;do something more
	elseif oButton == 2 ; Third button
		;if exit
		return
	;elseif ...
	;elseif oButton == 7 ; Eight button, up to nine buttons(but i recomend using 8 only)  
	endif
	let MenuState := 0
endif
end
Message script by interacting something

scn MBChoiceScript
 
int MenuState
int iButton
ref user

begin onActivate

	let User := GetActionRef
	If GetActionRef != Player
		User.Activate
		return
	elseif GetActionRef == Player
		if MenuState == 0
			let MenuState := 1
			showmessage MessageIDName
		elseif MenuState == 2 
		; for more steps
		endif
	endif
end

begin GameMode

if GetInSameCell Player == 0
	Return
endif

if MenuState == 1
	let iButton := GetButtonPressed
	if iButton == 0 ; first button
		;do something
		let InserQuestID.StoredVar += 1
	elseif iButton == 1 ; Second button
		return
	;elseif ...
	endif ;up to nine buttons
	let MenuState := 0
endif


end

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use