Jump to content

script questions


MBile

Recommended Posts

I have something like this for starting out:

 

scn ShowOnCharacter1

 

short varHotkey1

 

begin OnActorEquip player

 

if Weap10mmPistol GetHotkeyItem 1:0

set varHotkey1 to 1

player.Additem dummy10mmarmor 1

endif

 

End

 

 

 

how does that sound? Im not particularly experience in scripting for this

Edited by MBile
Link to comment
Share on other sites

There are a few things in your script that don't make much sense. For example, varHotkey1. It doesn't seem to have any purpose in your script. If you're trying to stop the condition from running again with that variable you'd need to add "&& varHotkey == 0" to the if statement. Otherwise, if you have a 10mm pistol assigned to hotkey one, you're going to receive your armour item each time the script runs.

 

begin OnActorEquip doesn't make much sense here either. That block should be called on a specific item, so that when it's equipped the script will run. Since you have the condition to check for the 10mm pistol, I assume this is meant to be a quest script.

 

One other thing, this isn't critical but it would be a good idea given what you're trying to accomplish. in the line "Player.AddItem dummy10mmarmor 1", you may also want to set the Hide message flag to 1. This is acomplished just by putting and additional "1" after the one you already have.

 

Also, if you try to check each and every type of weapon, you're going to have an insane number of if statements. Instead of individually checking for each weapon, why not just check what's assigned to a particular hotkey and then iterate through a form list, and then check it against another? Something like:

 

 

 

scn ShowOnCharacterScript

ref rItem1
ref rItem2
ref rItem3
ref rItem4
ref rItem5
ref rItem6
ref rItem7
ref rItem8
ref rListItem
short bSwitch
short iListCounter
short iCounter

begin GameMode

	if rItem1 != GetHotkeyItem 1
		set rItem1 to GetHotkeyItem 1
		set bSwitch to 0
	elseif rItem2 != GetHotkeyItem 2
		set rItem2 to GetHotkeyItem 2
		set bSwitch to 0
	elseif rItem3 != GetHotkeyItem 3
		set rItem3 to GetHotkeyItem 3
		set bSwitch to 0
	elseif rItem4 != GetHotkeyItem 4
		set rItem4 to GetHotkeyItem 4
		set bSwitch to 0
	elseif rItem5 != GetHotkeyItem 5
		set rItem5 to GetHotkeyItem 5
		set bSwitch to 0
	elseif rItem6 != GetHotkeyItem 6
		set rItem6 to GetHotkeyItem 6
		set bSwitch to 0
	elseif rItem7 != GetHotkeyItem 7
		set rItem7 to GetHotkeyItem 7
		set bSwitch to 0
	elseif rItem8 != GetHotkeyItem 8
		set rItem8 to GetHotkeyItem 8
		set bSwitch to 0
	endif

	=======

	if bSwitch == 0
		set iCounter to 0
		set iListCounter to 0
		Label 1
		if iListCounter < 8
			if iCounter < ListGetCount AllWeaponsList ;note, this list doesn't exist in the vanilla files, so you'll need to create it yourself.
				set rListItem to ListGetNthForm AllWeaponsList iCounter
				if rItem1 == rListItem && iListCounter == 0
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 1
					set iCounter to 0
				elseif rItem2 == rListItem && iListCounter == 1
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 2
					set iCounter to 0
				elseif rItem3 == rListItem && iListCounter == 2
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 3
					set iCounter to 0
				elseif rItem4 == rListItem && iListCounter == 3
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 4
					set iCounter to 0
				elseif rItem5 == rListItem && iListCounter == 4
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 5
					set iCounter to 0
				elseif rItem6 == rListItem && iListCounter == 5
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 6
					set iCounter to 0
				elseif rItem7 == rListItem && iListCounter == 6
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 7
					set iCounter to 0
				elseif rItem8 == rListItem && iListCounter == 7
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 8
					set iCounter to 0
				endif
			endif
			set iCounter to iCounter + 1
			GoTo 1
		endif
		set bSwitch to 1
	endif
end

 

 

 

Something tells me that the above script doesn't make much sense to you. Let me explain the idea behind it. What we're doing here is, first, checking what's assigned to each hotkey (the section above the "=======", which really ought to have a ";" in front of it to indicate that it's a comment, but that seems to screw up the colours down below. If you decide to copy & paste this script, you'll need to delete that). After that, we check what those items are, by checking them against a form list (AllWeaponsList) which contains every weapon in the game. No such form-list exists by default so you'll need to make that yourself. Then, we get an item from another custom form-list (AllDummyWeaponsList). This one will contain all of your weapon-armour items. Now, for this script to work it is imperative that each item is in exactly the same order as in the AllWeaponsList form-list. So for example, in the AllWeaponsList form-list, the first entry may be "Weap10mmPistol", in the other form-list the first entry must be "DummyWeap10mmPistol" or whatever you call the 10mm pistol armour peice. This shouldn't be too difficult if you give your armour items the same name as the weapons they correspond to. If you include a prefix or suffix, so long as it's the same each time, the order should still be correct.

 

If you'd like to learn more about scripting, have a look at this. That may be for Fallout 3, but since the engines are almost identical, it's still relevant for New Vegas. This sounds like an incredibly ambitious project, and I wish you luck with it. :smile:

Edited by Jojash
Link to comment
Share on other sites

There are a few things in your script that don't make much sense. For example, varHotkey1. It doesn't seem to have any purpose in your script. If you're trying to stop the condition from running again with that variable you'd need to add "&& varHotkey == 0" to the if statement. Otherwise, if you have a 10mm pistol assigned to hotkey one, you're going to receive your armour item each time the script runs.

 

