Scripting Sightseeing Spells Spontaneously

Post » Wed Sep 08, 2010 7:44 am

Ok, sorry for the stupid topic title, I just didn't know what to call this. XD

Before I explain everything I'm going to need to give you guys a bit of background on what I've been doing lately. It's a lot of mindless banter, really, my real question is down there at the bottom, but it might help for me to explain this, so... well, here it goes.

So, to further in my modding endeavors in order to make the most realistic roleplaying experience as my character, Kaikuro... I've been meaning to create a mod which causes some visual-based magic effects to spontaneously kick in at times. I'm not making any sense, so please let me explain, otherwise the reason why I'm doing this will go over your head.

I love to roleplay as my character Kaikuro (he's in a graphic novel I'm working on). Lately I've been disappointed in the experience because I'm simply playing as a Nord with long black hair. It just doesn't FEEL like Kaikuro for me. I attached the PC Sounds Valygar mod to him to get him to sound more accurate, but still, the experience was hindered by the fact that he just wasn't Kaikuro. So, I wanted to fix that.

First, Drake the Dragon and Fearrabbit helped me put together a mod which gives Kaikuro http://www.deviantart.com/download/163846463/just_another_portrait_again_by_AeolianMode.jpgas seen in the comic. I learned how to use Blender and created the mask and medallion mesh. Then Drake the Dragon did a lot of work in getting it textured and to conformulate properly, and I wouldn't have done this without him. ( Here's a video I put together showing the results of our efforts: http://www.youtube.com/watch?v=Y0Gk8WxbHWo )

Now, I want to take the extra step in furthering the roleplaying experience by giving him magic benefits that are NOT CONTROLLABLE. In the canon, his Medallion is a supernatural tool which gives him magical benefits, most of them are visual-related. Since he lost his right eye, the Medallion offers a replacement to his physical vision, which is why he ties it level to his natural eye. Aside from replacing his natural vision, it gives him many passive benefits. And sometimes, it can kick in and become remarkably powerful and allow extraordinary benefits- but only when he is in need of the powers. The Medallion has a mind of it's own. He CANNOT control the magic. It's not like the intentional "I'm going to cast a heal spell on myself now" moment. Kaikuro has no idea what's going to happen or kick in when it comes to his medallion's magic.


So, with that background out of the way... I'm wondering if it's possible to script the game to allow certain magic effects to kick in seemingly spontaneously, but triggered by certain events. Such as, a "detect life" and "night eye" spell to be added to him when he enters a dungeon. The Medallion would allow him to see in the dark and detect where others are in the dungeon. Or, a "sheild" spell to suddenly be added to him sometimes when he is in combat. Or any other magic benefits that could spontaneously occur.

I don't want this to be 'game breaking' though so I only want the effects to have a 'percentage chance' to take effect.

Anyway, thoughts? Is this possible? How would I best go about it? Any scripting tutorials you could direct me towards that would be specifically required to know for this task?
User avatar
Project
 
Posts: 3490
Joined: Fri May 04, 2007 7:58 am

Post » Wed Sep 08, 2010 5:17 am

Depending on your scripting knowledge, I suppose that you might need to read a load of general scripting tutorials, such as those found on this section of the CS wiki: http://cs.elderscrolls.com/constwiki/index.php/Portal:Scripting

Specifically for your needs, it looks like you might find http://www.tesnexus.com/downloads/file.php?id=18160 useful. Good luck :)
User avatar
Emmi Coolahan
 
Posts: 3335
Joined: Wed Jan 24, 2007 9:14 pm

Post » Wed Sep 08, 2010 6:50 am

