Jump to content

Simple Script problem


Skree000

Recommended Posts

oooh ooh JUST FOUND THIS:

 

http://geck.bethsoft.com/index.php/MenuMode

 

it might allow me to add a check for whether or not the Pipboy menu is open.... i wonder if MenuMode can be preceded by Get or Set

 

 

 

okay some progress in this area

 

when the Pipboy is open and i type 'menumode 1' into the console, it replies : Menumode 1 == 1.00

 

when the pipboy is closed, i type 'menumode 1' into the console, it replies : Menumode 1 == 0.00

Link to comment
Share on other sites

ok i made significant progress using feedback ShowMessage updates, as you draw and holster, first draw, first holster, and while holstered during equip etc ive managed to cause it to give messages telling me it acknowledges these events....

 

standby ill keep you posted... think im on the verge of this...

Link to comment
Share on other sites

scriptname BF2142WeaponSheathFixer
short doonce
short doonce2
short doonce3
short doonce4
short doonce5
short doonce6
short drawn

begin onequip						;do this only when it is first equipped
set doonce to 0
set doonce4 to 0
showmessage 2142TestMsg1;say 'J2 Equipped'

if player.GetItemCount 2142WeapDummy >= 1
	player.removeitem 2142WeapDummy 100 1		;remove old dummies
endif
end

begin gamemode					; do this constantly while the weapon is in inventory

if player.GetEquippedObject 5 == "2142WeapJ2CombatKnife";if j2 is equipped as wpn
	if doonce == 0
		showmessage 2142TestMsg4								;say 'J2 Equipped in Slot 5'
		set doonce to 1
	endif

	if menumode 1 == 0											; if pipboy is closed
		if doonce2 == 0										
			showmessage 2142TestMsg5				;say 'Pipboy is Closed'
			set doonce2 to 1
		endif

		if player.isWeaponout == 0					;if weapon is holstered
			if drawn == 0								;and it has never been drawn before
				if doonce4 == 0							;and i have not received this msg yet since last equipping it
					showmessage 2142TestMsg2	;say 'J2 is still in your holster from the first time you equipped it'
					set doonce4 to 1					;indicate that this message has already been said
				endif
			endif

			if drawn == 1								;if weapon has been drawn before
				if doonce3 == 0							;and i have not received this msg yet since last holstering it
					showmessage 2142TestMsg3	;say 'J2 Holstered again'
					set doonce3 to 1					;indicate that this message has already been said
					set doonce5 to 0					;reset the Weapon is Drawn msg validation since it has been holstrd
					set doonce6 to 1
				endif
			endif
		endif

		if player.isWeaponout == 1					;if weapon is drawn
			set drawn to 1									;indicate that weapon has been drawn
			set doonce3 to 0							;reset the 'j2 holstered again' message so that it can be said again
				if doonce5 == 0							;and i have not received this msg yet since last drawing it
					showmessage 2142TestMsg6	;say 'J2 Drawn'
					set doonce5 to 1					;indicate that this message has already been said
				endif
			endif
		endif
	endif
endif
end

 

this code basically gives textual updates as to everything that happens, as it happens, perfectly. Im very surprised

 

When you equip something in your pipboy, it says that it is equipped.

 

When you close your pipboy, it says the pipboy is closed, then tells you what slot the weapon is in (5)

 

when you close your pipboy and the weapon is still holstered (from it just being equipped), it says so

 

When you draw the weapon anytime, it says that it has been drawn

 

When you holster the weapon anytime, it says that it has been holstered

 

 

now all i need to do is swap out those message-notifications with actions.

actions like additem Dummy, equip dummy, etc etc

 

 

edit: wait i think im missing a step... it doesnt say 'weapon is still sheathed from the first time it has been equipped' more than one time.. After that it jus tsays 'j2 is holstered' when you equip it while its holstered.

 

think i gotta ensure teh Doonce conditions are refreshed upon equipping

Link to comment
Share on other sites

