Jump to content

Script help?


kellogsfrostedflakes

Recommended Posts

I have a rather limited understanding of scripts and was wondering if anyone would be willing to help. I've read through the beginner guides on the GECK pages, but I don't know where to go from there. I understand the concept but I don't know where to find the language to use.

 

I'd like to make an equip/unequip script that has a condition.

Also, what would I use instead of an "actor id" if I want the script to effect all actors?

 

If anyone would be willing to explain it to me or direct me to a website with more guides and information I'd be forever grateful.

 

==============================================

Here's the best I could come up with on my own. I know it's wrong since GECK wouldn't let me save it.

 

ScriptName Pajamas

 

Begin GameMode

 

if getsleeping == 1

additem.000cb60e

equipitem.000cb60e

elseif getsleeping == 4

removeitem.000cb60e

endif

 

end

 

===================================================================

 

I then tried to use a script from a different mod and info from the GECK page and got this mess:

 

ScriptName EquipScript

 

ref rContainer

Begin GameMode

 

setrContainer to GetContainer

if rContainer.IsActor

if rContainer.GetSleeping

rContainer.AddItem 000cb60e

rContainer.EquipItem 000cb60e

else

rContainer.RemoveItem 000cb60e

endif

endif

 

End

Edited by kellogsfrostedflakes
Link to comment
Share on other sites

ScriptName Pajamas

ref whodoneitref

Begin GameMode

set whodoneitref to GetSelf

if whodoneitref.getsleeping == 1
         whodoneitref.additem 000cb60e 1
        whodoneitref.equipitem 000cb60e 

elseif whodoneitref.getsleeping == 4
        whodoneitref.removeitem 000cb60e 1

endif

end

 

 

I could be completely wrong though. You need to use getself to set the players referance to use in getsleeping.

 

also Additem.garbalygook is not the right way to use additem. [Actorref].Additem [itemcode] [amount] [hidden flag 0 or 1]

 

 

Cipscis's script Validator is your friend.

Link to comment
Share on other sites

ScriptName Pajamas

ref whodoneitref

Begin GameMode

set whodoneitref to GetSelf

if whodoneitref.getsleeping == 1
         whodoneitref.additem 000cb60e 1
        whodoneitref.equipitem 000cb60e 

elseif whodoneitref.getsleeping == 4
        whodoneitref.removeitem 000cb60e 1

endif

end

 

 

I could be completely wrong though. You need to use getself to set the players referance to use in getsleeping.

 

also Additem.garbalygook is not the right way to use additem. [Actorref].Additem [itemcode] [amount] [hidden flag 0 or 1]

 

 

Cipscis's script Validator is your friend.

 

 

I see. Does that mean I would have to add it for ever npc, or is there a reference that effects everyone in the game globally?

 

Thank you for your help and for the site, it will be very helpful :)

Link to comment
Share on other sites

GetSelf should theoretically work for everyone. I'm just not sure how to get it working. With onGameMode the script should run for everyone every frame. Something else you could look into is adding the script to run when a bed object is activated, but I don't know if bed are able to have scripts attached.
Link to comment
Share on other sites

Just a couple notes:

1. GetSelf only works on actors that have been placed in the editor. It always returns zero for spawned actors, so GetContainer is the preferred alternate. But GetSelf is fine as long as you are aware of this and use it appropriately.

2. You can use the editor id for items. You don't have to use the number. It makes your script more readable and easier to troubleshoot.

3. Beds - they can have scripts, but I don't know if an NPC actually triggers the ON Activate block, where you could get their REF. You would have to experiment. To get this to work globally otherwise would be a huge project and probably not desirable. You would have to edit every NPC script. You could make a quest script that checked your favorite named NPCs for the sleeping state, though. They would have to have a RefID.

4. You probably want to add states 0 and 3 for GetSleeping in case the script misses it - especially if the script is a quest script.

5. The script as it is, will add the OutfitUniquePrewarNegligee every frame until the animation state changes, so you want to add some code to guard for that.

 

 

 

ScriptName Pajamas 

ref whodoneitref
short iwakeup

Begin GameMode 

set whodoneitref to GetSelf

if (iwakeup == 0)
   if whodoneitref.getsleeping == 1 || whodoneitref.getsleeping == 3
       whodoneitref.additem OutfitUniquePrewarNegligee 1 
       whodoneitref.equipitem OutfitUniquePrewarNegligee
       set iwakeup to 1
   endif
endif

if (iwakeup == 1)
   if whodoneitref.getsleeping == 4 || whodoneitref.getsleeping == 0
       whodoneitref.removeitem OutfitUniquePrewarNegligee 1
       set iwakeup to 0
   endif
endif 

end


Link to comment
Share on other sites

  • Recently Browsing   0 members

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