Well, that is an interesting concept. I would suggest creating several Ability type spells with the effects you want. Then determine under what circumstances you want them added and search for scripting functions that would be appropriate venues for them. For instance, IsInInterior for Nighteye and Detect Life spells and IsInCombat for any combat related spells (you could eve use that to add offensive spells to Kaikuro's spell list and remove them when combat is finished). You could then set up a random chance for these to be added, depending on the circumstance. I'm not the best scripter, so I can't give you a good example (sorry), but that is how I'd try to set it up.
User avatar
loste juliana
 
Posts: 3417
Joined: Sun Mar 18, 2007 7:37 pm

Post » Wed Sep 08, 2010 6:06 pm

Just give us a list of effects you think would be appropriate, and we can work out how to get them into the game. :)

I imagine what you'd have to do is to first get some basic conditions that have to be met, and then another set of conditions based on your character's stats, and then maybe a random chance as well. For example, a Nighteye ability: Basic condition is that you're in the dark. If you aren't, the ability will not be considered. Then there could be more optional conditions, for example it could only kick in either when enemies are around or when you're trespassing. And maybe your character needs to have low health, or low encumbrance, or anything, for it to work. If all conditions are met, there'll be a random chance that will determine whether the ability will be granted or not.
Turning this into a script is easy, but first you need to think of all these limitations and make a table or something about it.

By the way, that mask looks perfect! Very cool.
User avatar
Lawrence Armijo
 
Posts: 3446
Joined: Thu Sep 27, 2007 7:12 pm

Post » Wed Sep 08, 2010 7:50 pm

Thanks very much for your posts and considerations everyone!

Just so you all know, this is how I like to do things- I hate feeling like I'm making someone do all the work for me, so I usually TRY to learn things myself. But scripting is a little over my head, so I'll read about it for a while on the wiki, but if someone does help me with this mod then I would also like explanations of how they did it, such as a step-by-step process of relevant things I need to know about scripting this sort of thing.

I'll do some research and type up a chart of specific effects I want to kick in. Some of these might not be possible to script, so I'll alter things accordingly. I kind of want the Medallion to do a lot more then this, but I do have a feeling this might be a bit game-breaking, oh well. It adds to roleplaying, and that's what's important in my book.

I might also add more later.

All spells are stacking- any number can be active at any given time.

Name of Spell: Blessing of Sight
Description: This Medallion gift is a very powerful version of Night Eye. It is the most common Medallion spell for Kaikuro.
Conditions: Activates at nighttime or in a dungeon (not just any interior- has to be a dungeon). Will not activate if a light spell or a torch is being used.
Activation Chance and Duration: If there are no enemies nearby, activation chance is 50 percent upon entry into the dungeon or outdoors in nighttime. If there are enemies nearby, activation chance is 70 percent. It will not activate while you travel in the area, it has a chance of activation upon ENTRY. If combat is engaged, however, there is an 80 percent chance of it's activation. It lasts until the cell is exited or a torch is being used.

Name of Spell: Blessing of Awareness
Description: This Medallion gift is a very powerful version of Detect Life.
Conditions: Activates if there are enemies nearby.
Activation Chance and Duration: Has a 10 percent chance of activation when enemies are nearby. The chance increases as the number of enemies nearby increases, increases by 10 per enemy. The spell lasts for 1 minute or until combat is initiated.

Name of Spell: Blessing of Thorns
Description: This Medallion gift adds a Reflect Damage spell. (Can't remember if this is even a spell or if it's even a vanilla spell or not. Oh well.)
Conditions: Activates in combat.
Activation Chance and Duration: Has a 10 percent of activation for 5 seconds.

Name of Spell: Blessing of Shield
Description: This Medallion gift adds a Shield spell.
Conditions: Activates in combat when health is below 70 percent.
Activation Chance and Duration: Has a 40 percent chance of activation.

Name of Spell: Blessing of Escape
Description: This Medallion gift creates a strong Feather effect, an Invisibility spell, and a medium-strength Fortify Speed spell.
Conditions: Activates if enemies are nearby and health is below 20 percent. Does not activate during combat- must be undetected for spell to kick in.
Activation Chance and Duration: Has a 50 percent chance of activation. This chance becomes 80 percent when health is below 10 percent. The spell lasts for 20 seconds.


