Jump to content

Looking for help with scripting


Shadyfan4500

Recommended Posts

Hello. I am an aspiring game developer, and current modder. I say modder, but I have no real mods. A weapon mod, and a mod as easy as changing values in the GECK, nothing beyond that. I didn't even make the textures (I suck at graphic design). I am trying to learn c++ and scripting and the GECK (better) so I can make much better mods, and maybe make my own games - without game makers and stuff like that.

 

Let's cut to the chase:

I would like to have someone that I can go to and ask questions, on a regular basis if need be (I am good at learning, but also forgetting.). Or maybe even a mentor or tutor or something. Someone that I can ask questions to or to teach me some things - that is it. I feel like it would be easier to communicate on Steam because I don't check Nexus too often (the reason I mostly avoid forums). Thanks.

Link to comment
Share on other sites

For instance, two of the scripts I have made for a custom mod (that I have not disclosed info of yet). One of them is meant to show a message, and add an item so you can review the message whenever you equip the item. However, for some reason, the script that adds the item to the game and shows the message, doesn't work. It looks perfectly fine. GECK Powerup finds NO issues with it, however it doesn't work or it crashes the game. What is wrong with it?

 

(I have changed the name of the message, item, and script because it would give away part of the mod, but here is the script. Also, it has all of the info needed - message and item. Nothing is missing so it should be working.)

 

ScriptName 0ModInventoryMessageScript2
Begin GameMode
if GetQuestRunning VCG01 == 1
ShowMessage 01ModInventoryMessage
if Player.GetItemCount 0ModInvMessage < 1
Player.AddItem 0ModInvMessage 1
endif
endif
end
(I also have no idea what kind of script it should be. I made a quest for it, added three stages, and made the resulting script add the item and show the message. It never works as a quest script, or as an object script. Whenever I have it start with GameMode it usually crashes. What is wrong with this script?)
Edited by Shadyfan4500
Link to comment
Share on other sites

  • 2 weeks later...

I made another script that I made with the added feature of debugging (sort of)

I tested it on my character and on that of the target NPC I want it used on

it worked for my character, but not for the target NPC. :|

scn MatterWeaponsNPC ; script that randomizes what weapon each dead guard recieves, the number of the appropriate type of ammo, how many caps each NPC has, and adds and equips Van Graff armor.
;; Comments made with two ;'s are meant for testing the script with the player
ref mnpc
short runonce ; Stops the adding of weapons if this is set to 1
short runonce1 ; Stops the adding of armor if this is set to 1
short doonce0 ; Stops the non stop adding of ammo
short doonce1 ; Stops the non stop adding of caps
short ammocount
short ammotype
short caps
short weaptype ; Plasma Rifle
short weaptype1 ; Laser Rifle
short weaptype2 ; Laser Pistol
short weaptype3 ; Plasma Pistol
Begin GameMode
Set mnpc to matternpcdead2
;; Set mnpc to Player
; Adding the armor to the NPC
if mnpc.GetItemCount ArmorCombatBlack == 0 && runonce1 == 0
mnpc.AddItem ArmorCombatBlack 1
mnpc.EquipItem ArmorCombatBlack 1
set runonce1 to 1
endif
; This makes it so that if this chunk has been run already it won't run again, and it makes it skip the chunk that adds a random weapon
if mnpc.GetItemCount WeapPlasmaRifle >= 1 || runonce == 1
set weaptype to 1
set runonce to 1
endif
if mnpc.GetItemCount WeapLaserRifle >= 1 || runonce == 1
set weaptype1 to 1
set runonce to 1
endif
if mnpc.GetItemCount WeapLaserPistol >= 1 || runonce == 1
set weaptype2 to 1
set runonce to 1
endif
if mnpc.GetItemCount WeapPlasmaPistol >= 1 || runonce == 1
set weaptype3 to 1
set runonce to 1
endif
; The type of weapon that will be added to the NPC
if weaptype == 0 && weaptype1 == 0 && weaptype2 == 0 && weaptype3 == 0
set weaptype to rand 1. 18
if weaptype == 1 || weaptype == 5 || weaptype == 9 || weaptype == 12 || weaptype == 15
mnpc.AddItem WeapPlasmaRifle 1
mnpc.EquipItem WeapPlasmaRifle 1 1
set ammotype to 0
elseif weaptype == 2 || weaptype == 6 || weaptype == 10 || weaptype == 13 || weaptype == 16
mnpc.AddItem WeapLaserRifle 1
mnpc.EquipItem WeapLaserRifle 1 1
set ammotype to 0
elseif weaptype == 3 || weaptype == 7 || weaptype == 11 || weaptype == 14 || weaptype == 17
mnpc.AddItem WeapLaserPistol 1
mnpc.EquipItem WeapLaserPistol 1 1
set ammotype to 1
elseif weaptype == 4 || weaptype == 8 || weaptype == 12 || weaptype == 15 || weaptype == 18
mnpc.AddItem WeapPlasmaPistol 1
mnpc.EquipItem WeapPlasmaPistol 1 1
set ammotype to 1
endif
endif
; The amount of ammo the NPC has
; Changes based on the weapon selected above
if ammotype == 0 && doonce0 == 0
set ammocount to rand 1. 4
if ammocount == 1
mnpc.AddItem AmmoMicroFusionCell 24
set doonce0 to 1
elseif ammocount == 2
mnpc.AddItem AmmoMicroFusionCell 13
set doonce0 to 1
elseif ammocount == 3
mnpc.AddItem AmmoMicroFusionCell 54
set doonce0 to 1
elseif ammocount == 4
mnpc.AddItem AmmoMicroFusionCell 35
set doonce0 to 1
endif
elseif ammotype == 1 && doonce0 == 0
set ammocount to rand 1. 4
if ammocount == 1
mnpc.AddItem AmmoSmallEnergyCell 24
set doonce0 to 1
elseif ammocount == 2
mnpc.AddItem AmmoSmallEnergyCell 13
set doonce0 to 1
elseif ammocount == 3
mnpc.AddItem AmmoSmallEnergyCell 54
set doonce0 to 1
elseif ammocount == 4
mnpc.AddItem AmmoSmallEnergyCell 35
set doonce0 to 1
endif
endif
; The amount of caps the NPC has on them
if mnpc.GetItemCount Caps001 == 0
set caps to 0
endif
if mnpc.GetItemCount Caps001 >= 1
set caps to 1
endif
if caps == 0 && doonce1 == 0
set caps to rand 1. 6
if caps == 1
mnpc.AddItem Caps001 23
set doonce1 to 1
elseif caps == 2
mnpc.AddItem Caps001 63
set doonce1 to 1
elseif caps == 3
mnpc.AddItem Caps001 31
set doonce1 to 1
elseif caps == 4
mnpc.AddItem Caps001 93
set doonce1 to 1
elseif caps == 5
mnpc.AddItem Caps001 12
set doonce1 to 1
elseif caps == 6
mnpc.AddItem Caps001 27
set doonce1 to 1
endif
elseif caps == 1 && doonce1 == 0
mnpc.AddItem Caps001 2
set doonce1 to 1
endif
end
sorry about the centering. I can't use tab in here, and I don't feel like hitting space a million times.
Link to comment
Share on other sites

