How can I give an ingredient late effects?

Post » Sun May 01, 2011 6:43 pm

Ah, well it's not there. I checked. There were a lot of NOM globals but no _ingredient_global_script. I did this after eating the cheese. So what do I do now?
User avatar
Jessica Thomson
 
Posts: 3337
Joined: Fri Jul 21, 2006 5:10 am

Post » Sun May 01, 2011 1:54 pm

Ok, so uncomment the skipequip stuff to make it all work again. You will need to remove the ingredients manually then.

Make a global variable, by going into the globals tab and selecting new. It will be a short global set to 0 by default, which is what you want, so just give it a unique name and hit save.

Now make a different local script for each ingredient. You only need one global script though.

In your local scripts do this:

Begin _Ingredient_ScriptShort OnPCEquipShort PCSkipEquipSet PCSkipEquip to 1 ;makes sure you don't actually eat the ingredient, because otherwise the script will stopIf ( OnPCEquip == 1 ) ;when you try to equip (eat) it, do this	Set OnPCEquip to 0	Set PCSkipEquip to 0 ;this is not necessary, so just delete it        Set youglobalvariable to 1	StartScript "_Ingredient_Script"EndifEnd


In each script, set yourglobalvariable to a different number. Then check for it in your global script like this:

Begin _Ingredient_Global_ScriptShort doOnceif ( doOnce == 0 )	Playsound "swallow"        If ( yourglobalvariable == 1 )        	player->removeitem "NOM_food_cheese" 1        Elseif ( yourglobalvariable == 2 )                player->removeitem "your next ingredient" 1        Elseif ;keep doing as above for each ingredient        Endif	set doOnce to 1endif;do all your other timing stuff;once it's all doneStopScript _Ingredient_Global_ScriptEnd


Make sure to write down which number is used for each ingredient.
User avatar
Johnny
 
Posts: 3390
Joined: Fri Jul 06, 2007 11:32 am

Post » Sun May 01, 2011 3:49 pm

Okay, the short zero global variable I made is "Lactose_Global_Variable" and I did this for the global script:



    Begin _Ingredient_Global_ScriptShort doOnceif ( doOnce == 0 )	Playsound "swallow"        If ( Lactose_Global_Variable == 1 )        	player->removeitem "NOM_food_cheese" 1        Elseif ( Lactose_Global_Variable == 2 )        	player->removeitem "NOM_food_cheese2" 1        Elseif ( Lactose_Global_Variable == 3 )        	player->removeitem "NOM_food_cheese3" 1        Elseif ( Lactose_Global_Variable == 4 )        	player->removeitem "NOM_food_cheese_pie" 1        Elseif ( Lactose_Global_Variable == 5 )        	player->removeitem "NOM_food_egg2" 1        Elseif ( Lactose_Global_Variable == 6 )        	player->removeitem "NOM_food_egg_boil" 1        Elseif ( Lactose_Global_Variable == 7 )        	player->removeitem "NOM_food_omelette" 1        Elseif ( Lactose_Global_Variable == 8 )        	player->removeitem "NOM_food_omelette_crab" 1        Elseif ( Lactose_Global_Variable == 9 )        	player->removeitem "1_milk_cow" 1        Elseif ( Lactose_Global_Variable == 10 )        	player->removeitem "1_milk_goat" 1        Elseif ( Lactose_Global_Variable == 11 )        	player->removeitem "food_kwama_egg_01" 1        Elseif ( Lactose_Global_Variable == 12 )        	player->removeitem "food_kwama_egg_02" 1        Endif	set doOnce to 1endif;do all your other timing stuff;once it's all doneStopScript _Ingredient_Global_ScriptEnd










And I made twelve different local scripts since there are eight NOM items, two milk items and two stock items.


    Begin 1_Ingredient_ScriptShort OnPCEquipShort PCSkipEquipSet PCSkipEquip to 1 ;makes sure you don't actually eat the ingredient, because otherwise the script will stopIf ( OnPCEquip == 1 ) ;when you try to equip (eat) it, do this	Set OnPCEquip to 0	Set "Lactose_Global_Variable" to 1	StartScript "1_Ingredient_Script"EndifEnd