And last but not least, this one is probably impossible, but probably the coolest thing about Kaikuro and his Medallion in the canon comic.

In the story the Medallion can charge his sword with an extremely powerful lightning enchantment when his life is in grave danger. This doesn't happen often, and the enchantment only lasts on the sword for one hit. Nor is it a one-hit-one-kill weapon. But it is a very strong lightning spell. Since I usually only have regular, non-enchanted weapons equipped, I am wondering if it is possible to have this last spell:

Name of Spell: Blessing of Lightning
Description: This Medallion gift makes whatever blade Kaikuro is currently using charged with a powerful Lightning enchantment.
Conditions: Activates in combat if health is below 30 percent.
Activation Chance and Duration: Has a 50 percent chance of activation. The sword becomes charged with lightning for one use. It has a 10 minute cooldown.
User avatar
Elizabeth Lysons
 
Posts: 3474
Joined: Fri Feb 02, 2007 7:16 am

Post » Wed Sep 08, 2010 5:47 pm

I can help a bit:
@Blessing of Sight:
I don't know about the "have to be a dungeon" thing, maybe you have to set a lot of ifs and elses specifying the name of the cell in each? As for "must be nighttime", now that I can help you. I've made an ability that grants blessing only during the day. You simply have to check the Global Variable GameHour.

GameHour by itself is a float, with 2 numbers after the dot, goes from 0.00 at 12.00 a.m. to 24.00 at 12.00 p.m. UESP states daytime is between 6.00 until 20.00, so just set that your script checks the gamehour, if it is past 20.00 or is before 6.00, the script will begin. My ability does exactly the opposite

As for "if enemies are nearby", I can't help you :shrug: I don't know about it, there is IsActorDetected to see if you're being detected or not, but friends can detect you... maybe http://cs.elderscrolls.com/constwiki/index.php/GetShouldAttack article will help. It tells you how to detect if an actor is hostile towards another, should prove to be useful

As for upon entry, just add a check variable upon entry and make sure not to reset it until being outside again

@Blessing of Awareness:
As for the number of enemies, I guess you can use a reference variable and everytime an actor is checked being in combat against you, add one to it. I remember CS wiki says you can refer to a local variable within another script by using reference

@Blessing of Thorns:
What do you mean 10% activation? Every second if not already affected the spell has 10% chance to activate?

@Blessing of Shield:
I know about getBaseActorValue and getactorvalue. I tried to use it like this: getactorvalue * 100 / getbaseactorvalue (each value is within a variable being set before, each refers to health) but... well... I've yet to see it work, because I have constant 30 health regen and my health seems to always at 100%...

@Blessing of Escape:
Use that IsActorDetected. Although, to be frank, I've never used one and don't know how to :shrug:

@Blessing of Lightning:
use GetSecondsPassed and set it to 600 before starting to act again. About that 30% health, the getactorvalue I described above might do the trick, but I don't know... as for being struck once, maybe an activator and OnHit block can do the trick?
User avatar
Ownie Zuliana
 
Posts: 3375
Joined: Thu Jun 15, 2006 4:31 am

Post » Wed Sep 08, 2010 9:18 am

Well now, this is a challenge! I'd be glad to lend my help. I know you're not very script-savvy, so I'll try to make this step-by-step.

Setting Up:
First of all, you should make all the spells you want to be added to the player via the medallion script effect. So you'd have a list of spells like this:

kaiSightSpell
kaiDetectSpell
kaiThornSpell
kaiShieldSpell
kaiEscapeSpell

