Torchmodders

Modding => Modding Questions => Topic started by: Haxley on February 15, 2015, 07:02:20 pm


Title: After using a spell...
Post by: Haxley on February 15, 2015, 07:02:20 pm
After using a spell scroll to learn a spell, is there a way to trigger you receiving the same spell back when you un-learn it?

Like, say I equip a passive spell, and want to 'upgrade' it, is there a way I can make it give me back the scroll when I remove it from my spell list?
Title: Re: After using a spell...
Post by: gytfunke on February 15, 2015, 10:32:59 pm
Very unlikely, but were I determined I'd try looking at the UI pieces associated with the spell inventory page and the like.
Title: Re: After using a spell...
Post by: Haxley on February 16, 2015, 09:37:20 am
I'm going for maximum compatibility on my mods, so much like the GLOBALS.dat that I was going to add, I'm probably going to steer away from editting UI pieces. If I throw a Globals.dat in, it'll cause a small rift in my compatibility with Synergies, and the UI pieces may interfere with something down the line.

I was hoping there was a triggerable I could throw in or a line I could add in the skill itself.

I was also curious in trying to make a spell that creates an item when you cast it

Thanks for your suggestion though, Gyt! :D
Title: Re: After using a spell...
Post by: gytfunke on February 16, 2015, 09:47:36 pm
For the passive skill scrolls (and only the passives), you might be able to do something like that, Haxley.  EVENT_END fires when a Passive skill is unlearned.  EVENT_END doesn't like to fire .layouts, though, which is the only way I can think of to possibly spawn an item.  So, you'd have to use EXECUTE_SKILL on EVENT_END, which I think works (if not, an Affix with CAST SKILL should work).

In any case, you should open up the .layout editor and see if you can attach a UNIT SPAWNER to a skill's layout that spawns an item.  If so, then you should be able to do this (again, just for the passives).
Title: Re: After using a spell...
Post by: TwinkleToes on February 16, 2015, 10:23:23 pm
not 100% sure, but i agree with what gyt says use EVENT_END with execute skill
however
make sure you test it on warp outs, zone changes and on character deaths, since EVENT_END will trigger with those actions too.
Title: Re: After using a spell...
Post by: gytfunke on February 17, 2015, 08:47:26 am
make sure you test it on warp outs, zone changes and on character deaths, since EVENT_END will trigger with those actions too.

Right, it could possibly litter the world with spell scrolls.  I think there are a few other things that will cause an EVENT_END, such as leveling up.

A possible workaround for applying this to active skills as well is the 'Skill Required' property in the skill editor.  You can input the NAME string of one skill into another to require the caster to know that spell before the skill can be cast.  Since you're removing the scroll skill, then wanting the item-creation skill to fire only if you no longer have access to the scroll skill, you'll need to finagle it to get a negative requirement.  BUT, this means you can refund scrolls even for active skills...

It's complex, but I might suggest this:

Hidden Passive Controller

This uses a passive skill to simulate a negative requirement.  The negative requirement skill will be a hidden passive skill (https://www.youtube.com/watch?v=z0oi-C5eHdU) which means you'll have to attach this to every possible class you want to be compatible with the mod.  This drastically decreases your mod's compatibility with custom classes unless you find some sort of UI or level layout workaround.  You'll also have to create one of these for each and every spell scroll, but cloning them should be fairly easy once you have a working template.

In any case, the negative requirement skill will hold the Skill Required property.  It will also be a 'always on' passive skill.  So, if the spell scroll skill is learned, the skill is ON.  If the scroll is unlearned, or hasn't yet been learned, the negative requirement skill will be turned OFF (EVENT_END).  So, you would just need to follow the EVENT_END -> EXECUTE_SKILL setup described above, but place it on this passive instead of the original spell scroll skill.  And yes, you'll need an 'item-refund skill' that actually fires on this passive's EVENT_END.

I don't think this will fix the possibility of littering the world with spell scrolls, though.
Title: Re: After using a spell...
Post by: TwinkleToes on February 17, 2015, 10:45:23 am
Quote
This uses a passive skill to simulate a negative requirement.  The negative requirement skill will be a hidden passive skill which means you'll have to attach this to every possible class you want to be compatible with the mod.  This drastically decreases your mod's compatibility

ehh cant you just add this hidden passive skill to also be learned along with the main skill, you can add an extra affix within the event start of the main skill to learn the hidden passive and bam, that's that, if you unlearn the skill the hidden passive sticks to the character.

an elegant solution would be to make the hidden passive give a stat,
that stat is then used to prevent(STAT_REQ) the affix which gives you the hidden passive itself to fire on the event start of the main skill
Title: Re: After using a spell...
Post by: Haxley on February 17, 2015, 11:11:54 am
I'm still getting used to skills so honestly that sounded kinda like gibberish to me.

I sorta understand what you guys are saying but I can't seem to translate it into what I'm trying to do.

Twink, if this makes sense to you is there any way you could explain it or make a base template that I could study to try and make sense of it?
Title: Re: After using a spell...
Post by: TwinkleToes on February 17, 2015, 11:55:14 am
yea i get all of that, ill have to recreate your conditions 1st though, like making a spell scroll, then i can fully grasp how to code this and put it out as a template. i also have a solution in my head that would fix the warpout/zoneout problem if it ever comes up during testing.
Title: Re: After using a spell...
Post by: gytfunke on February 17, 2015, 03:57:11 pm
an elegant solution

Yeah, this sounds way better.