Quick Questions -- Quick Answers, The Eighteenth

Post » Thu May 26, 2011 9:40 pm

Hello,

I've been scratching my head over this trigger script of which I've borrowed code from here and the Wiki. I have it attached to a trigger box of which I've scaled x6 and use two to completly cover an interier cell. Idealy it should enable and disable an X Marker at 5:00 am and 11:00 pm. I believe I must have missed something somewhere.

scriptName RX31LightsTrigSCRIPTfloat GameHourshort triggeredfloat timerbegin onTrigger	if triggered == 0		if GameHour >= 5 || GameHour < 23			RX31LightsXMarkerREF.enable		else			RX31LightsXMarkerREF.disable		endif		set triggered to 1		set timer to 2	endifendbegin gameMode	if triggered == 1		if timer <= 0			set triggered to 0		else			set timer to timer - getSecondsPassed		endif	endifend
Any help would be very kind.

Best regards,
RX31

Edit:
Many thanks Showler. Silly logic error. I still had trouble after the change and discovered that GameHour shouldn't have been declared. Fixed script reads:

scriptName RX31LightsTrigSCRIPTshort triggeredfloat timerbegin onTrigger	if triggered == 0		if GameHour >= 5 && GameHour < 23			RX31LightsXMarkerREF.enable		else			RX31LightsXMarkerREF.disable		endif		set triggered to 1		set timer to 2	endifendbegin gameMode	if triggered == 1		if timer <= 0			set triggered to 0		else			set timer to timer - getSecondsPassed		endif	endifend
Many thanks for help.
RX31
User avatar
Ridhwan Hemsome
 
Posts: 3501
Joined: Sun May 06, 2007 2:13 pm

Post » Fri May 27, 2011 11:42 am

What is it doing or not doing?

First of all, this will always be true: if GameHour >= 5 || GameHour < 23

Because you used and OR instead of an AND ( || instead of && )

Other than that, it should trigger every time someone enters the room and enable the light, then trigger again and disable the light, then two seconds later it should trigger again and enable the light, and again, and again.
User avatar
Haley Cooper
 
Posts: 3490
Joined: Wed Jun 14, 2006 11:30 am

Post » Fri May 27, 2011 6:27 am

Is there a function to force an AI package? I'm having trouble trying to get an NPC walking into my cave.
User avatar
CYCO JO-NATE
 
Posts: 3431
Joined: Fri Sep 21, 2007 12:41 pm

Post » Fri May 27, 2011 5:06 am

addScriptPackage
User avatar
lolly13
 
Posts: 3349
Joined: Tue Jul 25, 2006 11:36 am

Post » Fri May 27, 2011 9:32 am

I could use some help with this one. Basically, I want to make it so that when I hit someone, I have a chance to do extra damage, or miss. I changed the swords script(the drop down box in the edit menu of a weapon) to this but it doesn't seem to be working
scn KCRAttackElvenShortswordshort RandomPercentshort SkillVarCritshort SkillVarMissfloat BladeSkillfloat LuckSkillref Weaponfloat WeaponDamagebegin ScriptEffectStart	set RandomPercent to getRandomPercent	set LuckSkill to player.getActorValue Luck	set BladeSkill to player.getActorValue Blade	set SkillVarCrit to (LuckSkill + BladeSkill) * 0.15	 set SkillVarMiss to (LuckSkill + BladeSkill) * 0.3	set Weapon to player.GetEquippedObject 16	set WeaponDamage to getAttackDamage Weapon	printC "working"	if RandomPercent <= SkillVarCrit		printC "critical hit"		set WeaponDamage to WeaponDamage*15		setAttackDamage WeaponDamage Weapon	endif	if RandomPercent >= SkillVarMiss		printC "miss"		set WeaponDamage to WeaponDamage*0.3		setAttackDamage WeaponDamage Weapon	endifend


Sorry for the huge code, but I'm not that good at coding and this was the shortest I could make it. I check my console everytime I hit someone but there's nothing there, so it's not working. Can anyone help?

