Jump to content

I need some scripting help


Sarteka

Recommended Posts

I'm working on a small modding project, and I am in need of a piece of a script to remove a certain item from inventory every 10 seconds while a certain condition is met.

 

What time related script functions are in the engine? I have not seen any on the Bethesda websites. (I would most likely also need a "goto" command so it repeats)

 

If your curious about the mod you'll just have to wait until I release it :biggrin:

 

Any assistance would be nice

Link to comment
Share on other sites

GetSecondsPassed would probably be what you want to use for counting time. You'd set it up like...

 

if timer > 0

set timer to timer - GetSecondsPassed

elseif player.GetItemCount [your item] > 0 && [other condition] == 1

player.RemoveItem [your item] 1

set timer to 10

endif

 

You can work the other condition in a few different ways, so that's just a rough example. You should probably start with the other condition, then let the timer run.

Link to comment
Share on other sites

You can also create a quest, and connect it to the script that removes the item.

The quest would be "Start Game Enabled" (runs when a game loads), delay 10 sec, priority 60 or more (this priority is standard ).

 

You can put the condition either in the script or on the quest(*).

 

NOTE: If the script is connected to abilities or perks the timer way is probably better.

 

* I usually prefer the script

Link to comment
Share on other sites

It should be something like this:

 

ScriptName myItemScript

short timer

Begin OnEquip Player
set timer to 10 //reset timer on equip
End

Begin OnUnequip
//whatever
End

Begin GameMode
If Player.GetEquipped myItem == 1 //double check to run only when the item is equipped
	if timer > 0

		set timer to timer - GetSecondsPassed //decrease timer each time the script runs
		// should be around  2s

		//when the timer runs out do the following lines:
	elseif player.GetItemCount [item to remove] > 0 && [other condition] == 1

		player.RemoveItem [item to remove] 1
		set timer to 10 //reset timer

	EndIf
EndIf
End

 

note: This one might have minor compile errors, I wrote it in notepad.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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