Jump to content

Need Help making a scripted spell


Xcelcio

Recommended Posts

I recently found DesuChan's Persocom Reloaded and after playing it for a while I got an idea for a custom scripted spell.

 

I was planning to call it "Overload".

 

Probably the name gives it away, but what I want is a toggle-able spell (lesser power) that drains PC's health, magicka, and fatigue; and emits damage to the surrounding area. The magnitudes of the spell would be in direct proportion to the PC's health, magicka, and fatigue (probably modified by some constant).

 

I tired a bit for myself, but soon came crashing down :wallbash: . By using GetAV I can get the health, magicka, and fatigue, but I am unsure how to use that new variable as a spell magnitude. Probably SetNthEffectItemMagnitude ? But I have no idea how to use that function. :(

 

And secondly I am totally clueless on how to make this spell toggle-able/sustainable/maintainable (whatever it is called; so when i cast the spell the script would kick in and drain from PC and do the damage per [some amount of time (real time preferably)] until I re-cast the spell to deactivate the script or till PC dies.

 

Currently using OBSE 18betav4 and OBMM.

And I don't know whether this has something to do or not, but I don't use OOO.

 

Credits would go to anyone that helps. I don't mind being just an inspirator.

:thanks: anyway.

Link to comment
Share on other sites

Set each getAV stat to a variable

 

set self to getSelf

set stat1 to self.getAV Health

 

the "getSelf" line sets "self" to the person affected by the spell

 

Then combine the stats in a formula and then use the result to affect the spell's power.

 

set AllStats to (stat1 + stat2 + stat3)

SetNthEffectItemMagnitude AllStats UrSpell'sName

Link to comment
Share on other sites

Great, that explains bout the first part. Thx mate.

I'll be sure to mention your name.

 

Now I'm still lost about the second part. I was thinking something like "get spell status", is there such kind of function?

i.e. it returns 0 for spell currently not active and 1 for spell currently active (or vice versa)

so that I can set the script to kick in if it returns 0 and set it to stop if it returns 1 (again - or vice versa =p )

 

Anyone?

 

Thanks.

 

Edit: "get script status" would also work <-- self explanatory, just replace the spell with script in the above paragraph :)

Link to comment
Share on other sites

I tried GetPlayerSpell , but it returns the objectID of the player's current spell, not whether a specific spell is active or not.

It does what it says, but you want someone else of it as IsSpellTarget will say that an actor is affected. GetPleyerSpell just gets the spell the player current has set to cast.

 

I'm not sure what you want to do with. Spellscripts don't run when you cast them, as a Scripted Effect is just like the effect of any other magic. You are not on fire until the fire-ball hits you. The script will run from the target at the moment that one gets hit and the script/spell will end when the effects are worn off. IsSpellTarget is for spells you don't want to have a Magic-Effect-Script for or when NPC have a script that'll detect if the spell is cast on them.

Link to comment
Share on other sites

How 'bout making 1 spell and 2 abilities; The spell would have two script, one touch and one self - and one of the ability is for PC the other one is for enemies. If the respective actor don't have the ability when the spell is casted ( touch script would check enemies and self script would check self ) the respective ability - scripted damage - would be added to the actor(s), and vice versa.

 

You think its workable?

 

Thanks

Link to comment
Share on other sites

What you question is easy, but let me answer with another question. How do you plan to make a 'damage area' spell lasting until you toggle again the spell? I can be done, it's simply that I can't figure out how'd that perform. So is the player casting the spell (let's say, on touch) and then it inflicts damage as long as you wish to keep your stats drained? Or will it drain your stats progressively as you inflict damage to them?

 

You could make 2 different spells. The first one marked as 'power' or 'lesser power' that would be the one the player uses, with the effects that trigger once, and with another effect, scripted, that adds the second spell. If you mark that second spell to be an 'ability' instead of being cast-able it will add directly the constant effects it has. To remove them you can dispel those spells via dispel function. On the other hand you could make it all in one script, and simply dispel it on a second call. To make the distinction wen the spell is on/off, if you use two different spells it's easy, you ask self.hasSpell XXX and if true it's 'suffering' from the constant effects, otherwise is not. But if you make it all in one spell/one script you could simply add a variable check, create a quest, make a quest script without code, just declaring variables, and then check them each time you cast the spell:

 

On quest script

scn MyModQuestScript
short isSpellOn

 

Then on the spell script (assuming the ID of the quest is myModQuest

scn MyModSpellScript

begin ScriptEffectStart
if myModQuest.isSpellOn == 0
; here the code to activate it
else
; here the code to turn it off
; removeSpell, dispel, etc
endif
End

 

The wiki is full of tutorials about scripting! Take a look at them!

Link to comment
Share on other sites

I tried GetPlayerSpell , but it returns the objectID of the player's current spell, not whether a specific spell is active or not.

 

 

Seems IsSpellTarget is more likely to be it.

 

What do you think?

 

Thanks.

 

once you get the player's current spell, then you check if the spell matches the one you want.

 

set TheSpell to getplayerspell

if (TheSpell == YourSpell)
;then do this
else
 return

 

That says if this and that matches then do the next line, or else your don't do anything (return).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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