edited:
While I'm here I might as well ask how to make npc's use this script when using the weapon also
User avatar
City Swagga
 
Posts: 3498
Joined: Sat May 12, 2007 1:04 am

Post » Fri May 27, 2011 7:36 am

addScriptPackage


Are you sure? He already has the package in his AI however I think it's being overridden by the stayatcurrentlocation package. I'll look it to that though, thanks. :)
User avatar
kitten maciver
 
Posts: 3472
Joined: Fri Jun 30, 2006 2:36 pm

Post » Fri May 27, 2011 2:33 am

I want to have daylight appear in the Render Window. I switch the "brighten window" on and off (that button with a light in the toolbar, or the A button on your keyboard), and it only switch from complete bright screen to night. I tried changing the day light (Preferences/Render Window/Time of Day slide), but it doesn't change. Help?
User avatar
MatthewJontully
 
Posts: 3517
Joined: Thu Mar 08, 2007 9:33 am

Post » Fri May 27, 2011 1:01 pm

I could use some help with this one. Basically, I want to make it so that when I hit someone, I have a chance to do extra damage, or miss. I changed the swords script(the drop down box in the edit menu of a weapon) to this but it doesn't seem to be working
scn KCRAttackElvenShortswordshort RandomPercentshort SkillVarCritshort SkillVarMissfloat BladeSkillfloat LuckSkillref Weaponfloat WeaponDamagebegin ScriptEffectStart	set RandomPercent to getRandomPercent	set LuckSkill to player.getActorValue Luck	set BladeSkill to player.getActorValue Blade	set SkillVarCrit to (LuckSkill + BladeSkill) * 0.15	 set SkillVarMiss to (LuckSkill + BladeSkill) * 0.3	set Weapon to player.GetEquippedObject 16	set WeaponDamage to getAttackDamage Weapon	printC "working"	if RandomPercent <= SkillVarCrit		printC "critical hit"		set WeaponDamage to WeaponDamage*15		setAttackDamage WeaponDamage Weapon	endif	if RandomPercent >= SkillVarMiss		printC "miss"		set WeaponDamage to WeaponDamage*0.3		setAttackDamage WeaponDamage Weapon	endifend


Sorry for the huge code, but I'm not that good at coding and this was the shortest I could make it. I check my console everytime I hit someone but there's nothing there, so it's not working. Can anyone help?

edited:
While I'm here I might as well ask how to make npc's use this script when using the weapon also


That is a begin ScriptEffectStart block which does not run on object scripts.

Try this script instead, it waits until the player equips the weapon, unsheathes it, and presses the attack button before modifying the damage.

scn KCRAttackElvenShortswordshort RandomPercentshort SkillVarCritshort SkillVarMissfloat BladeSkillfloat LuckSkillref Weaponfloat WeaponDamagebegin Gamemodeset Weapon to player.GetEquippedObject 16if Weapon == getSelf && player.IsWeaponOut == 1	if OnControlDown 4 		set RandomPercent to getRandomPercent		set LuckSkill to player.getActorValue Luck		set BladeSkill to player.getActorValue Blade		set SkillVarCrit to (LuckSkill + BladeSkill) * 0.15		set SkillVarMiss to (LuckSkill + BladeSkill) * 0.3		set WeaponDamage to getAttackDamage Weapon		printC "working"		if RandomPercent <= SkillVarCrit			printC "critical hit"			set WeaponDamage to WeaponDamage*15			setAttackDamage WeaponDamage Weapon		endif		if RandomPercent >= SkillVarMiss			printC "miss"			set WeaponDamage to WeaponDamage*0.3			setAttackDamage WeaponDamage Weapon		endif	endifendifend


NOTE: your script will change the damage of every reference of this object. So try to keep only one in the game.

