Jump to content

Simple Script problem


Skree000

Recommended Posts

That doesn't seem to work.

 

You can't un-equip the J2 and there were other problems. I'll see what i can do.

 

 

///

 

 

Ha! i got it to work. We had the same problem. We were trying to do too many things within the same block.

 

scn SwitchSwordsOnUnEquip

short doonce

begin gamemode
if player.GetEquipped RealWeapon && player.isWeaponout == 0 && doonce ==  0													
player.additem DummyWeapon 1					   
set doonce to 1											  
return
endif
end

begin gameMode
if player.isWeaponout == 1										
set doonce to 0
endif
end

 

You were trying to do to many things within the same block and within the same frame. So, i split the code into 2 parts and added a return command so it wouldn't try to do to much within the same frame.

 

scn EquipMeWhenUhaveMe

begin OnAdd player															
player.equipitem dummyweapon					  
end

Begin Gamemode															
if (player.GetEquipped dummyweapon) && (player.isWeaponout == 1)									   
player.equipitem RealWeapon	  
return
endif
end

begin gameMode
if player.GetEquipped RealWeapon
removeME
endif
end

 

The same problems appeared here in your code, so i had to split and add return commands so it would do each block in separate frames.

 

So yeah it works now. I had a one-handed sword out and when i sheathed(?) the weapon it became a two handed claymore that was placed in my back.

 

Then when i un-sheathed the 2handed weapon, the character reached out behind him and grabbed the 1handed longsword instead. I though it would've ended up looking weird, but it doesn't.

 

So now people can carry their longs swords on their back and their giant claymores on their waists, or you can even carry a one handed huge sword that wouldn't get sheathed on the character's hips which would end up looking lame.

Link to comment
Share on other sites

hey thats great!!!

 

Say, now i tried to modify my scripts to destroy/remove the original weapon while the dummy is present, and when the dummy is swapped back, the dummy is destroyed....

 

I gave the dummy the ingame alias of the regular weapon, so if players were looking at their inventory window they would never see a dummy objects name, and never more than what they had before.

 

Sadly, now it freezes up when i try to draw the sheathed dummy weapon.... any clues as to that one? Perhaps i am (like you said just now) trying to do too much in each code?

Link to comment
Share on other sites

The code doesn't add the RealWeapon, it just equips it since you already have. gimme a minute to think of something...

 

BTW replace additem with additemNS and equipitem with equipitemNS. The "NS" means NO SPAM. it's to remove the messages that appear when u add and equip items. Try it and see if it works with FOSE.

Link to comment
Share on other sites

The code doesn't add the RealWeapon, it just equips it since you already have. gimme a minute to think of something...

 

BTW replace additem with additemNS and equipitem with equipitemNS. The "NS" means NO SPAM. it's to remove the messages that appear when u add and equip items. Try it and see if it works with FOSE.

 

 

when you type in numbers after additem and equipitem it does it silently, equipitem 0 1 does silent equip, additem 1 1 adds one item silently also.

Link to comment
Share on other sites

The code doesn't add the RealWeapon, it just equips it since you already have. gimme a minute to think of something...

 

BTW replace additem with additemNS and equipitem with equipitemNS. The "NS" means NO SPAM. it's to remove the messages that appear when u add and equip items. Try it and see if it works with FOSE.

 

 

when you type in numbers after additem and equipitem it does it silently, equipitem 0 1 does silent equip, additem 1 1 adds one item silently also.

 

Oh well i don't think that exist in OBSE. It might be something that only FOSE has.

 

Anyway, i tried writing some code that destroys the realWeapon once it's sheathed, but i fell into some problems.

 

Giving the realWeapon back to the player when the dummyWeapon is unsheathed works, but adding a "begin onAdd" block to the realWeapon to get it equipped causes the scripts to go into an infinite loop.

 

i think that means that both scrips are running at the same time during the unsheathe moment. I think it might be fixed by making a quest script that runs all the time and have that handle all the weapon switches.

Link to comment
Share on other sites

bit of a discovery,

i have found that when a script 'forces' an item to be equipped, or forces A DIFFERENT item to be swapped, this ignores that items 'Begin OnUnequip' blocktype, im thinking because it was not naturally unequipped from the Pipboy. In Oblivion terms i would assume this is the equivalent of the Inventory window

 

so Begin OnUnequip only seems to work if you manually unclick an item from your ivnentory =(

Link to comment
Share on other sites

Have you tried converting the scripts into a single quest script?

 

Just make a new quest, then add the new script(making sure it was previously saved as a quest script, not an object script).

 

The code works, but if you wanna destroy the main weapon once it switches to the dummy knife, then i don't think you have any other choice.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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