begin OnActorEquip doesn't make much sense here either. That block should be called on a specific item, so that when it's equipped the script will run. Since you have the condition to check for the 10mm pistol, I assume this is meant to be a quest script.

 

One other thing, this isn't critical but it would be a good idea given what you're trying to accomplish. in the line "Player.AddItem dummy10mmarmor 1", you may also want to set the Hide message flag to 1. This is acomplished just by putting and additional "1" after the one you already have.

 

Also, if you try to check each and every type of weapon, you're going to have an insane number of if statements. Instead of individually checking for each weapon, why not just check what's assigned to a particular hotkey and then iterate through a form list, and then check it against another? Something like:

 

 

 

scn ShowOnCharacterScript

ref rItem1
ref rItem2
ref rItem3
ref rItem4
ref rItem5
ref rItem6
ref rItem7
ref rItem8
ref rListItem
short bSwitch
short iListCounter
short iCounter

begin GameMode

	if rItem1 != GetHotkeyItem 1
		set rItem1 to GetHotkeyItem 1
		set bSwitch to 0
	elseif rItem2 != GetHotkeyItem 2
		set rItem2 to GetHotkeyItem 2
		set bSwitch to 0
	elseif rItem3 != GetHotkeyItem 3
		set rItem3 to GetHotkeyItem 3
		set bSwitch to 0
	elseif rItem4 != GetHotkeyItem 4
		set rItem4 to GetHotkeyItem 4
		set bSwitch to 0
	elseif rItem5 != GetHotkeyItem 5
		set rItem5 to GetHotkeyItem 5
		set bSwitch to 0
	elseif rItem6 != GetHotkeyItem 6
		set rItem6 to GetHotkeyItem 6
		set bSwitch to 0
	elseif rItem7 != GetHotkeyItem 7
		set rItem7 to GetHotkeyItem 7
		set bSwitch to 0
	elseif rItem8 != GetHotkeyItem 8
		set rItem8 to GetHotkeyItem 8
		set bSwitch to 0
	endif

	=======

	if bSwitch == 0
		set iCounter to 0
		set iListCounter to 0
		Label 1
		if iListCounter < 8
			if iCounter < ListGetCount AllWeaponsList ;note, this list doesn't exist in the vanilla files, so you'll need to create it yourself.
				set rListItem to ListGetNthForm AllWeaponsList iCounter
				if rItem1 == rListItem && iListCounter == 0
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 1
					set iCounter to 0
				elseif rItem2 == rListItem && iListCounter == 1
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 2
					set iCounter to 0
				elseif rItem3 == rListItem && iListCounter == 2
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 3
					set iCounter to 0
				elseif rItem4 == rListItem && iListCounter == 3
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 4
					set iCounter to 0
				elseif rItem5 == rListItem && iListCounter == 4
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 5
					set iCounter to 0
				elseif rItem6 == rListItem && iListCounter == 5
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 6
					set iCounter to 0
				elseif rItem7 == rListItem && iListCounter == 6
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 7
					set iCounter to 0
				elseif rItem8 == rListItem && iListCounter == 7
					set rListItem to ListGetNthForm AllDummyWeaponsList iCounter
					Player.AddItem rListItem 1 1
					Player.EquipItem rListItem 0 1
					set iListCounter to 8
					set iCounter to 0
				endif
			endif
			set iCounter to iCounter + 1
			GoTo 1
		endif
		set bSwitch to 1
	endif
end

 

 

 

Something tells me that the above script doesn't make much sense to you. Let me explain the idea behind it. What we're doing here is, first, checking what's assigned to each hotkey (the section above the "=======", which really ought to have a ";" in front of it to indicate that it's a comment, but that seems to screw up the colours down below. If you decide to copy & paste this script, you'll need to delete that). After that, we check what those items are, by checking them against a form list (AllWeaponsList) which contains every weapon in the game. No such form-list exists by default so you'll need to make that yourself. Then, we get an item from another custom form-list (AllDummyWeaponsList). This one will contain all of your weapon-armour items. Now, for this script to work it is imperative that each item is in exactly the same order as in the AllWeaponsList form-list. So for example, in the AllWeaponsList form-list, the first entry may be "Weap10mmPistol", in the other form-list the first entry must be "DummyWeap10mmPistol" or whatever you call the 10mm pistol armour peice. This shouldn't be too difficult if you give your armour items the same name as the weapons they correspond to. If you include a prefix or suffix, so long as it's the same each time, the order should still be correct.

 

If you'd like to learn more about scripting, have a look at this. That may be for Fallout 3, but since the engines are almost identical, it's still relevant for New Vegas. This sounds like an incredibly ambitious project, and I wish you luck with it. :smile:

 

 

i am looking over your script now. ive been looking at scripting for awhile but since i am now on vacation ive had more time for it. thank you kindly for the help.

 

im not sure it seems overly ambitious. the idea is just to apply a dummy item when you have it equipped to a hotkey. been interested in the idea for awhile. the modelling is the easy part. all the assets already exist more or less. just need some scripting magic which i am behind the time times on.

Link to comment
Share on other sites

im not sure it seems overly ambitious. the idea is just to apply a dummy item when you have it equipped to a hotkey. been interested in the idea for awhile. the modelling is the easy part. all the assets already exist more or less. just need some scripting magic which i am behind the time times on.

 

 

I suppose it seems ambitious to me, since it'll require making an armour item for each weapon, and possibly each modded variant of that weapon, not to mention DLCs or weapon-pack mods.

 

Anyway, as I said before, I wish you luck with it! If you do encounter any scripting issues, post back here or send me a PM, and I'll be happy to lend you whatever assistance I can. :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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