Jump to content

[request] Harvest event handler


Guest deleted2027229

Recommended Posts

Guest deleted2027229

Use event handlers (for harvest) which only run if needed. Nirnroot would not need a script but could trigger through the onactivate event handler and then disable through that.

 

How do I do this?

Link to comment
Share on other sites

Yes, it's quite easy to set up such event. First event function itself:

scn RomRFnNirnrootActivateEvent
ref object
ref actor
ref base

begin function {object, actor}
	if actor == PlayerRef ;if player...
		let base := object.GetBaseObject
		if base == NirnrootPlant || base == NirnrootPlantSmall ;...takes Nirnroot 
			;print "Player takes Nirnroot."
			object.activate
			object.disable
		endif
	endif
end

It's made to disable Nirnoot only when player takes it, so if another NPC accidentaly harvest it too, he gets Nirnroot, but you can harvest it too after a while. Script on NirnrootPlant and NirnrootPlantSmall base objects needs to be removed of course.

 

Script for registering such event:

scn RomRNirnrootEventQuestScript
float fQuestDelayTime

begin GameMode
	set fQuestDelayTime to 0.5
	if GetGameRestarted
		SetEventHandler "OnActivate" RomRFnNirnrootActivateEvent "second"::PlayerRef
		;Message "Nirnroot event registered."
	endif
end

As you see, such event need to be registered every time Oblivion restarts. Also docs are quite silent about what happens if same type of event is registered by multiple mods. Still, I tested it and it works, so for one mod only you don't need to worry about it.

Link to comment
Share on other sites

  • 4 weeks later...

How can I apply this script to all flora so they all dissapear (like nirnroot does) when picked?

Take the first event function script, give it a new name starting with a letter because the editor ID's that don't start by a letter are a source of instability. Give it a name contaning a mix of your nickname, the acronym of your mod and a preferably long description of the object to avoid the conflicts because are another source of instability and prevent you from enjoying the features of all the mods. Replace the NirnrootPlantX entry by the editor ID of the flora you want to disable and you should be fine.

Link to comment
Share on other sites

How can I apply this script to all flora so they all dissapear (like nirnroot does) when picked?

 

With OBSE it can be done, but it will be a lot harder, because not all flora has a 100% chance to give you an ingredient as Nirnroot plants does. Also you must think of a way of enabling flora (except Nirnroots) again after some time, so extra tracking (which will propably take a lot of memory and cause a OBSE co-save bloat) and timing work is needed.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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