....all the way up to....


    Begin 12_Ingredient_ScriptShort OnPCEquipShort PCSkipEquipSet PCSkipEquip to 1 ;makes sure you don't actually eat the ingredient, because otherwise the script will stopIf ( OnPCEquip == 1 ) ;when you try to equip (eat) it, do this	Set OnPCEquip to 0	Set "Lactose_Global_Variable" to 12	StartScript "12_Ingredient_Script"EndifEnd







I went back into the game and ate the cheese and typed sv in the console and I still didn't see the global script running.
But any ways, is this what you were telling me to do? What's the next step? Or does it still need corrections?
User avatar
clelia vega
 
Posts: 3433
Joined: Wed Mar 21, 2007 6:04 pm

Post » Sun May 01, 2011 11:57 pm

If you've uncommented the stopscript, you won't catch it running by using sv as it's stopped already (as there's no timer or other stuff in it yet). What you want to check for now is how many items you have in your inventory before and after eating the ingredient. You want to make sure only the one youv'e "eaten" is being removed. While you're making sure of that, I'll think of a way to add a delayed timer for the next bit. You want the ingredient's effect to kick in after an hour correct? How long do you want the effect to last? Do you want the effect to get stronger if more foods with lactose is eaten?
User avatar
Daramis McGee
 
Posts: 3378
Joined: Mon Sep 03, 2007 10:47 am

Post » Sun May 01, 2011 12:47 pm

Okay, I put a barrel outside the Census Office that had qty 10 of all twelve items. I ate one of each and waited a little bit and there were still 9 left. Then I ate two more of each and waited an hour and there were 7 left. So it's running normally as it should.

Yes, I want to consume the item and have the effects happen after one game hour.
I'm guessing the effects would last indefinitely as real life bowel problems and bloating don't go away until you relieve them. I'm not lactose intolerant myself but I work in the medical field and know that it gets more and more painful as time goes on.
Let's just make it last for 3 hours and assume that the player managed to sneak off somewhere and relieve themselves for role-playing purposes. 3 hours because it generally takes that long for the lactose to fully leave your body, though it varies from person to person.
For the damaging of health, let's have it damage the player's health by 2% every 10 minutes, accumulating to a total of 20% health loss by 1.5 hours. After that, it'll go backwards by 2% until it reaches 100% health.

So.... this is the percentage of PC's current health. So if PC has half of their health and eats an egg or drinks milk, it'll be these percentages of that.
0:00 - Eat item -> nothing happens for 1 hour. PC has 100% health.
1:00 - PC now has 98% health
1:10 - PC then has 96% health
1:20 - 94% health
1:30 - 92%
1:40 - 90%
1:50 - 88%
2:00 - 86%
2:10 - 84%
2:20 - 82%
2:30 - 80%
2:40 - 82%
2:50 - 84%
3:00 - 86%
3:10 - 88%
3:20 - 90%
3:30 - 92%
3:40 - 94%
3:50 - 96%
4:00 - 98%
4:10 - 100%


Okay, so 3 hours and 10 minutes. So the whole script actually lasts 4 hours and 10 minutes since there's the initial 1 hour delay.
And I guess this whole process would happen again if you ate another dairy product half way through?

Will these effects double up if I eat two items at the same time? I don't want this to kill the PC if they eat five dairy items because that would kill them after 1.5 hours.
Are these values too much? I mean, is 20% too harsh? Should it be 1% every 10 minutes so that it's 10% total half way through?

Would a heal spell or potion void all this during the process?
For lore purposes, Heal repairs wounds and whatnot. But being lactose intolerant just means you don't have the lactase enzyme, so eating lactose products, you don't have the ability to break down the lactose molecules. Healing wouldn't fix this as there is nothing wrong with you. You just don't have a certain enzyme. So I'm wondering if we could make it to where Heal spells/potions wouldn't heal you. Would that piss a lot of people off who downloaded this mod?
User avatar
Esther Fernandez
 
