Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

General Script Questions #1


WillieSea
 Share

Recommended Posts

Test the spell in the same cell you placed the activator in. Report your results.

Nothing happened. At all. XD The activator just sat there laughing at me. When I tried it outside the cell afterward, I got the same result. Nothing. :) Nada. :clap: Niente. :clap: Zero. :wallbash: Zip. :wallbash: Zilch. :wallbash: (all this head banging is giving me a headache)

Link to comment
Share on other sites

1. You are 'adding' to the timer and 'subtracting' the same amount from the timer in the ScriptEffectUpdate block of code. It will NEVER execute any of the stuff you want it to since the value will never get anywhere.

2. GetSecondsPassed does not work in a 'ScriptEffectUpdate' block. Use ScriptEffectElapsedSeconds instead.

3. Your spell must have a duration that will cover the timer you have setup in the scriptEffectUpdate block of code. If your duration is too short then not enough time will pass to even do anything.

4. You have an extra 'Endif' in your ScriptEffectUpdate.

Link to comment
Share on other sites

Okay, I'm coming with new question (not aligned with Vitharn quest).

I've created an enchantment that is supposed to cast paralyse on the target if the player (or whoever is using the weapon) will attack while being undetected. At first I've thought that it works perfectly, but now I see it don't.


scn SE30ZUSPLParalSCRIPT

ref target

Begin ScriptEffectStart

set target to getself

if ( SE30Detect == 0 && target.IsSpellTarget SE30Paralyse == 0 && SE30DetectEQ == 1 && target != player && target.getdead == 0 )
SE30ParalyseM.moveto target 0 0 50
PushActorAway target 1
SE30ParalyseM.cast SE30Paralyse target
endif

End
[/codebox]

[code] scn SE30DetectQuestSCRIPT float timer Begin GameMode if ( player.IsActorDetected == 0 && SE30Detect == 1 ) set SE30Detect to 0 elseif ( player.IsActorDetected == 0 && timer > 0 ) set timer to 0 elseif ( player.IsActorDetected == 1 && timer == 0 ) set timer to ( getsecondspassed + 1 ) elseif ( player.IsActorDetected == 1 && timer > 0 && timer <= getsecondspassed ) set SE30Detect to 1 endif End [/code]

The first script is attached to the enchantment. It checks these things:

