Jump to content

Trouble saving a script.


Kahner

Recommended Posts

Hello, everyone. So I'm trying to make a mod that will make it so vampires are afflicted with a damage fatigue effect while in the sun as opposed to taking sun damage. I searched around for something like this and was surprised to see that no one had made it yet. Anyway, I decided to try to learn how to script and make it myself, but I'm running into a couple of problems. First off, I've removed the sun damage component from the vampirism 50 ability, and I've made a spell that is damage fatigue for zero duration (zero duration means indefinitely, right?) on self that should be given to the player with my script. The script is as follows (I'm sure it's horrible and broken, but eh, I tried):

Scn Vampirism50mod

Begin GameMode
if 
getiscurrentweather obliviondefault = 0
getiscurrentweather oblivionelectrical = 0
getiscurrentweather oblivionmountainfog = 0
getiscurrentweather oblivionsigil = 0
getiscurrentweather oblivionstormoblivion = 0
getiscurrentweather oblivionstormtamriel = 0
getiscurrentweather oblivionstormtamrielmq16 = 0
getcurrenttime >= 6
getcurrenttime <= 20
player.addspell, sunfatigue50
endif
end

 

What I was trying to do here is check if the player is in Oblivion and if the time is between six AM and eight PM. Assuming the player is not in Oblivion, and it is during that time then the player should be given the spell. I know that I'd have to make another script to remove the spell when those parameters change, but at the moment I'm just concerned with making this work. What happens in the CS is when I try to save it it doesn't give me any error messages, but simply refuses to save. I'll click the save button and nothing happens, I'll click the red X button and it asks if I want to save and I click yes and it does nothing, if I click no it exists without saving. I'm assuming something in the way I wrote it is causing this, but I don't know what. Any and all help is appreciated, as I really have no idea what I'm doing.

Link to comment
Share on other sites

I'd suggest trying this code instead. It will check if the player is in an oblivion cell and if the time constrictions are met and then add the spell, otherwise it will remove the spell. Your main problem is that you had multiple IF conditions without using the "&&" (and) code or putting them into separate IF check blocks. Also you don't need a coma after "player.addspell" I think this may work, but I;m no expert and I didn't test it, but I think it's a much cleaner and elegant way to try.

 

 

scn Vampirism50mod

Begin GameMode

if getincell oblivion == 0 && if getcurrenttime >= 6 && getcurrenttime <= 20
    player.addspell sunfatigue50
else
    player.removespell sunfatigue50
endif

end

 

Oh and as far as why it wasn't saving? I dunno, other than to say maybe it was dropping the prompt box with the errors into the background and you couldn't see it or maybe it's just one of those wonderful CS bugs we all have to cope with.

Edited by icecreamassassin
Link to comment
Share on other sites

Thanks! That does look like it would do what I'm trying for in a much more succinct manner. I tried to use the && operator thing but I think I formatted it incorrectly as the editor always told me something about an expected end of line when I used it. I'll try your script and see if it works. If anyone can give me any other suggestions I would really appreciate it. Ultimately I'd like to make the mod damage your endurance in the same way sun damage damages health, like, less when it's cloudy or when you're underwater. I noticed that there is an OBSE function "getweathersundamage" which looks like it could be useful in this, but I'm not really sure how to use it. I imagine I'd need to make a query on what the current weather is, and then have the sun damage funtion use whatever the result of the weather function was and then... I don't know. Anyway, thanks for the help.

 

Edit: Just tried that script and "oblivion" isn't a valid perameter for the cell. I suppose I should just list every oblivion cell in the game? I don't think that should be terribly hard since there are only seven (?) different instances of Oblivion, minus any unique quest ones.

Edited by Kahner
Link to comment
Share on other sites

Oh wait durrr I'm dumb... it should be "if player.getincell oblivion == 0" forgot the actor call :P

 

 

the getincell function checks any and all cells which START with the chosen cell name so if you used "getincell oblivionRD001" it would only apply when in oblivionRD001 whereas if you left it as "oblivion" it would apply to onblivionRD001, oblivionRD002, etc etc.

 

if you look at the AI package for Jollring (unbacannos servant) the condition for him to come and find you is that you are in a city basically, the calling cell (getince0ll) is "choral" and "Bruma" etc, and not all the many separate segments

 

EDIT: Opps wait a sec I misread the getincell parameter it must be an interior cell so use the getworldspace parameter instead

 

so something like this:

 

scn Vampirism50mod

Begin GameMode

if getinworldspace oblivionRD001 == 0 && getinworldspace oblivionRD002 == 0 && getinworldspace oblivionRD003 == 0 && getinworldspace oblivionRD004 == 0 && getinworldspace oblivionRD005 == 0 && getinworldspace oblivionRD006 == 0 && getinworldspace oblivionRD007 == 0 && getinworldspace oblivionMQKvatch == 0 && if getcurrenttime >= 6 && getcurrenttime <= 20
    player.addspell sunfatigue50
else
    player.removespell sunfatigue50
endif

end

 

you may have to nest the condition checks because of the script line length limitation by doing this:

 

if getinworldspace oblivionRD001 == 0 && getinworldspace oblivionRD002 == 0 && getinworldspace oblivionRD003 == 0 
     if getinworldspace oblivionRD004 == 0 && getinworldspace oblivionRD005 == 0 && getinworldspace oblivionRD006 == 0 
           if getinworldspace oblivionRD007 == 0 && getinworldspace oblivionMQKvatch == 0 && 
                  if getcurrenttime >= 6 && getcurrenttime <= 20
                           player.addspell sunfatigue50
                   else
                           player.removespell sunfatigue50
                  endif
            endif
       endif
endif
end

Edited by icecreamassassin
Link to comment
Share on other sites

I got the script working, but I ended up being discouraged at how many actual cells of Oblivion there are (a whole lot more than I thought), so I replaced the incell thing with the currentweather one, which seems to work fine, aside from being overly long. The entire mod works fine mechanically, but there is one thing that really annoys me: the Sun Fatigue spell that I have put on the player that is classed as an ability makes a buff icon show up in the top right of the screen, and since it's a persistent thing it's always there. Is there a way I can get rid of this, or perhaps to get the same general effect without this icon? Thanks for the help.

 

Nevermind, I figured it out. I simply classed it as a disease. Sure it can be removed by cure disease things, but it just gets reapplied so that's not really an issue.

Edited by Kahner
Link to comment
Share on other sites

That's kind of odd that the ability would show an icon. Make sure that you not only have it classified in the magic ability pane but also that you select "ability" from the drop down menu. It shouldn't have that icon appear. Also make sure that none of the effects for the ability have a duration, that might be why it's showing up
Link to comment
Share on other sites

I think the problem was stemming from it incorrectly having a duration like you said. I've now got the entire mod all set up so that it adds varying levels of the fatigue debuff based on vampirism level. One of the things that I didn't prepare for was that you'd retain the earlier version of the debuff as well as get the more potent version if you aged, so I changed the scripts to remove all the other versions and that's working fine. The debuff puts a drain fatigue on the player, which I guess just makes it so that they have a lower maximum fatigue than usual while I was going for an actual slower fatigue regen. I should try damage fatigue instead, I guess? I also tried to mess with the fFatigueReturnBase variable, but couldn't figure it out. Oh well.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...