Maybe someone can tell me...script... - by 37637598
37637598 on 22/8/2004 at 00:43
Begin MkbWater01
Short State
if ( OnPcEquip == 1 ) ; if you take a drink
if ( Player->GetItemCount, "Mkb_Water001" > 0 ) ;and you have a full flask of water in your inventory
if ( State == 0 )
Player->RemoveItem "Mkb_Water001" 1
Set Thirsty to 0
Player->AddItem "Mkb_Water002" 1 ; give you a half flask of water
Set TakeAPiss to ( TakeAPiss + 1 ) ; make you have to take a piss'
MessageBox, "As the water touches your tongue you feel relaxed, take a big drink, and feel refreshed."
Set State to 10
endif
elseif ( Player->GetItemCount, "Mkb_Water001" < 1 ) ; if you DON'T have any water...
Activate ; give you some!
endif
endif
end
*******************************************************
Im trying to find the appropriate script command for drinking a potion. would it be "If ( OnPCEquip == 1 )??? I can't figure out why in the game it has an error, "Right eval" !!!
cyrano on 22/8/2004 at 03:46
"Right eval" suggests that a variable hasn't been declared. In your script, you reference the variable "TakeAPiss" [edit: and I forgot to mention the variable "Thirsty]. Unless this is a global variable, you need to declare it (usually among the first lines of your code), something like: short TakeAPiss.
I'm not certain that OnPCEquip works on items other than clothing, weapons and armor (maybe readied spells?). Even then, it only returns a Boolean check (true or false) as to whether the player has the item equipped, it won’t force the use of the item. The line with "Activate"; what is it that you are trying to activate with this script? Is it attached to a water source, a flask of water, or is it global? "Activate" is used on activators, doors and containers, NPCs, items with attached scripts, basically anything that you press the spacebar to use. I don't believe it can be used to consume a potion.
UsedOnMe sounds promising…nevermind, it only returns Boolean if you have used something like a potion.
Try “Equip”, as in: player->Equip, “potion_ID” . I’ve heard that it is flawed and doesn’t function as you would expect (modders griping about not being able to force equip clothing, armor or weapons). But perhaps those problems have been with NPCs not the player character, or maybe it will work with potions.
A workaround, if everything else fails, may be to manage everything through a global script (that need only trigger periodically to reduce the FPS hit). You water flask is just an object with no effects attached to it. But if it is in your inventory, the global script can prompt you with a
MessageBox, “Drink some water?”, “Yes, please!”, “No, not right now, thank you”.
As a consequence to choosing “Yes”, one unit of water is removed from your inventory, and
player->ModFatique, 100
will refresh you (complete with your original message), and you can even add another unit of urine to be expelled in time,
set TakeAPiss to ( TakeAPiss + 1 ).
How you intend to replenish units of water in your inventory you may have already worked out. Acquired from publicans or place a script on a well, that when activated, displays a message box with choices to add units of water to your inventory. There are wells in several towns that I can recall (Pelagiad and Ebonheart come immediately to mind), but if there are not enough to meet your mod's needs, plant a few more. Good luck with your project.
37637598 on 22/8/2004 at 21:18
Thanks, the script is attached to a water flask. Thirsty, and TakeAPiss are both globals. shit, gotta go.
37637598 on 23/8/2004 at 02:05
Ok, here's the whole picture.
TakeAPiss is a global, so is thirsty.
********************************************************
this script is for the water well.
********************************************************
Begin MkbWater_WELL
if ( OnActivate == 1 )
if ( player->GetItemCount "Mkb_Water Flask" >= 1 )
Player->AddItem "Mkb_Water001", 1
Player->RemoveItem "Mkb_Water Flask", 1
MessageBox, "Your water flask is now full."
else
return
endif
endif
end
********************************************************
here is the script for the item, "Mkb__Water001"
********************************************************
Begin MkbWater01
Short State
if ( OnPCEquip == 1 ) ; if you take a drink
if ( Player->GetItemCount, "Mkb_Water001" > 0 ) ;and you have a full flask of water in your inventory
if ( State == 0 )
Player->RemoveItem "Mkb_Water001" 1
Set Thirsty to 0
Player->AddItem "Mkb_Water002" 1 ; give you a half flask of water
Set TakeAPiss to ( TakeAPiss + 1 ) ; make you have to take a piss'
MessageBox, "As the water touches your tongue you feel relaxed, take a big drink, and feel refreshed."
Set State to 10
endif
elseif ( Player->GetItemCount, "Mkb_Water001" < 1 ) ; if you DON'T have any water...
Activate ; give you some!
endif
endif
end
********************************************************
here is the script for the item, "Mkb__Water002"
********************************************************
Begin MkbWater02
Short State
if ( OnPCEquip == 1 ) ; if you take a drink
if ( Player->GetItemCount, "Mkb_Water002" > 0 ) ;and you have a full flask of water in your inventory
if ( State == 0 )
Player->RemoveItem "Mkb_Water002" 1
Set Thirsty to 0
Player->AddItem "Mkb_Water003" 1 ; give you a half flask of water
Set TakeAPiss to ( TakeAPiss + 1 ) ; make you have to take a piss'
MessageBox, "As the water touches your tongue you feel relaxed, take a big drink, and feel refreshed."
Set State to 10
endif
elseif ( Player->GetItemCount, "Mkb_Water002" < 1 ) ; if you DON'T have any water...
Activate ; give you some!
endif
endif
end
********************************************************
here is the script for the item, "Mkb__Water003"
********************************************************
Begin MkbWater03
Short State
if ( OnPCEquip == 1 ) ; if you take a drink
if ( Player->GetItemCount, "Mkb_Water003" > 0 )
if ( State == 0 )
Activate
Set Thirsty to 0
Player->AddItem "Mkb_Water Flask" 1
Set TakeAPiss to ( TakeAPiss + 1 )
MessageBox, "Your water flask is now empty."
Set State to 10
endif
elseif ( Player->GetItemCount, "Mkb_Water003" < 1 )
Activate
endif
endif
end
********************************************************
Here is the script for being thirsty. (under construction...)
It's a basic idea, but doesn't work quite right yer.
********************************************************
Begin Mkb_ThirstyState
short currentDay
short daysPassed
Short State2
short State
set CurrentDay to Day
Set Thirsty to 0
Set daysPassed to ( daysPassed + 1 )
if ( State2 == 30 )
Return
endif
if ( currentDay == Day )
Return
endif
if ( daysPassed >= 4 )
if ( State2 == 20 )
set Thirsty to ( Thirsty + 1 )
set State2 to 30
endif
endif
if ( daysPassed >= 3 )
if ( State2 == 10 )
set Thirsty to ( Thirsty + 1 )
set State2 to 20
endif
endif
if ( daysPassed >= 2 )
if ( State2 == 0 )
set Thirsty to ( Thirsty + 1 )
set State2 to 10
endif
endif
;HERE IS WHERE THE FUN STARTS...
if ( Thirsty == 0 )
Player->RemoveSpell, "Mkb_Thirsty1_EFFECT"
Player->RemoveSpell, "Mkb_Thirsty2_EFFECT"
Player->RemoveSpell, "Mkb_Thirsty3_EFFECT"
endif
if ( Thirsty >= 2 )
if ( State == 0 )
WakeUpPC
messageBox, "Your thirst grows large.", "Ok"
Player->AddSpell, "Mkb_Thirsty1_EFFECT"
set State to 10
endif
endif
if ( State == 10 )
if ( Thirsty >= 3 )
WakeUpPC
messageBox, "You need water. You feel tired. Your stomach is hurting.", "Ok"
Player->RemoveSpell, "Mkb_Thirsty1_EFFECT"
Player->AddSpell, "Mkb_Thirsty2_EFFECT"
set State to 20
endif
endif
if ( Thirsty >= 4 )
if ( State == 20 )
WakeUpPC
messageBox, "You are dieing. You need water!", "Ok"
Player->RemoveSpell, "Mkb_Thirsty1_EFFECT"
Player->RemoveSpell, "Mkb_Thirsty2_EFFECT"
Player->AddSpell, "Mkb_Thirsty3_EFFECT"
endif
endif
endif
End
********************************************************
Thanks again for helping with this part of my plug in. It'll be sweet when finished, and the whole water drinking thing is a major part of it. now, (when its out), you can tell everybody that you helped make it!
Striker on 23/8/2004 at 02:31
You must declare OnPCEquip before you use it ( Short OnPCEquip ). Also, Set OnPCEquip to 0 for the script to fire once each time you equip the flask.
37637598 on 23/8/2004 at 02:49
Oh, oops! Thanks. :thumb:
cyrano on 23/8/2004 at 06:16
You have made some good progress, but I still have some observations.
OnActivate should not necessary since you do not have to choose between the normal function of the object (wells do not open, equip, etc.) and the script that is attached to it. If OnPCEquip will work for potions when you drag them onto your character in the inventory screen, then your water bottle scripts may work as you intend.
I am still confused about Activate. Activate, when used in conjunction with an item such as:
“Object_ID” -> Activate , will execute the normal activation function, containers open, shrines bless you, etc. Again, what is it you are wishing to activate? The well? “Activate” used by itself will activate the object to which the script is attached. In your case, that is the water bottle…Actually, I see that you have a more fundamental problem. Your water bottle script calls for the removal of the object to which it is attached (unless Mkb__water001 is not the same as Mkb_water001). Removing an item that has a running script attached to it will probably crash the game.
Your timer needs a small adjustment. You want to increase the days passed only once each day. Since it needs to run continuously, it needs to be a global script (or attached to something that you will keep in your inventory). Try something like:
if ( doOnce == 0 ) ; set initial conditions
set currentDay to DaysPassed
set Thirsty to 0
set doOnce to 1
endif
if ( currentDay != Day )
set daysElasped to ( daysElapsed + 1 )
set currentDay to DaysPassed
endif
You have a return if currentDay equals Day (edit: DaysPassed), so you don’t intend for anything to happed on the first day. Unfortunately, except for one frame of each day, currentDay will always equal Day (edit: DaysPassed), so none of the rest of your script will execute. Lose that block of code; I don’t think you need it anyway since everything thereafter is moderated by your Thirsty and State2 variable. When State2 == 30, everything will come to a halt. The script returns and there is nothing in the code above it that can alter its value. The only code that can affect the value of State2 comes further down. Move the block including State2 == 30 below all of the daysPassed (edit: daysElapsed) conditionals.
After you apply the spell effects, you will want to adjust the value of Thristy (step it back down or set it to zero). Also daysPassed (edit: daysElapsed), State, and State2 needs to be reset at some point. At last I have noticed your WakeUpPC. I presume that you want to have this part of the script execute when the player is sleeping. Before the section that includes the effects of dehydration, you will need a: if ( GetPCSleep == 1 ) check to prompt the script to continue beyond that conditional.
I like your notion of penalizing the player for going without water for a prolonged period of time, but his he ever going to have an opportunity to take a leak? :eek:
Edit: DaysPassed is a global variable, use daysElapsed to store the number of days that has passed since last check. The global variable Day stores the day of the month. Using DaysPassed (the day number since the start of the game) is more reliable. In this script it didn’t make any difference, but there are situations…
37637598 on 25/8/2004 at 05:09
FOR THE WELL... onActivate is basically used so the script knows to function if the player selects the well...
ACTIVATE... this is here, (assuming you mean 'activate' in the water bottle script), to let the water bottle know to activate. to cast its spells on the
player. do you think there should be a script command something like, "Mkb_water001"->ActivateOn, "Player", to let the object know what other object to
activate on? such as a potion activating on the player! maybe i should change the script so it says, instead of activate,( Disable & Player->CastSpell,
"Water001") think it'd work better?
***********************************************
Begin MkbWater01
Short State
if ( OnPCEquip == 1 ) ; if you take a drink
if ( Player->GetItemCount, "Mkb_Water001" > 0 ) ;and you have a full flask of water in your inventory
if ( State == 0 )
Player->RemoveItem "Mkb_Water001" 1
Set Thirsty to 0
Player->AddItem "Mkb_Water002" 1 ; give you a half flask of water
Set TakeAPiss to ( TakeAPiss + 1 ) ; make you have to take a piss'
MessageBox, "As the water touches your tongue you feel relaxed, take a big drink, and feel refreshed."
Set State to 10
endif
elseif ( Player->GetItemCount, "Mkb_Water001" < 1 ) ; if you DON'T have any water...
Activate ; give you some!
endif
endif
end
*************************************************
I see what you're saying there... perhaps I could have this instead...
***********************************************
Begin MkbWater01
Short State
if ( OnPCEquip == 1 ) ; if you take a drink
if ( Player->GetItemCount, "Mkb_Water001" > 0 ) ;and you have a full flask of water in your inventory
if ( State == 0 )
set DRINK to 1*******************
Set State to 10
endif
elseif ( Player->GetItemCount, "Mkb_Water001" < 1 ) ; if you DON'T have any water...
Activate ; give you some!
endif
endif
end
**************************
I could have the script above for each water bottle.. if you drink the first one, set
drink to 1. if you drink the second, set drink to 2. same for the third.
the script for, Drink, would be a 'Start Script' so it would be automatically running...
**************************
Begin Drink
Short State
short state1
short state2
if ( State == 0 )
if ( Drink == 1 )
Set TakeAPiss to ( TakeAPiss + 1 ) ; make you have to take a piss'
set Thirsty to 0
Player->RemoveItem "Mkb_Water001" 1
Player->AddItem "Mkb_Water002" 1 ; give you a half flask of water
MessageBox, "As the water touches your tongue you feel relaxed, take a big drink, and feel refreshed."
set state to 1
set cast to 1
endif
endif
if ( State1 == 0 )
if ( Drink == 2 )
Set TakeAPiss to ( TakeAPiss + 1 ) ; make you have to take a piss'
set Thirsty to 0
Player->RemoveItem "Mkb_Water002" 1
Player->AddItem "Mkb_Water003" 1 ; give you a half flask of water
MessageBox, "As the water touches your tongue you feel relaxed, take a big drink, and feel refreshed."
set state1 to 1
set cast to 1
endif
endif
if ( State2 == 0 )
if ( Drink == 3 )
Set TakeAPiss to ( TakeAPiss + 1 ) ; make you have to take a piss'
set Thirsty to 0
Player->RemoveItem "Mkb_Water003" 1
Player->AddItem "Mkb_Water Flask" 1 ; give you a half flask of water
MessageBox, "your flask is now empty."
set state2 to 1
set cast to 1
set drink to 0
endif
endif
if ( Cast == 1 )
Player->Cast ;Spell for effects that water has on player
set state 1, 2, and 3 to 0! ;note: this is not the actual script! otherwise, this line would return errors!
set cast to 0
end
***********************************************************
YOU WILL be able to take a leak! thank god..
this was my first script where I use all that days past stuff so, i dont know really what i'm doing. i was about to post on here, "Can someone give me an example script using the day, and dayspassed variables?"!!! Then i found the script, "Plant2" which gave me an idea... The WakeUpPc is used just incase player is asleep because i didn't know if the script's message box and stuff would work if he wakes up not at the exact time of the day passing. I was hesitant to use, "if ( GetPCSleep == 1 )", because I wanted the script to work whether or not you were sleeping. make any sense? thanks for all the help! I'm pretty retarded when it comes to all this reading scripts crap! and, i'm used to c++. kinda different!
I'll try all this suggestion tomarrow. Thanks again! :thumb:
37637598 on 25/8/2004 at 05:27
I recently got the plug-in for 3dsmax v. 4.0 (tes to 3ds exporter?) but I have 3dsmax v 6.0. I thought it should work (for 4.0 and later versions), but it doesn't! any suggestion, or should I spend another $5-900+ on 3ds Max 4.0? or, is there anything I can get for gmax? i spent alot of time making models in 3dmax thinking, "It'd be cool if I had this in morrowind!". I then found the 3ds to nif converter and got excited! Didn't work. I tried modding it (illegal :sly: ), but couldn't seem to fix it without errors! any help would really help! :rolleyes:
cyrano on 27/8/2004 at 06:42
There is much to respond to here, but I think I will begin with your last post. I expect the NIF converter of which you speak the utility available from the official site. It only works with 3DMax 4.0. Later versions of 3DMax cannot be directly imported to the construction set. I suppose you are a graphics artist to have such a program at your disposal. Yes, you could acquire version 4.0, but it is a serious investment, and unless you intend to do considerable work for Morrowind modding, it would be difficult to justify the expense. While there are other graphics tools (some of them freeware), as far as I know, there is (presently) no other way to convert graphics for use in Morrowind. As I write, the good people at NIFLA are attempting to right that wrong. The NetImmerse File Format Liberation Army…err Association are working on a utility to convert more common formats to NIF. I believe they may have a limited (
http://games.groups.yahoo.com/group/NIFLA/) beta release available.
You can look into that, or try to contact someone who is willing to convert your 3DMax 6.0 to version 4.0 (they may be somewhat backward compatible). Post your request at a high traffic location like the official site. On the other hand, if all you need is a graphic of a bota bag for your mod. It may already exist. Again, you could ask (post), or check out similarly-themed mods that may include that graphic. Two projects come immediately to mind: (
http://www.tadnan-hideout.com/MW/main.html) Necessities of Morrowind and (
http://www.thelys.org/mods.php?a=Balor#Primary_Needs) Primary Needs. You may wish to study the scripts therein to help you with your work.
It is late, I will post this and write again tomorrow.