One way to add these to the player under the conditions you desire requires us to utilize a script attached to the medallion eye; this script will check for the conditions under which the player may gain these blessings each time it is run. I presume that Kaikuro's medallion is an equipped item, so I think your best bet is to make an enchant with a constant ability script effect and attach it to the item. This way, the script will only run while the player has equipped the medallion. This post is only going to go over the NightEye blessing, which is probably one of the most complicated ones on there, and requires a few more things for us to do. The main thing I'm seeing is that you want your spells to activate differently depending upon how many nearby hostiles there are, so once we get that mechanic out of the way, the rest will come easily. Make sure your kaiSightSpell is an Ability type with NightEye on self.

One way I've found for successfully detecting nearby enemies is using an invisible reference object to cast a large area spell on the player, which would also affect any entities in the surrounding area.

Step One: Detecting Enemies via a Scripted Spell
-Make a spell called kaiDetectEnemiesSpell
-Check the boxes for "Disallow reflect/absorb" and "Area Effect Ignores LOS"
-Add a script effect that has a range of, say, 2000, and a duration of 1. Make sure "effect is hostile" is NOT checked

The script we will attach to this will run for each target hit by the area spell, which means any entity within the 2000 unit range of the player (including the player). We will make this script determine if the reference it's running on will attack the player; each time this returns true, it will increment a variable that we will read from our main script. We need to make a global variable; one way is to add one via Gameplay>Globals in the CS, but let's make it a quest variable, because that's how I roll...

Step Two: A Global for Nearby Enemies
-Make a new quest, call it Kaikuro
-Keep "Start Game Enabled" checked
-Make a new script, Type: Quest, and attach it to the Kaikuro quest
Scriptname KaikuroGlobalsshort nearbyEnemies

Easy! This just holds the variable nearbyEnemies for us. We can change it from other scripts by calling it as Kaikuro.nearbyEnemies (Questname.Variablename)

Step Three: The Detect Enemy Spell Script
-We need to add a script the kaiDetectEnemiesSpell script effect; for now it does nothing
-Make a new "Magic Effect" type script, and plug in the following:
Scriptname KaiDetectEnemiesSpellScriptref selfBegin ScriptEffectStartset me to GetSelfif ( me == Player)	returnendifif ( me.GetShouldAttack Player == 1 )	set Kaikuro.nearbyEnemies to ( Kaikuro.nearbyEnemies + 1 )endifEnd

For each entity this runs on, GetShouldAttack will tell us if they want to harm our player. If so, the global we just created via the Kaikuro quest will be incremented by 1. Since this will also run on the player, we have to make sure it does nothing.

Step Four: The Caster Reference
-Now we have to make a reference that will cast this upon the player on demand. Make a new cell, call it kaiTestCell or something, it doesn't matter.
-Look under World Objects > Activators for something called ARSwitch01 and put one into your new cell
-Double click the object in the render window
-For the Reference ID put "kaiCastRef"
-Check both "Persistent Reference" and "Initially Disabled"

Now, the purpose of this is so that we can use it to cast any spell on the player, such as your blessings, and also our recently created kaiDetectEnemiesSpell simply by moving it to the player in our main script. But that's coming up, so don't worry just yet.

