Jump to content
⚠ Known Issue: Media on User Profiles ×

Pipboy equip via script


xab666

Recommended Posts

I have a modified workbench, with a script to remove the pipboy (and glove) if already worn, and to give and equip the pipboy and glove otherwise. it removes and unequips the pipboy fine (except the missing arm piece... is there a way to remove/requip armor without knowing what the actor is wearing?).

the script gives the pipboy and glove back fine, but when the pipboy equip runs it crashes (ive removed parts and recompiled to narrow it down - removing the player.equip pipboy 1 0 doesnt cause the game to crash).

 

heres the script:

Scn PipboybegoneScript

short haspipboy
begin gamemode
if (player.getequipped pipboy >= 1)
 set haspipboy to 1
 pipboymarker.disable
endif
if (player.getequipped pipboy == 0)
set haspipboy to 0
pipboymarker.enable
endif
end

begin onactivate
 if isactionref player
 if haspipboy == 1
		player.unequipitem pipboy
	player.unequipitem pipboyglove
		player.removeitem pipboy 1 
		player.removeitem pipboyglove 1
	elseif haspipboy == 0
	player.additem pipboy 1
	player.additem pipboyglove 1
	player.equipitem pipboy 1 0
	player.equipitem pipboyglove
	ResetPipBoyManager
	ShowMessage CGTutorialPipboy
endif
     endif
end

 

is there another way to equip the pipboy? or any idea why its crashing...

thanks

Link to comment
Share on other sites

Try it without the numbers after the equip function.

 

player.additem pipboy 1
player.additem pipboyglove 1
player.equipitem pipboy
player.equipitem pipboyglove
ResetPipBoyManager

Link to comment
Share on other sites

Try it without the numbers after the equip function.

 

player.additem pipboy 1
player.additem pipboyglove 1
player.equipitem pipboy
player.equipitem pipboyglove
ResetPipBoyManager

 

thanks, it still crashes.

funny, I now have a similar script (broken into 3 parts) on a terminal, it works 100% of the time, and doesn't crash....

it appears equipitem pipboy doesn't work properly when called from a object script, or how i'm calling it...

 

now i have a terminal with 3 options

add/remove pipboy glove

add/remove pipboy

add/remove pimpboy

 

everything works good (i even made a display bench where they sit when not equiped - xmarkers :))

I'll keep it on the terminal script for now, and if i figure out what went wrong i'll post it...

 

for the record, using

 player.additem pipboy 1
player.equipitem pipboy 

works if used as a script in a conversation as well (its parts of doc mitchels convo when u leave).

player.equipitem 1 force the item to be Unremovable until unequipitem is called, the pipboy is not a playable item by default.

 

I've read into the game scripts. as far as i can tell it only crashes when called from a object script (both in gamemode and onactivate blocks at least). but it works fine in a terminal script, or a topic script (conversation)... weird

Link to comment
Share on other sites

Yeah, with all the stuff going on in gamemode, trying do do it all in one frame might be the problem. I would still try doing it in a gamemode block (not activate), but instead of all at once, first add the item, equip it, but then wait a frame or two before doing the Reset Pipboy command. Or maybe wait a frame between each step if it's that picky. But it's been done before.
Link to comment
Share on other sites

  • 3 years later...

I had a need to do something similar, and since there wasn't a conclusive answer here I did some testing. For posterity, here are the results.

 

As far as I can determine, calling player.EquipItem PipBoy in GameMode always causes a CTD, even if there is a multi-frame delay between adding the item and equipping it. In fact, it happens even if the PipBoy is merely unequipped and a new one does not need to be added.

 

As reported in one of the other posts, I confirmed that it happens in both the OnActivate and GameMode blocks., and that calling it in the result script of a terminal or dialog topic works just fine.

 

So, unfortunately, what I was trying to do doesn't seem possible (a room where the entry door removes the PipBoy and the exit door replaces it).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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