Posts: 3415
Joined: Wed Sep 27, 2006 11:52 am

Post » Sun May 01, 2011 3:07 pm

I don't think I'd damage the player's health. There's too much risk and balancing involved. What about draining fatigue? I'm actually lactose intolerant myself, and that's probably more realistic an effect. Health damage represents bleeding out in the game (or massive burns from spells). I think gradually dropping the player's fatigue would almost be equally detrimental in a fight, and you wouldn't have the energy to run and jump around either, but it wouldn't kill you (unless you happen to run into a wayward Kagouti while you're huffing and puffing along). You could even go a little faster with the fatigue drop, making it necessary for the player to chug fatigue potions if they don't want to spend the next few hours lying on the ground with severe gut pain and unable to move. ;)
User avatar
x_JeNnY_x
 
Posts: 3493
Joined: Wed Jul 05, 2006 3:52 pm

Post » Sun May 01, 2011 10:07 pm

The GetHealthRatio is causing a problem and won't let me save.

It's correct name is GetHealthGetRatio

edit: oops, I think that was already answered.
User avatar
Johanna Van Drunick
 
Posts: 3437
Joined: Tue Jun 20, 2006 11:40 am

Post » Sun May 01, 2011 4:35 pm

You're right, Fatigue damage would be more balancing. Health damage in CRPGs is cuts, bruises, lacerations, physical stuff like that. Fatigue represents getting tired but could also represent discomfort and pain. I mean, we'd have to wait until 2100 A.D. before we get a game that has actual physiology. God, even making a single mitochondrion would be an insane task by itself, and that's just the energy factory of the cell.

But all that garbage aside, yes, let's do fatigue instead. The way you explained it makes it sound much better than losing health any ways. Oh! I almost forgot, I want LUCK & ENDURANCE to drop as well.


Here are the percentages for the Fatigue Drop:

    0:00 - Eat item -> nothing happens for 1 hour. PC has 100% of current fatigue
    1:00 - PC now has 95% of current fatigue
    1:10 - PC then has 90% of current fatigue
    1:20 - 85% fatigue
    1:30 - 80%
    1:40 - 75%
    1:50 - 70%
    2:00 - 65%
    2:10 - 60%
    2:20 - 55%
    2:30 - 50%
    2:40 - 45%
    2:50 - 40%
    3:00 - 35%
    3:10 - 30%
    3:20 - 25%
    3:30 - 20%
    3:40 - 15%
    3:50 - 10%
    4:00 - 5%
    4:10 - 0%




Luck/Endurance Drop:
    0:00 - Eat item -> nothing happens for 1 hour. PC has 100% of current LUCK/END
    1:00 - PC now has 98% of current LUCK/END
    1:10 - PC then has 96% of current LUCK/END
    1:20 - 94% LUCK/END
    1:30 - 92%
    1:40 - 90%
    1:50 - 88%
    2:00 - 86%
    2:10 - 84%
    2:20 - 82%
    2:30 - 80%
    2:40 - 78%
    2:50 - 76%
    3:00 - 74%
    3:10 - 72%
    3:20 - 70%
    3:30 - 68%
    3:40 - 66%
    3:50 - 64%
    4:00 - 62%
    4:10 - 60%




You know how the game makes you collapse to the floor at zero fatigue. This could simulate your stomach hurting terribly and you can't even move because the pain is so unbearable. If the player wanted to stop this, he or she could use a Stamina spell/potion to raise their fatigue, but these effects would still be going. This works for lore because Heal spell heals wounds; stamina spell restores fatigue. But as far as magic goes, you'd need a specially made type of spell that would mimic the lactase enzyme. But I'm assuming most Tamrielians don't know much about human merish physiology to be able to design such a spell. But that's more for story telling and lore purposes.