Also, I hope you know that once the player gets a crit then the weapon's damage will stay at crit damage until he misses and it changes again. You might want to assign a variable to the original damage of the weapon and switch the weapon's damage back to the original after every hit (this can be easily done by adding an enchantment to the weapon and switching the damage back there, you will also need a quest, with a script, with a float variable to transfer the original weapons damage value between scripts). I hope that made some sort of sense to you...

About your question for making it run on all npcs as well... that is going to be really difficult. If your really interested then you might want to ask one of the more experienced scripters here.
User avatar
Sammi Jones
 
Posts: 3407
Joined: Thu Nov 23, 2006 7:59 am

Post » Thu May 26, 2011 11:22 pm

Heres a quick question, I want my script to check the open state of a door
http://cs.elderscrolls.com/constwiki/index.php/GetOpenState

for example, if it's open, message box pops up

But how do I put that in context? (in my script?)
User avatar
Julia Schwalbe
 
Posts: 3557
Joined: Wed Apr 11, 2007 3:02 pm

Post » Thu May 26, 2011 9:59 pm

I want to have daylight appear in the Render Window. I switch the "brighten window" on and off (that button with a light in the toolbar, or the A button on your keyboard), and it only switch from complete bright screen to night. I tried changing the day light (Preferences/Render Window/Time of Day slide), but it doesn't change. Help?

If you right-click your cell in the Cell View and go to Edit, try the Lighting Tab. You can change the ambient values to modify the cell's lighting. However, these changes will be visible ingame; if you just want these changes to be in the editor, just change them back to their original values after. As far as I know, there isn't an easier way to do it.

Heres a quick question, I want my script to check the open state of a door
http://cs.elderscrolls.com/constwiki/index.php/GetOpenState

for example, if it's open, message box pops up

But how do I put that in context? (in my script?)

You'd do something like this, where SOMEDOORREF is the reference name of a Persistent Reference animated door:
scn DoorOpenbegin OnActivate	if (GetOpenState SOMEDOORREF == 1)		MessageBox "The door is open!"	endifend

User avatar
Brooke Turner
 
Posts: 3319
Joined: Wed Nov 01, 2006 11:13 am

Post » Fri May 27, 2011 2:55 am

If you right-click your cell in the Cell View and go to Edit, try the Lighting Tab. You can change the ambient values to modify the cell's lighting. However, these changes will be visible ingame; if you just want these changes to be in the editor, just change them back to their original values after. As far as I know, there isn't an easier way to do it.

I don't mean to change the lighting in game. I just wish for CS to render the day lighting and shadows, like in game. Of course, that applies only for exterior cells.

And another question: I want to make a duplicate of an activator object. The problem is, i can't find the mesh when i browse it. ID is MS29CallibenTrentiusCrypt (although i don't think that matters), and i want to make another one with the same mesh, only with different ID and name. I had this problem before, but i manage to find a workaround. This time, however, i really need to find that particular mesh.
User avatar
dell
 
Posts: 3452
Joined: Sat Mar 24, 2007 2:58 am

Post » Fri May 27, 2011 9:27 am

I don't mean to change the lighting in game. I just wish for CS to render the day lighting and shadows, like in game. Of course, that applies only for exterior cells.


I don't think the CS does that, but I could be wrong.

And another question: I want to make a duplicate of an activator object. The problem is, i can't find the mesh when i browse it. ID is MS29CallibenTrentiusCrypt (although i don't think that matters), and i want to make another one with the same mesh, only with different ID and name. I had this problem before, but i manage to find a workaround. This time, however, i really need to find that particular mesh.


If you mean the .NIF itself, the file path is Meshes\Architecture\Cathedral\Crypt\CathedralCryptTomb01.NIF
If you haven't unpacked the BSA it is in, you won't be able to access it.
User avatar
FITTAS
 
Posts: 3381
Joined: Sat Jan 13, 2007 4:53 pm

Post » Fri May 27, 2011 9:21 am

how do you declare a global variable?
User avatar
Ann Church
 
Posts: 3450
Joined: Sat Jul 29, 2006 7:41 pm

Post » Fri May 27, 2011 2:09 am