I got it to kinda work. gimme a sec to work out the small problems...

 

///

 

Ok this works to give you the item you want when you sheath your Combatknife

 

scn SwitchSwordsOnUnEquip

short igotSword

begin gameMode
if player.isweaponout == 0 && igotSword == 0
player.additem BoundSword 1
set igotSword to 1
endif
end

 

And this equips the weapon when you obtain it.

 

scn EquipMeWhenUhaveMe

begin onAdd player
player.equipitem BoundSword
end

 

The code to bring back the J2 when you un-sheath the dummy knife goes into a loop and keeps giving you weapons. So, i'm still working on it.

 

///

 

Crap. i just noticed a lot of problems. After getting the BoundSword, equiping the original weapon and sheathing it won't give you the BoundSword again.

Link to comment
Share on other sites

oooh that onAdd looks very efficient, i think ill use that instead of what i have..... awesome. Your way will likely be faster than mine..

 

GOOD NEWS here though!

figured it out this way, but im sure this code can be truncated somehow to make it simpler. right now its pretty bloated, but it works.

 

all the text feedback messages can be removed too since i was only using those to Diagnose and troubleshoot

 

J2

scriptname BF2142WeaponSheathFixer
short doonce
short doonce2
short doonce3
short doonce4
short doonce5
short doonce6
short drawn

begin onequip									;do this only when it is first equipped
set doonce to 0									;reset the 'j2 equipped in slot5' notification so that it can be shown again later
set doonce2 to 0								;reset the Pipboy is closed notification so that it can again be shown later
set doonce4 to 0								;reset the 'j2 is still in your holster from the first time you equipped it' msg so it can be shown later
set drawn to 0
showmessage 2142TestMsg1		 ;say 'J2 Equipped'

if player.GetItemCount 2142WeapDummy >= 1
	player.removeitem 2142WeapDummy 1 1		   ;remove old dummies
endif
end

begin gamemode								; do this constantly while the weapon is in inventory

if player.GetEquippedObject 5 == "2142WeapJ2CombatKnife"   ;if j2 is equipped as wpn
	if doonce == 0													; if the 'j2 equipped in slot 5' msg has not been seen since last unequipped
		showmessage 2142TestMsg4								   ;say 'J2 Equipped in Slot 5'
		set doonce to 1												;indicate that the J2 Equipped in Slot 5 msg has been seen already
	endif

	if menumode 1 == 0												  ;if pipboy is closed
		if doonce2 == 0												;if the Pipboy is Closed message has not been displayed yet
			showmessage 2142TestMsg5						 ;say 'Pipboy is Closed'
			set doonce2 to 1										;indicate the Pipboy is Closed message has been seen already
		endif

		if player.isWeaponout == 0								;if weapon is holstered
			if drawn == 0											;and it has never been drawn before
				if doonce4 == 0										;and i have not received this msg yet since last equipping it
					showmessage 2142TestMsg2				;say 'J2 is still in your holster from the first time you equipped it'
					set doonce4 to 1								;indicate that this message has already been said
					set doonce5 to 0								;reset the Weapon is Drawn msg validation since it has been holstrd
				endif
			endif
			if drawn == 1											;if weapon has been drawn before
				if doonce3 == 0										;and i have not received this msg yet since last holstering it
					showmessage 2142TestMsg3				;say 'J2 Holstered again'
							player.additem 2142WeapDummy 1 1
							player.equipitem 2142WeapDummy 0 1
					set doonce3 to 1								;indicate that this message has already been said
					set doonce5 to 0								;reset the Weapon is Drawn msg validation since it has been holstrd
				endif
			endif
		endif

		if player.isWeaponout == 1								;if weapon is drawn
			set drawn to 1											 ;indicate that weapon has been drawn
			set doonce3 to 0										;reset the 'j2 holstered again' message so that it can be said again
				if doonce5 == 0										;and i have not received this msg yet since last drawing it
					showmessage 2142TestMsg6				;say 'J2 Drawn'
					player.removeitem 2142WeapDummy 1 1 ;delete any dummies
					set doonce5 to 1								;indicate that this message has already been said
				endif
		endif
	endif
	
	if menumode 1 == 1										;if pipboy is open
			set doonce2 to 0										;reset the 'pipboy is closed' msg so that it can be displayed again
	endif