But should the percentage dropping be like that? How I have your fatigue dropping all the way to zero after 3 hours? Or is it too much? I guess that after the scripting is over, your fatigue will slowly rebuild itself back up, simulating that you've relieved yourself and had a bowel movement and you're slowly recuperating i.e. fatigue is restoring. Does that method seem like it would work as far as role playing purposes?

I also want to have a message box at the start of the effects that says something like: "You feel an uncomfortable pain and gurgle in your stomach. You feel bloated and gassy." And maybe give a message box at each hour mark to describe the pain and discomfort. And at the very end, it could say that all the lactase has passed through you and you're beginning to feel better again, which would explain why it suddenly ended after 4 hours. Well, 1 hr of digestion and 3 hrs of stomach cramps.
User avatar
Susan Elizabeth
 
Posts: 3420
Joined: Sat Oct 21, 2006 4:35 pm

Post » Sun May 01, 2011 11:00 pm

Instead of a messagbox, how about a "dummy" spell. You could make a spell set as an ability that has drain luck 0, drain endurance 0 and drain fatigue 0, and call it lactose intolerance. That's just an idea though.

As for the percentage dropping, it seems way too complicated, and a bit to rigid for the roleplaying aspect. I've thought about it a bit, and I think perhaps the best way to go about it would be to use a combination of a timers.

The first timer would count down the hours, the second timer would reset every few seconds, that way you can drop the player's fatigue and attributes at a specific rate. I would probably uncomplicate the script by making it a block of an hour before changing the rate of the drop. So, for example:

Hour 0: nothing
Hour 1: fatigue drops by 1 point every twenty seconds
Hour 2: fatigue drops by 1 point every ten seconds
Hour 3: fatigue drops by 1 point every five seconds
Hour 4: fatigue drops by 1 point every second, and then stops after 10 minutes

It would actually have to be tested in game to see how harsh the effect is for each hour. For luck and endurance, just increase the timing so the drop is not as significant, and then you have to reset it manually back to full at the end.

I have to go to work soon, but I'll think about how to write this and maybe have something by this evening.
User avatar
Andrew
 
Posts: 3521
Joined: Tue May 08, 2007 1:44 am

Post » Mon May 02, 2011 12:10 am

I wonder if that would make the fatigue go into the negative if it kept dropping. I'll wait to see what you come up with. Thanks.
User avatar
Spencey!
 
Posts: 3221
Joined: Thu Aug 17, 2006 12:18 am

Post » Mon May 02, 2011 3:54 am

I have no idea if this will work, but give it a try.

