Black Arts Project scripting problems

Post » Sun Nov 18, 2012 3:44 pm

I'm working on creating a bunch of new spells, which will be ideal for blood mages, vampires and necromancers. I want to add a version of Equilibrium, which will use less health to convert in magicka. But i've thought of an idea, where i want all normal races to convert 15 health into 25 magicka. but if you are a vampire, convert 10 health into 25 magicka. See what i mean? Is there anyway you can do that? Ideally, I don't want to create 2 different spells, because that would just defeat the purpose.

Obviously, I've got to create a script to do it, but i have no experience on them, and basically no knowledge. Help! please!

This is what I have so far:

Scriptname equilibruimifvampireornot extends activemagiceffect
{When casting spell, magicka cost varies
depending on race (vampire)}

onSpellCast
{if player = vampire
magicka cost = 10;}
{if player = else
magicka cost = 15;}

and now im only getting this error

Starting 1 compile threads for 1 files...
Compiling "equilibruimifvampireornot"...
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\equilibruimifvampireornot.psc(5,11): no viable alternative at input '\\r\\n'
No output generated for equilibruimifvampireornot, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on equilibruimifvampireornot
User avatar
Sierra Ritsuka
 
Posts: 3506
Joined: Mon Dec 11, 2006 7:56 am

Post » Sun Nov 18, 2012 7:53 am

The curly braces are meant for comments, the compiler ignores statements within those braces. Get rid of the curly braces around your if statements first.

You should also define an actor variable called player then call Game.GetPlayer() and assign the result to your actor variable (player=Game.GetPlayer).

Your if statement should then be: if player.GetRace==whatever race you want, magika cost 10 else magika cost 15. You dont need the second if statement. Also = is used for assigning values and == is used to test the equality of two values. Thats all I can help you with at the moment.

You appear to have not yet obtained enough knowledge of papyrus to write scripts yet (to be honest neither have I). You need to read the papyrus primer on the creation kit wiki at least to have some idea how to write basic scripts.
User avatar
Matthew Barrows
 
Posts: 3388
Joined: Thu Jun 28, 2007 11:24 pm

Post » Sun Nov 18, 2012 12:03 pm

Your right to say I have no obtained enough information of papyrus, in fact this is my first ever script. Im going to read that wiki, see what i learn.
User avatar
alicia hillier
 
Posts: 3387
Joined: Tue Feb 06, 2007 2:57 am

Post » Sun Nov 18, 2012 4:46 am

1) You are missing Event, the parentheses/argument after onspellcast, and Endevent. If you look at the wiki entry for onspellcast, you'll see:
Syntax:
Event OnSpellCast(Form akSpell)

You should copy that exactly to your script, then add "Endevent" below it, and write your code between them. Also, in case you didn't know, the part at the end means that event is given the variable "akSpell" automatically, which is the base form of the spell that was cast, which you can refer to inside of that event.

2) But you can't use the OnSpellCast event in a script that extends activemagiceffect, because OnSpellCast is an ObjectReference event (See first line, your script extends activemagiceffect. Also, you have to use this kind of script for magic effects, so you will have to change the event, not what the script extends)

3) You should use "OnEffectStart" event instead:
http://www.creationkit.com/OnEffectStart_-_ActiveMagicEffect

With this, you do not even have to define the player, you can just do what you want on akTarget.

4) But wait, you want to change the magicka cost depending on the player's race. You can't do that because any event you can use is going to be triggered once you've already casted the spell and used the magicka. So what you should do is make the spell cost 0, and then in the OnEffectStart event, use http://www.creationkit.com/GetRace_-_Actor to check if the target is a vampire. It should be so m ething like:
    if akTarget.GetRace() != VampireRace		akTarget.damageAV("Health", 5)    endif    akTarget.damageAV("Health", 10)

Which also means you will have to make a property for VampireRace:
Race property VampireRace auto

I don't know if it's actually called vampirerace, or if the player race is changed to vampire when the player becomes a vampire. You might have to check in a different way.

The full thing would be something like:
Scriptname equilibruimifvampireornot extends activemagiceffectRace property VampireRace autoEvent OnEffectStart(akTarget, akCaster)	if akTarget.GetRace() != VampireRace		akTarget.damageAV("Health", 5)    endif    akTarget.damageAV("Health", 10)	akTarget.restoreAV("Magicka", 25)Endevent

Hopefully this helps though.

Edit: Oh sorry, I did it inversely originally, so that it was magicka into health. Fixed now.
User avatar
Sammie LM
 
Posts: 3424
Joined: Thu Nov 30, 2006 1:59 pm

Post » Sun Nov 18, 2012 10:23 am

Been doing the tutorials on the wiki, really helping me out.

Talking of helping me out though, my god you are brilliant. Now, im going to get to work on this, but im going to need some help since i've run into a wall. Both of my characters are vampires, and i cba to make a third, which is a different race, plus it would give me some feedback on some of the other spells ive done. Would you guys be interested in testing my mod? ill just send it your way somehow, and you can have a looksy. if you not interested no worrys.

But again, thank you very much for the help

EDIT: Btw, to use my mod you MUST have the Dawnguard dlc
User avatar
lillian luna
 
Posts: 3432
Joined: Thu Aug 31, 2006 9:43 pm

Post » Sun Nov 18, 2012 7:28 pm

Couldnt you just open the console and do "player.setrace nordrace" to test?
User avatar
Alyna
 
Posts: 3412
Joined: Wed Aug 30, 2006 4:54 am

Post » Sun Nov 18, 2012 6:15 pm

I suppose I could
User avatar
Ashley Campos
 
Posts: 3415
Joined: Fri Sep 22, 2006 9:03 pm


Return to V - Skyrim

cron