endif
end

 

 

dummy

scriptname BF2142DummyWeaponSheathFixer

begin onequip													;when equipped, do this once
showmessage 2142TestMsg7									;say 'Dummy Equipped'
end

begin gamemode 									;do this constantly while dummy is in inventory

if player.GetEquippedObject 5 == "2142WeapDummy" 		;if Dummy is equipped as wpn
  	 	if player.isWeaponout == 1										;and weapon is drawn
		showmessage 2142TestMsg8								;say 'Unequipping Dummy, switching to J2'
		 player.equipitem 2142WeapJ2CombatKnife 0 1	 	;switch to J2
	else																	;otherwise
		return				   												;do nothing
	endif
endif
end

Link to comment
Share on other sites

I'm having trouble reading the code because of all the empty areas before the lines. Keep it simple, like mine.

 

anyway, i manage to get rid of any copies by adding a "removeME" command when it get un-sheathed(un-sheath? lol)

 

scn EquipMeWhenUhaveMe

begin onAdd player
player.equipitem BoundSword
end

begin gameMode
if player.isWeaponOut == 1 
removeMe
endif
end

 

so now any copies of that weapon will disappear when it's un-sheathed.

Link to comment
Share on other sites

ohhh you are right, another good efficient method....

 

ill add that method to my scripts in a sec...

 

heres my truncated versions that seem to work ok. The only bug so far is if the Dummy is equipped and sheathed, and you look at your pipboy, then equip the J2, it will appear on the hip (the upsidedown version)

This corrects automatically when you draw the weapon out and sheath it again however

 

j2

scriptname BF2142WeaponSheathFixer
short doonce3
short drawn

begin onequip									;do this only when it is first equipped
set drawn to 0								;reset drawn state, since weapon is not drawn
if player.GetItemCount 2142WeapDummy >= 1	   ;if there are dummies,
	player.removeitem 2142WeapDummy 1 1		   ;remove old dummies
endif
end

begin gamemode								; do this constantly while the weapon is in inventory
if player.GetEquippedObject 5 == "2142WeapJ2CombatKnife"   ;if j2 is equipped as wpn
		if player.isWeaponout == 0								;if weapon is holstered
			if drawn == 1											;if weapon has been drawn before
				if doonce3 == 0										;and i have not received this msg yet since last holstering it
							player.additem 2142WeapDummy 1 1		   ;adds dummy
							player.equipitem 2142WeapDummy 0 1		;equips dummy
					set doonce3 to 1								;indicate that this 'dummy-swap' event has already happened
				endif
				set drawn to 0
			endif
		endif
		if player.isWeaponout == 1								;if weapon is drawn
			set drawn to 1											 ;indicate that weapon has been drawn
			set doonce3 to 0										;reset the 'dummy-swap' event so that it can happen again
			player.removeitem 2142WeapDummy 1 1 ;delete any dummies
		endif
	endif
endif
end

 

dummy

scriptname BF2142DummyWeaponSheathFixer

begin gamemode 									;do this constantly while dummy is in inventory
if player.GetEquippedObject 5 == "2142WeapDummy" 		;if Dummy is equipped as wpn
  	 	if player.isWeaponout == 1										;and weapon is drawn
		player.equipitem 2142WeapJ2CombatKnife 0 1	 	;Unequipping Dummy, switching to J2
	else																	;otherwise
		return				   												;do nothing
	endif
endif
end

Link to comment
Share on other sites