Begin _Ingredient_Global_ScriptShort doOnceShort stateShort BaseLuckShort BaseEnduranceFloat StartTimeFloat timerif ( doOnce == 0 )	Playsound "swallow"        If ( Lactose_Global_Variable == 1 )        	player->removeitem "NOM_food_cheese" 1        Elseif ( Lactose_Global_Variable == 2 )        	player->removeitem "NOM_food_cheese2" 1        Elseif ( Lactose_Global_Variable == 3 )        	player->removeitem "NOM_food_cheese3" 1        Elseif ( Lactose_Global_Variable == 4 )        	player->removeitem "NOM_food_cheese_pie" 1        Elseif ( Lactose_Global_Variable == 5 )        	player->removeitem "NOM_food_egg2" 1        Elseif ( Lactose_Global_Variable == 6 )        	player->removeitem "NOM_food_egg_boil" 1        Elseif ( Lactose_Global_Variable == 7 )        	player->removeitem "NOM_food_omelette" 1        Elseif ( Lactose_Global_Variable == 8 )        	player->removeitem "NOM_food_omelette_crab" 1        Elseif ( Lactose_Global_Variable == 9 )        	player->removeitem "1_milk_cow" 1        Elseif ( Lactose_Global_Variable == 10 )        	player->removeitem "1_milk_goat" 1        Elseif ( Lactose_Global_Variable == 11 )        	player->removeitem "food_kwama_egg_01" 1        Elseif ( Lactose_Global_Variable == 12 )        	player->removeitem "food_kwama_egg_02" 1        Endif	If ( GameHour >= 23 )		Set StartTime to ( GameHour - 23 )	Else		Set StartTime to ( GameHour + 1 ) ;this is the time you want to start the effects	Endif	Set BaseLuck to Player->GetLuck ;record the player's stats before effect and save them for later	Set BaseEndurance to Player->GetEndurance	set doOnce to 1endifIf ( GameHour >= StartTime )	If ( state == 0 )		MessageBox "Your first message"		Set state to 1	Elseif ( state == 1 )		Set state to 2	Elseif ( state == 2 )		Set state to 3	Elseif ( state == 4 )		If ( GameHour >= 23 )			Set StartTime to ( GameHour - 23.8 )		Else			Set StartTime to ( GameHour + 0.2 ) ;reset to about ten minutes		Endif		Set state to 5		Return	Endif	If ( GameHour >= 23 )		Set StartTime to ( GameHour - 23 )	Else		Set StartTime to ( GameHour + 1 ) ;reset to the next hour	EndifEndifIf ( state == 1 ) ;after first hour	Player->SetLuck ( BaseLuck - 5 ) ;this will make sure the attribute is constantly set below normal by a certain amount	Player->SetEndurance ( BaseEndurance - 5 )	Set timer to ( timer + GetSecondsPassed )	If ( timer > 20 )		If ( Player->GetFatigue > 0 )			Player->ModCurrentFatigue -1		Endif		Set timer to 0		Return	EndifElseif ( state == 2 ) ;after second hour	Player->SetLuck ( BaseLuck - 10 )	Player->SetEndurance ( BaseEndurance - 10 )	Set timer to ( timer + GetSecondsPassed )	If ( timer > 10 )		If ( Player->GetFatigue > 0 )			Player->ModCurrentFatigue -1		Endif		Set timer to 0		Return	EndifElseif ( state == 3 ) ;after third hour	Player->SetLuck ( BaseLuck - 15 )	Player->SetEndurance ( BaseEndurance - 15 )	Set timer to ( timer + GetSecondsPassed )	If ( timer > 5 )		If ( Player->GetFatigue > 0 )			Player->ModCurrentFatigue -1		Endif		Set timer to 0		Return	EndifElseif ( state == 4 ) ;after fourth hour	SetLuck ( BaseLuck - 20 )	SetEndurance ( BaseEndurance - 20 )	Set timer to ( timer + GetSecondsPassed )	If ( timer > 1 )		If ( Player->GetFatigue > 0 )			Player->ModCurrentFatigue -1		Endif		Set timer to 0		Return	EndifElseif ( state == 5 )	MessageBox "Your last message"	Player->SetLuck BaseLuck	Player->SetEndurance BaseEndurance	Set state to -1	ReturnElseif ( state == -1 )        Set state to 0        StopScript _Ingredient_Global_ScriptEndifEnd

User avatar
Ross Thomas
 
Posts: 3371
Joined: Sat Jul 21, 2007 12:06 am

Post » Sun May 01, 2011 5:02 pm

I get the following error:

http://img203.imageshack.us/img203/9405/12914161.jpg

And when I delete that line I get the same thing for line 43. And when I delete that line from the script I get another error for line 71 that says to enter a value for line 71.



If I'm counting correctly, line 42 and 43 are:
    Set BaseLuck to Player->GetLuck   ; record the player's stats before effect and save them for later	Set BaseEndurance to Player->GetEndurance


and line 71 is:
    If ( state == 1 ) ;after first hour

User avatar
Trish
 
Posts: 3332
Joined: Fri Feb 23, 2007 9:00 am

Post » Sun May 01, 2011 4:01 pm

I forgot that stats need to be set in a different way than variables. Add these short variables:

Short CurrentLuck
Short CurrentEnduance