how do you declare a global variable?
http://cs.elderscrolls.com/constwiki/index.php/Globals.
User avatar
gandalf
 
Posts: 3400
Joined: Wed Feb 21, 2007 6:57 pm

Post » Fri May 27, 2011 12:13 pm

http://cs.elderscrolls.com/constwiki/index.php/Globals.


ah thank you, i was searching for the wrong thing.
is there an item that goes with the mythic dawn armor. there is bound armor under daedric, but no "mythic dawn armor" i've lookeed through the filters and none of them seem to fit hte armor.
User avatar
jessica sonny
 
Posts: 3531
Joined: Thu Nov 02, 2006 6:27 pm

Post » Fri May 27, 2011 9:29 am

ah thank you, i was searching for the wrong thing.
Note though that pages warning: "In almost all cases, using a global variable is unnecessary. Variables defined in quest scripts are generally used instead, and accessed via questID.varName, or getQuestVariable questID varName."

So avoid using global variables, unless you need two different mods to communicate without one being dependent on the other.
User avatar
joseluis perez
 
Posts: 3507
Joined: Thu Nov 22, 2007 7:51 am

Post » Fri May 27, 2011 6:40 am

Is there a way to prevent the FaceGen reset that occurs when the Player becomes a vampire? I can change IVampirismAgeOffset to 0, but facial features still change. Is there a non-OBSE method of saving facial features after character creation and then applying them after becoming a vampire?
User avatar
Hannah Barnard
 
Posts: 3421
Joined: Fri Feb 09, 2007 9:42 am

Post » Thu May 26, 2011 9:41 pm

Note though that pages warning: "In almost all cases, using a global variable is unnecessary. Variables defined in quest scripts are generally used instead, and accessed via questID.varName, or getQuestVariable questID varName."

So avoid using global variables, unless you need two different mods to communicate without one being dependent on the other.


I have two different scripts that call the same variable and isn't that what the globals are for?
User avatar
He got the
 
Posts: 3399
Joined: Sat Nov 17, 2007 12:19 pm

Post » Fri May 27, 2011 10:10 am

I have two different scripts that call the same variable and isn't that what the globals are for?


Naw. I have a dummy quest just to hold variables, using globals is usually not necessary.

Create a quest that won't be used for anything else. Make sure it has at least one stage (I find it won't run if it doesn't). That stage doesn't need to be set by a script or anything, it just has to exist. Now create a quest script for it. You can then dump variables in there.

Mine is called "A0Tracker" because it's there almost solely for tracking various variables.

In A0Tracker, I have a short variable called "FHR1ConstructCount1"

I have a set of enemies (Constructs), and when they die, they add to this variable. There are six in total. They have this script attached to them:

scn A0FHR1ConstructDeathCountSCRIPTBegin OnDeathSet A0Tracker.FHR1ConstructCount1 to A0Tracker.FHR1ConstructCount1 + 1DisableEnd


By calling the Quest.Variable, I can alter the variable in a quest from basically any other script.

I have a TON of miscellaneous if statements in that Tracker script that aren't directly tied into actual quests, just the way dungeons operate, like puzzles, etc. One set of If blocks is this:

;When the player passes through the TrigZone entering The Test of Strength and Endurance, it sets FHR1ConstructSpawning to 1,;which causes the 6 constructs to spawn. Once they are killed, the Prime Construct will spawn. When he is killed, the player is;sent to the "Oasis" room. Of course, this ceases being counting the constructs specifically, as once the player grabs the item;there, it sets it to 10, which this script picks up, creating the door that leads out of that room.If ( FHR1ConstructSpawning == 1 )	A0FHR1Construct1.Enable	A0FHR1Construct2.Enable	A0FHR1Construct3.Enable	A0FHR1Construct4.Enable	A0FHR1Construct5.Enable	A0FHR1Construct6.Enable	set FHR1ConstructSpawning to 2EndIfIf ( FHR1ConstructCount1 == 6 )	A0FHR1ConstructPrimeREF.Enable	Set FHR1ConstructCount1 to 7EndIfIf ( FHR1ConstructCount1 == 8 )	set FHR1ConstructCount1 to 9	Messagebox "You feel yourself whisked away!"	Player.MoveTo A0FHR1StrTestWinTPRefEndIfIf ( FHR1ConstructCount1 == 10 )	A0FHR1BeamDoorRef.Enable	A0FHR1LeaveTriggerREF.Enable	A0FHR1CollBox1.Disable	set FHR1ConstructCount1 to 11	A0FHR1StrEndEntryGateRef.Unlock	A0FHR1StrEndEntryGateRef.ActivateEndIf