Okay did more truncating and added more of your revisions. Here are the two codes so far. This works, except for the bug when you equip the item while weapons are sheathed, in that case, the J2 appears upsidedown on the hip (the placeholder does not appear at this point yet. The j2 must first be drawn and then sheathed for that to happen)

 

scriptname BF2142WeaponSheathFixer
short doonce


begin gamemode								; do this constantly while the weapon is in inventory
if player.GetEquippedObject 5 == "2142WeapJ2CombatKnife"   ;if j2 is equipped as wpn
	if menumode 1 == 0   										;if pipboy is closed
		if player.isWeaponout == 0								;if weapon is holstered
				if doonce == 0										;and i have not done the 'dummy swap' event yet since last drawing it
							player.additem 2142WeapDummy 1 1		   ;adds dummy
					set doonce to 1								;indicate that this 'dummy-swap' event has already happened
				endif
			endif
		endif
		if player.isWeaponout == 1								;if weapon is drawn
			set doonce to 0										;reset the 'dummy-swap' event so that it can happen again
		endif
	endif
endif
end

 

 

dummy:

scriptname BF2142DummyWeaponSheathFixer

begin OnAdd player 														;when the item is added	
player.equipitem 2142WeapDummy	0 1						;it is equipped
end
Begin Gamemode															;do this constantly while dummy is in inventory
if player.GetEquippedObject 5 == "2142WeapDummy" 		;if Dummy is equipped as wpn
  	 	if player.isWeaponout == 1										;and weapon is drawn
		player.equipitem 2142WeapJ2CombatKnife 0 1	 	;Unequipping Dummy, switching to J2
		removeMe
	else																	;otherwise
		return				   												;do nothing
	endif
endif
end

begin onunequip															;if unequipped, remove me
removeme
end

Link to comment
Share on other sites

I don't want to sound prudent or anything because I'm not a big programmer either.. But wouldn't it be easier to just flip the weapon during the un-sheathing animation?

 

that would typically be the easiest solution, however to do that i would have to make a completely new animation set for reverse grips, since if i changed vanilla, each and every weapon would now be backwards.

This way, i just flipped the one i want to be reversed....

 

i suppose someone could make a reverse grip button that flips it on their own... but oh well lol

 

 

 

Here are the codes as im leaving them. Now the only problem is the Fake Dummy knife shows up in the players inventory.

 

Is there any way to hide items from the player seeing them in the inventory? Id really like to find out! lol

 

J2 Blade

scriptname BF2142WeaponSheathFixer
short doonce


begin gamemode																; do this constantly while the weapon is in inventory
if player.GetEquippedObject 5 == "2142WeapJ2CombatKnife"	   ;if j2 is equipped as wpn
		if menumode 1 == 0   											;if pipboy is closed
			if player.isWeaponout == 0										;if weapon is holstered
				if doonce == 0													;and i have not done the 'dummy swap' event yet since last drawing it
					player.additem 2142WeapDummy 1 1	 				  ;adds dummy
					set doonce to 1												;indicate that this 'dummy-swap' event has already happened
				endif
			endif
			if player.isWeaponout == 1										;if weapon is drawn
				set doonce to 0												;reset the 'dummy-swap' event so that it can happen again
			endif
		endif	
endif
end

 

Dummy

scriptname BF2142DummyWeaponSheathFixer

begin OnAdd player 														;when the item is added	
player.equipitem 2142WeapDummy	0 1						;it is equipped
end
Begin Gamemode															;do this constantly while dummy is in inventory
if player.GetEquippedObject 5 == "2142WeapDummy" 		;if Dummy is equipped as wpn
  	 	if player.isWeaponout == 1										;and weapon is drawn
		player.equipitem 2142WeapJ2CombatKnife 0 1	 	;Unequipping Dummy, switching to J2
		removeMe
	else																	;otherwise
		return				   												;do nothing
	endif
endif
end

begin onunequip															;if unequipped, remove me
removeme
end

Link to comment
Share on other sites

  • Recently Browsing   0 members

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