Step Five: The Main Script!
Yay! We made it finally to where we began: the medallion's enchantment. This enchant needs to have an Apparel script effect.
-Make a new script, 'Magic Effect' type again
-And here's the code (get ready):
Scriptname KaikuroMedallionEffectsshort checkSightshort activateSightshort sightChanceshort checkHostilesshort randomPercentfloat timerBegin ScriptEffectUpdate;when the timer is active, the script is haltedif ( timer > 0 )	set timer to ( timer - GetSecondsPassed )	returnendif;This casts the spell that will detect nearby enemies;it calls a timer so that we have a buffer of sorts to make sure all nearby enemies are accounted for before continuingif ( checkHostiles == 1 )	set checkHostiles to 0	kaiCastRef.MoveTo Player, 0, 0, 5	kaiCastRef.Cast kaiDetectEnemySpell Player	set timer to 1	returnendif;==================;     SIGHT;==================;This detects when player changes cells.;It removes NightEye if its enabled, else it will check to see if it can be turned on.if ( IsPlayerMovingIntoNewSpace == 1 )	if ( Player.IsSpellTarget kaiSightSpell == 1 )		Player.RemoveSpell kaiSightSpell	else		set checkSight to 1	endifendif;This removes the NightEye if the player uses a torch or a light spellif ( Player.IsSpellTarget kaiSightSpell == 1 )	if ( Player.IsActorUsingATorch == 1 ) || ( Player.HasMagicEffect LGHT == 1 )	Player.RemoveSpell kaiSightSpellendif;This checks to see if NightEye can turn on.;First it checks if the player is using a torch or a Light spell,;Then if the player is inside or it's night time, begins to check for nearby enemies &;also set the flag to begin activation, but first we have to check for enemies.if ( checkSight == 1 )	set checkSight to 0	if ( Player.IsActorUsingATorch == 0 ) && ( Player.HasMagicEffect LGHT == 0 )		if ( Player.IsInInterior == 1 )			set checkHostiles to 1			set activateSight to 1			return		elseif ( GetCurrentTime <= 6 && GetCurrentTime >= 20 )			set checkHostiles to 1			set activateSight to 1			return		endif	endifendif;Activates the NightEye spell based upon random chance, checked against the sightChance var, which is dependent upon whether or not enemies are nearbyif ( activateSight == 1 )	set activateSight to 0	set randomPercent to GetRandomPercent	if ( Kaikuro.nearbyEnemies > 0 )		set sightChance to 70	else		set sightChance to 50	endif	if ( randomPercent <= sightChance )		Player.AddSpell kaiSightSpell	endif	set Kaikuro.nearbyEnemies to 0endifEnd

Now, I've included some comments to help you understand this. The basic logical flow of this script starts under the headline for SIGHT and will be as such:
-Checks to see when player changes cells
-Checks conditions for NightEye activation
-Runs the detect enemy spell to get nearby enemies
-Activates the chance to get NightEye

As of right now, this does not have the mechanic for activating upon combat. We can always add that later, but for now, I figured this is the main mechanic you're looking for.

This is a horribly complicated thing to take in at once for a beginner scripter, so I'll let you ask the questions now, as I'm sure you have a ton.
User avatar
Maeva
 
Posts: 3349
Joined: Mon Mar 26, 2007 11:27 pm

Post » Wed Sep 08, 2010 4:49 pm

Hello and thanks for your in-depth guide!

Before I read more deeply into it, I'm going to go ahead and say that unfortunately, no, the Medallion is not an equipped item. I was planning on making it that way before, but I decided to attach it to Kaikuro as part of his race. The Medallion is added directly onto his mask mesh. The mask is made as part of his race so it would conformulate to his face and I'd have enough slots to work with.

I'll sit back and read through what you typed up and try to put things together in my mind. I'm not ENTIRELY new to scripting, but I am for Oblivion. I once made a rather complicated script in Morrowind (with the help of Fliggerty) a while back.
User avatar
james tait
 
Posts: 3385
Joined: Fri Jun 22, 2007 6:26 pm

Post » Wed Sep 08, 2010 9:02 pm


Before I read more deeply into it, I'm going to go ahead and say that unfortunately, no, the Medallion is not an equipped item. I was planning on making it that way before, but I decided to attach it to Kaikuro as part of his race. The Medallion is added directly onto his mask mesh. The mask is made as part of his race so it would conformulate to his face and I'd have enough slots to work with.


Ah! If that's the case, then you simply make the main Medallion Effects Script a racial ability for your Kaikuro.

Also, great work on the mask itself! I never got involved, but I watched your progress from concept to finish, and I'm pretty impressed! Feel free to ask me any questions regarding that script I posted. Keep in mind, everyone, that it is a rough, untested, script, but it should work sans minor syntax errors that I might've missed.
User avatar
sarah simon-rogaume
 