- Does the player is detected or not (it's a global value affected by second script);

- Does the target has been already paralysed or not (to disallow multiple paralysing);

- Does the player is wielding the supposed weapon or not (another global value, this time affected by weapon, that changes it when equipped/unequipped);

- Does the target is a player or not (to disallow being paralysed by NPC wielding the same weapon);

- Does the target is dead or not (to disallow comical act of paralysing a corpse).

Second script checks does the player is detected and because of that affects the global value. Once the player is detected, the global value is changed to 1 after one second. Why? Because when player strikes the opponent, he becomes detected at the same time as the enchantment's script starts working and the paralysing thing wouldn't work at all. There must be at least short interval between strike and being marked as detected.

But it seems to not work. While attacking with a sword, player can paralyse his target regardless of being detected or not. Any suggestions why and how to fix it?

Link to comment
Share on other sites

elseif ( player.IsActorDetected == 1 && timer == 0 )

set timer to ( getsecondspassed + 1 )

elseif ( player.IsActorDetected == 1 && timer > 0 && timer <= getsecondspassed )

set SE30Detect to 1

If I am reading this correctly, the second elseif here, will never return true. The timer will be greater than zero, but, it will never be less than getsecondspassed, as you set it to gsp + 1 in the previous line.

Link to comment
Share on other sites

The timer will be greater than zero, but, it will never be less than getsecondspassed, as you set it to gsp + 1 in the previous line.

Er... really? :blink: I thought that I'm setting this value only once this way and after a second it becomes equal to gsp. It does not?

Then what you suggest to fix it? I have no idea right now...

Link to comment
Share on other sites

Hhhhmmmm...... Depending on framerate.... there may be quite few frames where the player is detected, but, the second part is not true yet. Is it possible that the player is once again NOT detected after the attack? Another thing to consider..... is the detection script a quest script? If so, it runs once every five seconds..... so, according to popular theory, that line SHOULD work..... (should....)

If you are using OBSE, put some comments into the scripts, to show the important variables that you are using to test conditions, and see at what point it is failing.

Link to comment
Share on other sites

Okay... I've get rid of this problem, more or less... for now on, I'm coming with an another, simple question. If I wish to get some effect when player uses ingredient/potion and I don't want to use it as an enchantment, then how can I use Begin MenuMode to perform that? Just like that, or maybe I need to type some specific number in there?

Link to comment
Share on other sites

Normally, when you use MenuMode, you want to specify a specific menu or it might run at the wrong time.

Okay, so now I'm sure that I must type a proper number (I saw that page before). :rofl: Too bad that I don't know which one is for using (eating) an ingredient. Well, probably I must use a method of trial and error.

Thank you anyway. :pints:

Link to comment
Share on other sites

is there a way to check if a object is in the Shivering Isles?

Can you explain further? Are you seeking for a way to check does the item lies in the SEWorld worldspace or in cell that is accessible only from Isles, or maybe you just want to check does the player is in Isles?

In this second option, just put "if GetPlayerInSEWorld == 1" in OnActivate block or wherever you need it to. I don't know how to perform the first thing, though.

Link to comment
Share on other sites

I currently have an issue with the StartConversation function.

The concept is simple. When the player sits in a tavern, the serving girl comes talk to him. After the conversation is done, the serving girl returns to her business. If an hour has a passed and the player is still sitting OR sits again, the serving girl greets him again.

Below is my script. The issue I have is that the girl never stops greeting me when I sit. And I can't somehow see what's wrong. It's either me calling the variables in a wrong way, or the 1 hour wait not working.

scn CliffBetterInnsTheCountsArmsSitOnChairScript


;This script makes the serving girl/boy greet the player to offer her/his services


short HasServedPlayer

float CurrentTime



Begin GameMode


If player.getsitting == 3 && HasServedPlayer == 0

	StartConversation player, Greeting

	Set CurrentTime to GameHour

	Set HasServedPlayer to 1

endif


If ( ( CurrentTime + 1 ) != GameHour ) && HasServedPlayer == 1

	Set HasServedPlayer to 0

endif




End

Thanks! :D

Link to comment
Share on other sites

The problem is you do not have a timer set up correctly.

You will ALWAYS be setting HasServedPlayer back to zero, as soon as its set.

Why?

Because CurrentTime + 1 will never, ever equal GameHour, so its instantly reset.

You need to store the current gameHour when the server first talks to the player. Then check to see if that stored gamehour has passed before allowing the greeting again.

Link to comment
Share on other sites

As you may know, big actors can be unable to get somewhere if they're just too big, e.g. into some small corridor. And now I need a script which checks does the actor is stuck somewhere and is unable to reach the player, so after 5 seconds he's forced to cast some specific spell. Do you have an idea how to perform such a thing?

Link to comment
Share on other sites

There is no way to know if an actor is 'stuck'.

You could fake it with the GetDistance command.

If its not changing by about +/-100 every second, then the actor is probably stuck. But,this may or may not work since the player will be moving as well, which would also change the 'distance' to the NPC.

But, this is very uneffecient, using the GetDistance command.

Also, I am not sure the script would even run unless you place the script in a quest.

Perhaps you could check the cell the NPC is in every few minutes. Or you could check the current X,Y location of the NPC.

Any way you try it, it will be a bit buggy.

Usually, NPC's do not stay stuck if they are trying to get somewhere. They will eventually 'zip' through any object that is blocking them if the player is in the same cell. Otherwise, they really do not 'travel' the world, the AI packages just tell them where to be and they are there when the player enters the cell. :blink:

Link to comment
Share on other sites

I'm trying to set up a set of armor that will prevent the Detect Life shader from playing on any NPC that wears it. Reznod's Mannequins uses the following script to (somehow) accomplish this:


Scriptname ReznodMannequinDisableDetectLife


Begin ScriptEffectUpdate


     StopMagicShaderVisuals LifeDetected


End

I can't figure out how this gets applied, though. It's is a Magic Effect script, but it's not attached to a spell or enchantment. I also can't get it to work in my own mod. I've tried setting the following script as an ability spell, an enchantment, and even an object script attached to the armor:

scn StopDLEffectScript


Begin ScriptEffectStart


     StopMagicShaderVisuals effectDetectLife

     SMS effectDetectLife

     StopMagicShaderVisuals LifeDetected


End

But, no matter how I set it up, it doesn't stop the Detect Life shader from playing. How can I stop it?

Link to comment
Share on other sites

I think you should just combine them. I. e. there should be both ScriptEffectStart and ScriptEffectUpdate blocks.

If this doesn't work, then you should consider adding GameMode block in NPC's script which does the same thing all the time.

Link to comment
Share on other sites

ScriptEffectUpdate runs continuously, like a gameMode block of code. But, its for magic effects only, and it will only run as long as the duration of the spell says it 'can'.

ScriptEffectStart only runs once, at the start of the spell and will never run again until the script 'restarts'.

Link to comment
Share on other sites

As usual that stupid timer thing refuses to work. :shrug:

Script attached to the NPC:


scn ZUSE13KnightOfOrderSCRIPT


ref Myself

short NotSet

float fQuestDelayTime

short timer


Begin GameMode


	if ( NotSet == 0 )

		set fQuestDelayTime to 0.001

		set NotSet to 1

	endif


(...)


	if ( getinsamecell player == 1 && IsInCombat == 0 && getdead == 0 )

		startcombat player

	endif


	if ( getDead == 1 && SECreatureJyggalag8REF.getDead == 0 )

		if ( timer < 3 )

			set timer to timer + getSecondsPassed

		else

			Resurrect 1

			set timer to 0

		endif

	endif


(...)


End

Script attached to the quest:
scn ZUSE13QuestObelisks01


; This huge script handles the intensifying amount of Obelisks that appears with every moment of

; epic battle between Jyggalag and player. The whole battle is timed and player has 15 minutes to

; defeat Jyggalag, otherwise he will fail and the whole Palace Ground will be covered with Obelisks.

; Since it's so long, he's divided into three parts.


short Obelisks

short Wave

short timer

float fQuestDelayTime

short Minute


Begin GameMode


	if ( Obelisks == 0 )

		return

	elseif ( Obelisks == 1 )

		set fQuestDelayTime to 0.001

		set SE13Obelisks2.fQuestDelayTime to 0.001

		set SE13Obelisks3.fQuestDelayTime to 0.001

		set Obelisks to 2

	elseif ( Obelisks == 2 )

		set timer to timer + getSecondsPassed

		if ( timer >= 3 && Wave == 0 )

			SE13WaveObeliskBig001.enable

			SE13WaveObeliskBig001.playgroup forward 1

			set Wave to 1

		elseif ( timer >= 6 && Wave < 2 )

			SE13WaveObeliskBig011.enable

			SE13WaveObeliskBig011.playgroup forward 1

			set Wave to 2

			(...)

		elseif ( timer >= 597 && Wave < 204 )

			SE13WaveObeliskSmall116.enable

			SE13WaveObeliskSmall116.playgroup forward 1

			set Wave to 204

		elseif ( timer >= 600 && Wave < 205 ) ; ----------------------------------------------------------------------------------------------------------------------- 10 Minutes

			SE13WaveObeliskSmall136.enable

			SE13WaveObeliskSmall136.playgroup forward 1

			set Wave to 205

			set Minute to 10

		endif

	endif


End

Can you tell me what's wrong?

Link to comment
Share on other sites

There is nothing basically wrong with the script other than these notes:

NPC script:

1. You do not need 'fQuestDelayTime' on a script attached to an NPC.

Quest script:

2. I do not see any way 'Obelisks' can equal anything other than 0.

3. I do not see what 'Minute' is supposed to accomplish.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...