And change the scripts to this:

Set CurrentLuck to ( BaseLuck - 5 )
Player->SetLuck CurrentLuck

and so on...
User avatar
NAtIVe GOddess
 
Posts: 3348
Joined: Tue Aug 15, 2006 6:46 am

Post » Mon May 02, 2011 12:21 am

Still getting an error:

http://img693.imageshack.us/img693/3221/90993333.jpg

Here's what I did. I may have wrote it incorrectly than what you were directing me to do. It can't find CurrentEndurance on line 46.



    Begin _Ingredient_Global_ScriptShort doOnceShort stateShort BaseLuckShort BaseEnduranceShort CurrentLuckShort CurrentEnduanceFloat StartTimeFloat timerif ( doOnce == 0 )	Playsound "swallow"        If ( Lactose_Global_Variable == 1 )        	player->removeitem "NOM_food_cheese" 1        Elseif ( Lactose_Global_Variable == 2 )        	player->removeitem "NOM_food_cheese2" 1        Elseif ( Lactose_Global_Variable == 3 )        	player->removeitem "NOM_food_cheese3" 1        Elseif ( Lactose_Global_Variable == 4 )        	player->removeitem "NOM_food_cheese_pie" 1        Elseif ( Lactose_Global_Variable == 5 )        	player->removeitem "NOM_food_egg2" 1        Elseif ( Lactose_Global_Variable == 6 )        	player->removeitem "NOM_food_egg_boil" 1        Elseif ( Lactose_Global_Variable == 7 )        	player->removeitem "NOM_food_omelette" 1        Elseif ( Lactose_Global_Variable == 8 )        	player->removeitem "NOM_food_omelette_crab" 1        Elseif ( Lactose_Global_Variable == 9 )        	player->removeitem "1_milk_cow" 1        Elseif ( Lactose_Global_Variable == 10 )        	player->removeitem "1_milk_goat" 1        Elseif ( Lactose_Global_Variable == 11 )        	player->removeitem "food_kwama_egg_01" 1        Elseif ( Lactose_Global_Variable == 12 )        	player->removeitem "food_kwama_egg_02" 1        Endif	If ( GameHour >= 23 )		Set StartTime to ( GameHour - 23 )	Else		Set StartTime to ( GameHour + 1 ) ;this is the time you want to start the effects	Endif	Set CurrentLuck to ( BaseLuck - 5 )		Player->SetLuck CurrentLuck	Set CurrentEndurance to ( BaseEndurance - 5 )		Player->SetEndurance CurrentEndurance	set DoOnce to 1endifIf ( GameHour >= StartTime )	If ( state == 0 )		MessageBox "This is a test to see if this works."		Set state to 1	Elseif ( state == 1 )		Set state to 2	Elseif ( state == 2 )		Set state to 3	Elseif ( state == 4 )		If ( GameHour >= 23 )			Set StartTime to ( GameHour - 23.8 )		Else			Set StartTime to ( GameHour + 0.2 ) ;reset to about ten minutes		Endif		Set state to 5		Return	Endif	If ( GameHour >= 23 )		Set StartTime to ( GameHour - 23 )	Else		Set StartTime to ( GameHour + 1 ) ;reset to the next hour	EndifEndifIf ( state == 1 ) ;after first hour	Set CurrentLuck to ( BaseLuck - 5 )		Player->SetLuck CurrentLuck	Set CurrentEndurance to ( BaseEndurance - 5 )		Player->SetEndurance CurrentEndurance	Set timer to ( timer + GetSecondsPassed )	If ( timer > 20 )		If ( Player->GetFatigue > 0 )			Player->ModCurrentFatigue -1		Endif		Set timer to 0		Return	EndifElseif ( state == 2 ) ;after second hour	Set CurrentLuck to ( BaseLuck - 10 )		Player->SetLuck CurrentLuck	Set CurrentEndurance to ( BaseEndurance - 10 )		Player->SetEndurance CurrentEndurance	Set timer to ( timer + GetSecondsPassed )	If ( timer > 10 )		If ( Player->GetFatigue > 0 )			Player->ModCurrentFatigue -1		Endif		Set timer to 0		Return	EndifElseif ( state == 3 ) ;after third hour	Set CurrentLuck to ( BaseLuck - 15 )	Player->SetLuck CurrentLuck	Set CurrentEndurance to ( BaseEndurance - 15 )	Player->SetEndurance CurrentEndurance	Set timer to ( timer + GetSecondsPassed )	If ( timer > 5 )		If ( Player->GetFatigue > 0 )			Player->ModCurrentFatigue -1		Endif		Set timer to 0		Return	EndifElseif ( state == 4 ) ;after fourth hour	Set CurrentLuck to ( BaseLuck - 20 )	Player->SetLuck CurrentLuck	Set CurrentEndurance to ( BaseEndurance - 20 )	Player->SetEndurance CurrentEndurance	Set timer to ( timer + GetSecondsPassed )	If ( timer > 1 )		If ( Player->GetFatigue > 0 )			Player->ModCurrentFatigue -1		Endif		Set timer to 0		Return	EndifElseif ( state == 5 )	MessageBox "Your last message"	Player->SetLuck CurrentLuck	Player->SetEndurance CurrentEndurance	Set state to -1	ReturnElseif ( state == -1 )        Set state to 0        StopScript _Ingredient_Global_ScriptEndifEnd

