Jump to content

need some scripting advice..


angelwraith

Recommended Posts

ok so this is what i need..

 

i have this container..

inside will be weapons.

 

what i want to happen is onactivate a variable is set to sort the weapons on gamemode,, what i need is for the twohanded rifles to be removed and set in in the game with a set pos in z and x to be constant and for the Ypos to start with the first weapon at a certain y pos and add 13 to that position and place the next 2handed rifle there.

 

 

i have a feeling this could be pretty easy with form lists and a loop..

im just not sure how to implement it

 

i think if i could add all the contents of a container to a form i could then do something like getnthform to go through the list and then a set pos with all the variables (of course "set y to y + 13")

and then enable them ... and then loop to do all the contents

 

all as long as they satisfy the weapon type == two handed rifle test

 

idk its all REALLY confusing to me and i have a hunch 5 or 6 lines could fix my dilemma.. HELP PLEASE?!?!

 

this would be a really nice addition to my mod.. would allow users to add all their suitable weapons to the gunrack in yjeir armory

Link to comment
Share on other sites

ok so this is what i need..

 

i have this container..

inside will be weapons.

 

what i want to happen is onactivate a variable is set to sort the weapons on gamemode,, what i need is for the twohanded rifles to be removed and set in in the game with a set pos in z and x to be constant and for the Ypos to start with the first weapon at a certain y pos and add 13 to that position and place the next 2handed rifle there.

 

 

i have a feeling this could be pretty easy with form lists and a loop..

im just not sure how to implement it

 

i think if i could add all the contents of a container to a form i could then do something like getnthform to go through the list and then a set pos with all the variables (of course "set y to y + 13")

and then enable them ... and then loop to do all the contents

 

all as long as they satisfy the weapon type == two handed rifle test

 

idk its all REALLY confusing to me and i have a hunch 5 or 6 lines could fix my dilemma.. HELP PLEASE?!?!

 

this would be a really nice addition to my mod.. would allow users to add all their suitable weapons to the gunrack in yjeir armory

 

I do something similar with ammo - but here it is adapted to rifles. You need to have the very latest version of FOSE for the GetInventoryObject function to work. I have it as a spell, but it doesn't have to be that way.

 

 

 

short	iInvPos;Position in container
short	iItemType;form type
short	iItemCount
short	iFlagRemove
ref	rBaseInvObj;Current Base object in container
short	iWeaponType



BEGIN ScriptEffectStart

;Search from bottom to top and remove unwanted rifles

		set iInvPos to MyContainerREF.GetNumItems
		
		Label 1
			if (iInvPos)
			set iInvPos to (iInvPos - 1)
			set rBaseInvObj to (MyContainerREF.GetInventoryObject iInvPos)
			set iItemType to GetType rBaseInvObj
			if (iItemType == 40)				;weapon Form
				set iWeaponType to GetWeaponType rBaseInvObj
				if ((iweaponType == 5) || (weaponType == 6));two hand rifles and automatics
					set iflagRemove to 1
				endif
			endif
			if (iFlagRemove)

			;Do stuff with the rifles
				set iItemCount to MyContainerREF.GetItemCount rBaseInvObj
				MyContainerREF.RemoveItem rBaseInvObj iItemCount
				set iFlagRemove to 0
			endif
			Goto 1
		endif
		
		RHKNPCREF.RemoveSpell MoveMyRiflesEffect

END

Link to comment
Share on other sites

ok so this is what i need..

 

i have this container..

inside will be weapons.

 

what i want to happen is onactivate a variable is set to sort the weapons on gamemode,, what i need is for the twohanded rifles to be removed and set in in the game with a set pos in z and x to be constant and for the Ypos to start with the first weapon at a certain y pos and add 13 to that position and place the next 2handed rifle there.

 

 

i have a feeling this could be pretty easy with form lists and a loop..

im just not sure how to implement it

 

i think if i could add all the contents of a container to a form i could then do something like getnthform to go through the list and then a set pos with all the variables (of course "set y to y + 13")

and then enable them ... and then loop to do all the contents

 

all as long as they satisfy the weapon type == two handed rifle test

 

idk its all REALLY confusing to me and i have a hunch 5 or 6 lines could fix my dilemma.. HELP PLEASE?!?!

 