I could post more, but I think you get the idea. Make sure to read my annotations on that one too.

I hope this helps to give you a general idea of what's going on :) We have several if statements in this one script, but we have 3 other scripts (one of which is instanced 6 times) are calling and manipulating that variable.

Remember Quest.Variable to call any variable. I haven't had the need for a global yet by doing this :)
User avatar
QuinDINGDONGcey
 
Posts: 3369
Joined: Mon Jul 23, 2007 4:11 pm

Post » Fri May 27, 2011 3:15 am

ok i think i get it.
Can editing vanilla dungeons cause problems with games or is that OK
User avatar
ImmaTakeYour
 
Posts: 3383
Joined: Mon Sep 03, 2007 12:45 pm

Post » Fri May 27, 2011 12:10 am

If you want to edit a vanilla dungeon, look it up on the UESPWiki and make sure it doesn't have a quest associated first. I don't think there's much issue with editing a vanilla dungeon, I just stay away from editing any that involve quests. On the other hand, if two mods alter the same dungeon, they could conflict, depending on what is being changed. Typically, the one loaded after will have its changes overwrite any changes the other mod made to any exact spot in that dungeon.
User avatar
Life long Observer
 
Posts: 3476
Joined: Fri Sep 08, 2006 7:07 pm

Post » Fri May 27, 2011 3:51 am

Okay, now I have a question.

When you use DisablePlayerControls, does it keep enemies from attacking the player? Or, if one is nearby, is the player screwed?
User avatar
Brooke Turner
 
Posts: 3319
Joined: Wed Nov 01, 2006 11:13 am

Post » Fri May 27, 2011 1:27 am

When you use DisablePlayerControls, does it keep enemies from attacking the player? Or, if one is nearby, is the player screwed?

He's screwed.

If you want him to be unattackable by enemies, use the SetGhost command additionally (this has nothing to do with the ghost shader effect - it's a setting making actors unattackable, like Haskill, and can also be used on the player).
User avatar
helen buchan
 
Posts: 3464
Joined: Wed Sep 13, 2006 7:17 am

Post » Fri May 27, 2011 5:50 am

Do Levelled Creature lists produce a creature each respawn time if the creatures on the list do not have Respawns checked?
User avatar
Alex [AK]
 
Posts: 3436
Joined: Fri Jun 15, 2007 10:01 pm

Post » Fri May 27, 2011 7:03 am

Naw. I have a dummy quest just to hold variables, using globals is usually not necessary.

Create a quest that won't be used for anything else. Make sure it has at least one stage (I find it won't run if it doesn't). That stage doesn't need to be set by a script or anything, it just has to exist. Now create a quest script for it. You can then dump variables in there.
This works, but there's no reason to make any dummy quest. If you have two quests (QA and QB) each with one script, just define the variable where its most used, and whenever the other scripts need to refer to it, qualify it with the other script's name. Ex:

The script attached to QA defines var1, and the script attached to QB defines var2.

When you need to refer var1 from QB's script you use "QA.var1". When refering to var2 from QA's script you use "QB.var2".

Doing this is even legal from scripts in other plugins, provided the plugin that defines the variable is a master for the one referring to it.
User avatar
Ludivine Poussineau
 
Posts: 3353
Joined: Fri Mar 30, 2007 2:49 pm

PreviousNext

Return to IV - Oblivion