User avatar
Kelly John
 
Posts: 3413
Joined: Tue Jun 13, 2006 6:40 am

Post » Sun May 01, 2011 4:30 pm

You just spelled it incorrectly: "CurrentEnduance"

You're missing an r. :P
User avatar
Nathan Maughan
 
Posts: 3405
Joined: Sun Jun 10, 2007 11:24 pm

Post » Mon May 02, 2011 1:17 am

Ah, okay. I fixed it.
Well I saved the script and even had it load last in the list on Wrye Mash after NOM and when I ate several of the items in the list and walked around for over an hour in the game, nothing happened. What do you think it could be?
User avatar
Juanita Hernandez
 
Posts: 3269
Joined: Sat Jan 06, 2007 10:36 am

Post » Mon May 02, 2011 1:11 am

I'm not sure. I have a bit of trouble with timing scripts myself. Perhaps someone else might have an idea.

Also, I forgot that if you set a drain attribute spell as an ability, it only removes as many points as is set by the magnitude. It doesn't continue to drain your attributes until it reaches 0. You could probably remove all the SetLuck stuff and the variables and just add an attribute spell to the player to drain the stats. That would uncomplicate things a bit. Try this out:

Begin _Ingredient_Global_ScriptShort doOnceShort stateFloat StartTimeFloat timerif ( doOnce == 0 )	Playsound "swallow"        If ( Lactose_Global_Variable == 1 )        	player->removeitem "NOM_food_cheese" 1        Elseif ( Lactose_Global_Variable == 2 )        	player->removeitem "NOM_food_cheese2" 1        Elseif ( Lactose_Global_Variable == 3 )        	player->removeitem "NOM_food_cheese3" 1        Elseif ( Lactose_Global_Variable == 4 )        	player->removeitem "NOM_food_cheese_pie" 1        Elseif ( Lactose_Global_Variable == 5 )        	player->removeitem "NOM_food_egg2" 1        Elseif ( Lactose_Global_Variable == 6 )        	player->removeitem "NOM_food_egg_boil" 1        Elseif ( Lactose_Global_Variable == 7 )        	player->removeitem "NOM_food_omelette" 1        Elseif ( Lactose_Global_Variable == 8 )        	player->removeitem "NOM_food_omelette_crab" 1        Elseif ( Lactose_Global_Variable == 9 )        	player->removeitem "1_milk_cow" 1        Elseif ( Lactose_Global_Variable == 10 )        	player->removeitem "1_milk_goat" 1        Elseif ( Lactose_Global_Variable == 11 )        	player->removeitem "food_kwama_egg_01" 1        Elseif ( Lactose_Global_Variable == 12 )        	player->removeitem "food_kwama_egg_02" 1        Endif	If ( GameHour >= 23 )		Set StartTime to ( GameHour - 23 )	Else		Set StartTime to ( GameHour + 1 ) ;this is the time you want to start the effects	Endif	set DoOnce to 1endifIf ( GameHour >= StartTime )	If ( state == 0 )		MessageBox "This is a test to see if this works."		Set state to 1	Elseif ( state == 1 )		Set state to 2	Elseif ( state == 2 )		Set state to 3	Elseif ( state == 4 )		If ( GameHour >= 23 )			Set StartTime to ( GameHour - 23.8 )		Else			Set StartTime to ( GameHour + 0.2 ) ;reset to about ten minutes		Endif		Set state to 5		Return	Endif	If ( GameHour >= 23 )		Set StartTime to ( GameHour - 23 )	Else		Set StartTime to ( GameHour + 1 ) ;reset to the next hour	EndifEndifIf ( state == 1 ) ;after first hour        If ( Player->GetSpell "first drain spell" == 0 )	        Player->AddSpell "first drain spell" ;make this an ability and set drain endurance and drain luck in the same spell with whatever magnitude you like        Endif	Set timer to ( timer + GetSecondsPassed )	If ( timer > 20 )		If ( Player->GetFatigue > 0 )			Player->ModCurrentFatigue -1		Endif		Set timer to 0		Return	EndifElseif ( state == 2 ) ;after second hour        If ( Player->GetSpell "first drain spell" == 1 )	        Player->RemoveSpell "first drain spell"        Endif        If ( Player->GetSpell "second drain spell" == 0 )	        Player->AddSpell "second drain spell"        Endif	Set timer to ( timer + GetSecondsPassed )	If ( timer > 10 )		If ( Player->GetFatigue > 0 )			Player->ModCurrentFatigue -1		Endif		Set timer to 0		Return	EndifElseif ( state == 3 ) ;after third hour        If ( Player->GetSpell "second drain spell" == 1 )	        Player->RemoveSpell "second drain spell"        Endif        If ( Player->GetSpell "third drain spell" == 0 )	        Player->AddSpell "third drain spell"        Endif	Set timer to ( timer + GetSecondsPassed )	If ( timer > 5 )		If ( Player->GetFatigue > 0 )			Player->ModCurrentFatigue -1		Endif		Set timer to 0		Return	EndifElseif ( state == 4 ) ;after fourth hour        If ( Player->GetSpell "third drain spell" == 1 )	        Player->RemoveSpell "third drain spell"        Endif        If ( Player->GetSpell "fourth drain spell" == 0 )	        Player->AddSpell "fourth drain spell"        Endif	Set timer to ( timer + GetSecondsPassed )	If ( timer > 1 )		If ( Player->GetFatigue > 0 )			Player->ModCurrentFatigue -1		Endif		Set timer to 0		Return	EndifElseif ( state == 5 )	MessageBox "Your last message"        If ( Player->GetSpell "fourth drain spell" == 1 )	        Player->RemoveSpell "fourth drain spell"        Endif	Set state to -1	ReturnElseif ( state == -1 )        Set state to 0        StopScript _Ingredient_Global_ScriptEndifEnd

User avatar
Mario Alcantar
 
Posts: 3416
Joined: Sat Aug 18, 2007 8:26 am

Post » Sun May 01, 2011 3:41 pm

No, that didn't do anything either. I ate one of the cheeses and walked around for over an hour and none of the spells came up. I made four different ability spells but they all drained endurance and luck by about 5 points.

http://img687.imageshack.us/img687/1452/63442647.jpg

I really appreciate you helping me with this. I didn't think it would become this complicated.
Do you have any other ideas of how it could work?
User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Previous

Return to III - Morrowind