Posts: 3383
Joined: Thu Mar 15, 2007 4:41 am

Post » Wed Sep 08, 2010 11:03 am

Thanks for taking your time to help. :D

Alright. The first issue I came to involves creating the "kaiDetectEnemiesSpell".

You said to add a "range" of 2000 and a "duration" of 1. Duration is fine, but "range" is listed as either Self, Target or Touch. If Touch or Target is selected I can modify the "area" box, but the box is grayed out when "range" is on Self.

What do I do?

I've also went ahead and tried to create the Enemy Detection quest. I created the quest and created a new script and pasted what you wrote into it. The script type is "Quest".

However, I can't seem to attach it to this quest. In the 'script' box in the drop down menu I can't find "KaikuroGlobals" listed in there even though it IS saved and I can bring it up in the scripts box.
User avatar
Patrick Gordon
 
Posts: 3366
Joined: Thu May 31, 2007 5:38 am

Post » Wed Sep 08, 2010 5:32 pm

Thanks for taking your time to help. :D

Alright. The first issue I came to involves creating the "kaiDetectEnemiesSpell".

You said to add a "range" of 2000 and a "duration" of 1. Duration is fine, but "range" is listed as either Self, Target or Touch. If Touch or Target is selected I can modify the "area" box, but the box is grayed out when "range" is on Self.

What do I do?

I've also went ahead and tried to create the Enemy Detection quest. I created the quest and created a new script and pasted what you wrote into it. The script type is "Quest".

However, I can't seem to attach it to this quest. In the 'script' box in the drop down menu I can't find "KaikuroGlobals" listed in there even though it IS saved and I can bring it up in the scripts box.


Let me clarify, as I'm sure I forget a few details. The kaiDetectEnemiesSpell should be set to "Target", meaning its a ranged cast. Then you can set a range. The spell is cast on you by the invisible reference object kaiCastRef, as if another NPC was casting the spell on your character. This is done simply with the following two lines:

kaiCastRef.MoveTo Player, 0, 0, 5kaiCastRef.Cast kaiDetectEnemiesSpell Player

The first line moves the reference object to the player's current position, and just a little up on the Z-axis so it's basically 'inside' you. The second line tells the reference to cast the spell kaiDetectEnemiesSpell on the player. In-game it's not visible and works totally on the down-low. Since the spell has area effect, it will also affect any NPCs or creatures within the set range, including the player. The script attached to the spell should be the 'kaiDetectEnemiesSpellScript' which is of type: Magic Effect.

For your quest, simply named 'Kaikuro', make sure you've made yet another script simply defined as the 'KaikuroGlobals', type: Quest. From my original post, you should have made the following three separate scripts:

KaikuroGlobals - we'll use this for storing variable information that may need to be used by all of our scripts. This is attached to the Kaikuro quest
kaiDetectEnemiesSpellScript - used solely for the purpose of detecting enemies by attaching it to the kaiDetectEnemiesSpell.
KaikuroMedallionEffects - This is the main script, which should be attached to an Ability type spell with a script effect on self, added to your custom Kaikuro race. This will serve as our main base for detecting all triggering conditions and actually activating all the magic effects. It is constantly active while playing any Kaikuro race character.
User avatar
GLOW...
 
Posts: 3472
Joined: Thu Aug 03, 2006 10:40 am

Post » Wed Sep 08, 2010 12:55 pm

Alright. Well, that's my issue is that I don't really know how to attach the "KaikuroGlobals" script to the quest. I tried to, but in the 'script' drop down menu in the quests dialog box it won't let me select "KaikuroGlobals". I'm not sure why.

Another issue- I tried to save the "KaiDetectEnemiesSpellScript" and it brought me an error, "Unknown variable: "me" .

I'm not sure what this means, since apparently you defined "if ( me == Player)" in the script, so I'm not sure what the issue is.
User avatar
Reven Lord
 