I'm not much help but I have a suggestion when posting code, use the Code feature in the post tool bar <> I use javascript code and also place a spoiler around it so it isn't making a huge post. The code tool all you gotta do is copy and paste it will carry over the tabs etc. That centered code is actually hard to read and looks like a poem XD

 

Just some friendly advice,

Geoff

Link to comment
Share on other sites

Okay thanks. How is this?

scn MatterWeaponsNPC ; script that randomizes what weapon each dead guard recieves, the number of the appropriate type of ammo, how many caps each NPC has, and adds and equips Van Graff armor.

;; Comments made with two ;'s are meant for testing the script with the player

ref mnpc
short runonce ; Stops the adding of weapons if this is set to 1
short runonce1 ; Stops the adding of armor if this is set to 1
short doonce0 ; Stops the non stop adding of ammo
short doonce1 ; Stops the non stop adding of caps
short ammocount
short ammotype
short caps
short weaptype ; Plasma Rifle
short weaptype1 ; Laser Rifle
short weaptype2 ; Laser Pistol
short weaptype3 ; Plasma Pistol
	
Begin GameMode
	
		Set mnpc to matternpcdead2
;;		Set mnpc to Player


; Adding the armor to the NPC
			
		if mnpc.GetItemCount ArmorCombatBlack == 0 && runonce1 == 0
			mnpc.AddItem ArmorCombatBlack 1
			mnpc.EquipItem ArmorCombatBlack 1
			set runonce1 to 1
		endif
		
; This makes it so that if this chunk has been run already it won't run again, and it makes it skip the chunk that adds a random weapon
		
		if mnpc.GetItemCount WeapPlasmaRifle >= 1 || runonce == 1
			set weaptype to 1
			set runonce to 1
		endif
		
		if mnpc.GetItemCount WeapLaserRifle >= 1 || runonce == 1
			set weaptype1 to 1
			set runonce to 1
		endif
		
		if mnpc.GetItemCount WeapLaserPistol >= 1 || runonce == 1
			set weaptype2 to 1
			set runonce to 1
		endif

		if mnpc.GetItemCount WeapPlasmaPistol >= 1 || runonce == 1
			set weaptype3 to 1
			set runonce to 1
		endif
		
