Scritping a hallucinogenic drug

Post » Sat Dec 05, 2009 1:29 pm

I'm wanting to make a plant, probably a mushroom, that when you eat it, causes you to trip out, kinda like peyote or LSD. I'd want it to be where when you consume the object, it takes an hour game time for the effects to happen. I'd most likely just have the player collapse, have the screen go black, and then you'd wake up in some different place. But the trick is really whether I can time things with scripts. Like, after 2 in game hours, could you set up the script so that something else changes or you are transported somewhere different?
User avatar
NeverStopThe
 
Posts: 3405
Joined: Tue Mar 27, 2007 11:25 pm

Post » Sat Dec 05, 2009 9:03 am

utilise MGE for maximum awesomeness
User avatar
Bellismydesi
 
Posts: 3360
Joined: Sun Jun 18, 2006 7:25 am

Post » Sat Dec 05, 2009 8:46 am

Any effect which can be scripted can be timed. There are global variables GameHour, Day, Month and Year which always have the current date and time. So if the effect is to take place an hour from when the player eats the mushroom, the script attached to the mushroom might contain something like this:

If (State == 0)   If (OnPCEquip == 1)	  Set OnPCEquip to 0	  Set StartTime to GameHour	  Set State to 1	  Return   EndIfElse if (State ==1)   If (GameHour != StartTime);An hour or more has passed since mushroom was eaten	  Set State to 0	  [Put scripted effects here]	  StopScript "name of mushroom script"	  Return   EndIfEndIf


If you want to test for 2 or more game hours passing, it gets a little more complicated, because if the mushroom is eaten at hour 23, the effect would take place at, say, hour 1 of the next day, so you'd have to set up your Ifs to cover that case.
User avatar
ZzZz
 
Posts: 3396
Joined: Sat Jul 08, 2006 9:56 pm


Return to III - Morrowind