Posts: 3452
Joined: Mon May 21, 2007 9:56 pm

Post » Wed Sep 08, 2010 11:17 am

I don't know what the problem is for the quest script. The only thing I can think of that would make the script not show up in the quest drop-down menu is that you didn't select "Quest" from the drop-down menu in the script editor for that specific script; it has to be Quest type for it to be selectable for the quest.

As for the other issue: a syntax error on my part! Replace the line at the top "ref self" with "ref me" :) That's just what happens when I don't compile scripts hehe. This is just a reference variable that is set to the actor which this script runs on, which is any creature or NPC within range of the player. Since the player is also an actor, and this script will also run on the player, the first block starting with If ( me == player ) just makes sure that nothing happens when this script runs on the player.

Anyway, please double check your KaikuroGlobals script to make sure its a Quest script.
User avatar
!beef
 
Posts: 3497
Joined: Wed Aug 16, 2006 4:41 pm

Post » Wed Sep 08, 2010 6:19 pm

Yes, scriptname "KaikuroGlobals" is selected as a "quest" type script but I can't attach it. I don't know why. O.o I'll keep looking.

Also, there's a "Missing Variables" error that came up as well for the DetectEnemies script. "Unknown variable or function 'nearbyEnemies'. Did I overlook something?

Also gives an error for line 14, "Missing variable name in set command".

Sorry I'm not much help, I can't figure out what's going on due to my lack of experience.

EDIT: Oop! I don't know WHAT I did, but I clicked those ellipses next to the drop-down menu, opened KaikuroGlobals, hit "save", and suddenly I was able to pick it from the scripts drop-down menu. Weird. Well, that problem is taken care of. :P
User avatar
Kelsey Hall
 
Posts: 3355
Joined: Sat Dec 16, 2006 8:10 pm

Post » Wed Sep 08, 2010 2:48 pm

Haha, ah yes, great! :D
And that should fix the missing variable name in the other script, for how can it set the variable in the quest script it it's not attached to the quest? Indeed! Let me know how the nighteye works out, if it gets enabled when entering new cells and during the right conditions. For now, it should only be triggered by loading a new cell that's inside, or outside and at night (no torch / light spell). One way to test is to add debug messages. Like, add one in the block for "activateSight" where the actual spell is added, to let you know that it tried to add the spell; as we're dealing with random chance here, it's helpful to know when the script runs that particular block even when the spell isn't added.
User avatar
ladyflames
 
Posts: 3355
Joined: Sat Nov 25, 2006 9:45 am

Post » Wed Sep 08, 2010 6:26 am

Alright. I believe this is the last issue, and probably some syntax issues and I'd fix them myself, but I'm not sure how.

Error 1: "Invalid If/EndIf block structure on line 83"

Error 2: "Script 'KaikuroMedallionEffects', line 44: Mismatched if/else/endif block starting on line 44."

Error 3: Script 'KaikuroMedallionEffects', line 44: "Mismatched if/then/else block."

there WAS an error for 'kaiCastRef.Cast kaiDetectEnemySpell Player", which I easily fixed because I named the Detect Enemies spell "kaiDetectEnemiesSpell" instead of "DetectEnemy", so I was able to fix that one.
User avatar
Nathan Maughan
 
Posts: 3405
Joined: Sun Jun 10, 2007 11:24 pm

Post » Wed Sep 08, 2010 7:15 am

Most probably an elseif block that you mistyped as else if, note the space. I had the same problem once, turns out it was that
User avatar
TOYA toys
 
Posts: 3455
Joined: Sat Jan 13, 2007 4:22 am

Post » Wed Sep 08, 2010 6:21 am

Yarr, another syntax error on my part. I missed an 'endif' for the second block after the 'SIGHT' header comment. Haha, I guess I should be following along in my own .esp
So I put it together real quick and there's no more syntax errors. Huzzah. But we still gotta check it out functionally.