this would be a really nice addition to my mod.. would allow users to add all their suitable weapons to the gunrack in yjeir armory

 

I do something similar with ammo - but here it is adapted to rifles. You need to have the very latest version of FOSE for the GetInventoryObject function to work. I have it as a spell, but it doesn't have to be that way.

 

 

 

short	iInvPos;Position in container
short	iItemType;form type
short	iItemCount
short	iFlagRemove
ref	rBaseInvObj;Current Base object in container
short	iWeaponType



BEGIN ScriptEffectStart

;Search from bottom to top and remove unwanted rifles

		set iInvPos to MyContainerREF.GetNumItems
		
		Label 1
			if (iInvPos)
			set iInvPos to (iInvPos - 1)
			set rBaseInvObj to (MyContainerREF.GetInventoryObject iInvPos)
			set iItemType to GetType rBaseInvObj
			if (iItemType == 40)			;weapon Form
				set iWeaponType to GetWeaponType rBaseInvObj
				if ((iweaponType == 5) || (weaponType == 6));two hand rifles and automatics
					set iflagRemove to 1
				endif
			endif
			if (iFlagRemove)

		;Do stuff with the rifles
				set iItemCount to MyContainerREF.GetItemCount rBaseInvObj
				MyContainerREF.RemoveItem rBaseInvObj iItemCount
				set iFlagRemove to 0
			endif
			Goto 1
		endif
		
		RHKNPCREF.RemoveSpell MoveMyRiflesEffect

END

 

 

thank you for teh effort nut that doesnt quite fit what i need...

i did get what i wanted working.. after hours of tinkering and failed attempts but its fine now..

if you would like to see the result i would be glad to share otherwise just wanna say thanks again

Link to comment
Share on other sites

  • 1 month later...
ok so this is what i need..

 

i have this container..

inside will be weapons.

 

what i want to happen is onactivate a variable is set to sort the weapons on gamemode,, what i need is for the twohanded rifles to be removed and set in in the game with a set pos in z and x to be constant and for the Ypos to start with the first weapon at a certain y pos and add 13 to that position and place the next 2handed rifle there.

 

 

i have a feeling this could be pretty easy with form lists and a loop..

im just not sure how to implement it

 

i think if i could add all the contents of a container to a form i could then do something like getnthform to go through the list and then a set pos with all the variables (of course "set y to y + 13")

and then enable them ... and then loop to do all the contents

 

all as long as they satisfy the weapon type == two handed rifle test

 

idk its all REALLY confusing to me and i have a hunch 5 or 6 lines could fix my dilemma.. HELP PLEASE?!?!

 

this would be a really nice addition to my mod.. would allow users to add all their suitable weapons to the gunrack in yjeir armory

 

I do something similar with ammo - but here it is adapted to rifles. You need to have the very latest version of FOSE for the GetInventoryObject function to work. I have it as a spell, but it doesn't have to be that way.

 

 

 

short	iInvPos;Position in container
short	iItemType;form type
short	iItemCount
short	iFlagRemove
ref	rBaseInvObj;Current Base object in container
short	iWeaponType



BEGIN ScriptEffectStart

;Search from bottom to top and remove unwanted rifles

		set iInvPos to MyContainerREF.GetNumItems
		
		Label 1
			if (iInvPos)
			set iInvPos to (iInvPos - 1)
			set rBaseInvObj to (MyContainerREF.GetInventoryObject iInvPos)
			set iItemType to GetType rBaseInvObj
			if (iItemType == 40)				;weapon Form
				set iWeaponType to GetWeaponType rBaseInvObj
				if ((iweaponType == 5) || (weaponType == 6));two hand rifles and automatics
					set iflagRemove to 1
				endif
			endif
			if (iFlagRemove)

			;Do stuff with the rifles
				set iItemCount to MyContainerREF.GetItemCount rBaseInvObj
				MyContainerREF.RemoveItem rBaseInvObj iItemCount
				set iFlagRemove to 0
			endif
			Goto 1
		endif
		
		RHKNPCREF.RemoveSpell MoveMyRiflesEffect

END

 

Thanks alot, without this thread and your example here I'd never found out about these undocumented functions of FOSE o,o

 

helped me making my equipment recycler XD

Link to comment
Share on other sites

  • Recently Browsing   0 members

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