; The type of weapon that will be added to the NPC
		
		if weaptype == 0 && weaptype1 == 0 && weaptype2 == 0 && weaptype3 == 0
			set weaptype to rand 1. 18
				if weaptype == 1 || weaptype == 5 || weaptype == 9 || weaptype == 12 || weaptype == 15
					mnpc.AddItem WeapPlasmaRifle 1																
					mnpc.EquipItem WeapPlasmaRifle 1 1
					set ammotype to 0															
				elseif weaptype == 2 || weaptype == 6 || weaptype == 10 || weaptype == 13 || weaptype == 16
					mnpc.AddItem WeapLaserRifle 1
					mnpc.EquipItem WeapLaserRifle 1 1
					set ammotype to 0
				elseif weaptype == 3 || weaptype == 7 || weaptype == 11 || weaptype == 14 || weaptype == 17
					mnpc.AddItem WeapLaserPistol 1
					mnpc.EquipItem WeapLaserPistol 1 1
					set ammotype to 1
				elseif weaptype == 4 || weaptype == 8 || weaptype == 12 || weaptype == 15 || weaptype == 18
					mnpc.AddItem WeapPlasmaPistol 1
					mnpc.EquipItem WeapPlasmaPistol 1 1
					set ammotype to 1
				endif
		endif
		
; The amount of ammo the NPC has
; Changes based on the weapon selected above
		
		if ammotype == 0 && doonce0 == 0
			set ammocount to rand 1. 4
				if ammocount == 1
					mnpc.AddItem AmmoMicroFusionCell 24
					set doonce0 to 1
				elseif ammocount == 2
					mnpc.AddItem AmmoMicroFusionCell 13
					set doonce0 to 1
				elseif ammocount == 3
					mnpc.AddItem AmmoMicroFusionCell 54
					set doonce0 to 1
				elseif ammocount == 4
					mnpc.AddItem AmmoMicroFusionCell 35
					set doonce0 to 1
				endif
		elseif ammotype == 1 && doonce0 == 0
			set ammocount to rand 1. 4
				if ammocount == 1 
					mnpc.AddItem AmmoSmallEnergyCell 24
					set doonce0 to 1
				elseif ammocount == 2
					mnpc.AddItem AmmoSmallEnergyCell 13
					set doonce0 to 1
				elseif ammocount == 3
					mnpc.AddItem AmmoSmallEnergyCell 54
					set doonce0 to 1
				elseif ammocount == 4
					mnpc.AddItem AmmoSmallEnergyCell 35
					set doonce0 to 1
				endif
		endif
		
; The amount of caps the NPC has on them
		
		if mnpc.GetItemCount Caps001 == 0
			set caps to 0
		endif
	
		if mnpc.GetItemCount Caps001 >= 1
			set caps to 1
		endif
			
			if caps == 0 && doonce1 == 0
				set caps to rand 1. 6
					if caps == 1
						mnpc.AddItem Caps001 23
						set doonce1 to 1
					elseif caps == 2
						mnpc.AddItem Caps001 63
						set doonce1 to 1
					elseif caps == 3
						mnpc.AddItem Caps001 31
						set doonce1 to 1
					elseif caps == 4
						mnpc.AddItem Caps001 93
						set doonce1 to 1
					elseif caps == 5
						mnpc.AddItem Caps001 12
						set doonce1 to 1
					elseif caps == 6
						mnpc.AddItem Caps001 27
						set doonce1 to 1
					endif
			elseif caps == 1 && doonce1 == 0
				mnpc.AddItem Caps001 2
				set doonce1 to 1
			endif
end
Edited by Shadyfan4500
Link to comment
Share on other sites

I set it to auto detect. The purple color reminds me of Apple Script from the Apple computers at my school. You know what language it is if you script New Vegas. (if you don't, it is like a modified and more basic C++ unless you use NVSE and then it is less basic)

 

That's a lot better! Yeah I just do very minor/basic scripts usually involving activators to disable/enable items/npcs etc, open doors, make timed battle events and the like. Tampered with FOSE and got a little help to make a mesmetron weapon that unlocked things. I prefer less complicated things XD

 

Best of luck in your search!

Geoff

Link to comment
Share on other sites

Thanks. You seem like a pretty cool person. I just hope someone can help me out. I feel like it is probably something really simple, even with the first script I posted. Maybe I should try to revise that and remove the item that shows the message upon activation and make it only show the message instead. That would be easier to do.

Link to comment
Share on other sites

If I understand what you are trying to do with the first smaller script is trigger a message that adds an equippable item that when the player equips said item it shows the message again? If that is the case you forgot a key feature. You forgot a function to check if the player has the item equipped. I would place this script on the equipment piece

scn YourEquipSCRIPT

Begin Gamemode

	if ( Player.GetEquipped EquipID == 1 )
		showmessage YourMessage
	endif

End

and have your original script add the item for the player to equip.

 

Hope I understood correctly

Geoff

scn YourEquipSCRIPT

Begin OnEquip

	if ( Player.GetEquipped EquipID == 1 )
		showmessage YouMessage
	endif

End

Could also use that which might be better with the OnEquip block. Side note if it isn't a quest item and you might pass it to a companion you might add Player to the block Begin OnEquip Player so that it only shows your message when the player equips it.

Link to comment
Share on other sites

So you have to specify that the item is equiped whether or not it is in an equip block? Is that the same for OnActivate? and if so how, because I don't see it in the GECK's default functions. (As you could tell from my larger script I am using NVSE with the GECK so I can use all of that stuff too)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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