EDIT: Yeah, I just tested it out and we have an issue: IsPlayerMovingIntoNewSpace only works in a MenuMode block, which can't be run in a Magic Effect script. We'll have to incorporate it into the quest script, which means basically shifting the main script from the spell to the quest script. I tried this out, and still can't get anything to trigger. I've never used this function before, so I have no idea if I'm using it right or not, or if there's any better ways to do this sort of thing. Here's the new quest script I got:

Scriptname KaikuroGlobalsshort checkSightshort activateSightshort sightChanceshort nearbyEnemiesshort checkHostilesshort randomPercentfloat timerfloat fQuestDelayTimeBegin GameModeif ( fQuestDelayTime != .1 )	set fQuestDelayTime to .1endifif ( timer > 0 )	set timer to ( timer - GetSecondsPassed )	returnendifif ( checkHostiles == 1 )	set checkHostiles to 0	kaiCastRef.MoveTo Player, 0, 0, 5	kaiCastRef.Cast kaiDetectEnemiesSpell Player	set timer to 1	returnendif;==================;     SIGHT;==================if ( Player.IsSpellTarget kaiSightSpell == 1 )	if ( Player.IsActorUsingATorch == 1 ) || ( Player.HasMagicEffect LGHT == 1 )		Player.RemoveSpell kaiSightSpell	endifendifif ( checkSight == 1 )	set checkSight to 0	if ( Player.IsActorUsingATorch == 0 ) && ( Player.HasMagicEffect LGHT == 0 )		if ( Player.IsInInterior == 1 )			set checkHostiles to 1			set activateSight to 1			return		elseif ( GetCurrentTime <= 6 && GetCurrentTime >= 20 )			set checkHostiles to 1			set activateSight to 1			return		endif	endifendifif ( activateSight == 1 )	set activateSight to 0	set randomPercent to GetRandomPercent	if ( nearbyEnemies > 0 )		set sightChance to 70	else		set sightChance to 50	endif	if ( randomPercent <= sightChance )		Player.AddSpell kaiSightSpell	endif	set nearbyEnemies to 0endifEndBegin MenuModeif ( IsPlayerMovingIntoNewSpace == 1 )	if ( Player.IsSpellTarget kaiSightSpell == 1 )		Player.RemoveSpell kaiSightSpell	else		set checkSight to 1	endifendifEnd

User avatar
Symone Velez
 
Posts: 3434
Joined: Thu Sep 07, 2006 12:39 am

Post » Wed Sep 08, 2010 5:47 pm

Could you re-post the code for me so I know where to put the 'endif'? I'm afraid I'm uncertain as to where to place it in the code.
User avatar
Del Arte
 
Posts: 3543
Joined: Tue Aug 01, 2006 8:40 pm

Post » Wed Sep 08, 2010 1:56 pm

Hm, so at the moment this script doesn't trigger correctly? Hm. Sorry I can't be of any help here, but thanks for trying to get it to work for me.

Also, just so I know ahead of time, what exactly must I do in order to attach this to the Kaikuro race? Or does it run anyway because it is a quest?
User avatar
Danial Zachery
 
Posts: 3451
Joined: Fri Aug 24, 2007 5:41 am

Post » Wed Sep 08, 2010 8:54 am

Just an update- I still have yet to try and test this in-game because I'm uncertain as to whether or not it's properly 'linked' to the character and HellsWake seemed a bit concerned about it's functionality in the first place. Can anyone give me some thoughts on the script, look it over and give me some thoughts on how to put it together more efficiently? I haven't tried to test it in-game yet because I'm still uncertain as to how to attach it to the race. Sorry if this is a stupid request, this is just going over my head a bit.
User avatar
Rachel Tyson
 
Posts: 3434
Joined: Sat Oct 07, 2006 4:42 pm


Return to IV - Oblivion