PDA

View Full Version : Yet Another Question


Mergon
March 5th, 2016, 06:25 PM
I have yet another question for the scripting masters out there.

I have an idea, but I don't know if it is feasible in HL.

Lets say I create a spell named 'Blank Spell'. Now I create a Features that selects a spell from a custom expression and has 'Blank Spell' bootstrapped.

Is it possible to transfer/copy the tags and fields from the selected spell to the bootstrapped 'Blank Spell'?

:confused:

ShadowChemosh
March 6th, 2016, 09:21 AM
Simply put 'yes'.

But I feel that by not describing what you are trying to accomplish I am not really able to help you to the full extent. I mean you can push and pull tags/fields from any Pick once its live on the hero.

The question becomes "why" and what are you trying to accomplish. If you post that with your question I and the LW staff can do a better job of helping you out. Maybe point you to a better solution or method.

Mergon
March 6th, 2016, 09:28 AM
Just fooling around. I was wondering if you could fake a spell by using somethign like 'Blank spell' and copying the fields and tags from a spell selected from a menu over to it.

For instance, I create a spell called 'Blank Spell'. It is a necromancy cantrip. Now I set up a custom expression that allows me to select from a list of all necromancy cantrips.

I then transfer the name, description, and appropriate tags over to 'Blank spell'.

This way I have 'Blank Spell' bootstrapped and make it into a clone of the secect cantrip.

Playing around with my Additional Magical Secret feature at the moment. Tryign to see why the scrips worked for you and not for me. :)

Aaron
March 7th, 2016, 08:59 AM
This is actually something I added not long ago to pathfinder, to handle some feats which select a spell to be enhanced with a certain Metamagic. The issue was that in the statblock we needed things to show in two different places but with different names in each.

The term in HL is "cloned spell", this is the XML for pathfinder, if you want to see it. Obviously you'll have to alter it for different field and tag names in 5e.



<!-- Cloned spell pick. Bootstrapped by a feat which then selects a spell,
then the morphing spell changes itself to mimic the chosen spell. -->
<thing id="spCloneSpl" name="Cloned Spell" compset="Spell">
<tag group="Helper" tag="Helper"/>
<tag group="Helper" tag="Static"/>
<tag group="Usage" tag="Day"/>
<eval phase="Final" priority="1000" index="2"><![CDATA[
~ The charges should match the root's charges.
doneif (isroot = 0)

perform root.setfocus

doneif (state.isfocus = 0)

field[trkMax].value = focus.field[trkMax].value
]]></eval>

<eval phase="First" priority="501"><![CDATA[
~ we need to set the root as our focus, and then draw all the information
~ to ourselves that normally defines a spell.
doneif (isroot = 0)

perform root.setfocus

doneif (state.isfocus = 0)

~ Define what we prepend our name with, based on the feat which bootstraps
~ us.
var prepend as string
var searchexpr as string

if (focus.tagis[component.BaseFeat] <> 0) then
prepend = focus.field[fModTarTxt].text & " "
endif

~ If a monster chooses the same spell for two or more of our bootstrapping
~ feats (like Talmandor) , it will modify the fModTarTxt on one to include
~ both feat's text, and add a Hide.Spell tag the other. If we're the spell
~ attached to the "Hide" copy, then hide ourselves.
if (focus.tagis[Hide.Spell] <> 0) then
perform assign[Hide.Spell]

~ Alternately, we could be like Galundri, and have our root suppressed by
~ the "Customize Racial Feats" button.
elseif (focus.tagexpr[Helper.FtHide & Helper.FtDisable & thing.skipprereq] <> 0) then
perform assign[Hide.Spell]
endif

~ Define which table we should appear on in the Spells tab
~ Spells which are attached to a spellcasting class will have SpellType
~ tags, and so we need do nothing here.
if (tagis[SpellType.?] <> 0) then
~ do nothing

elseif (focus.tagis[Helper.PsychLike] <> 0) then
perform assign[Helper.PsychLike]
perform focus.delete[Helper.PsychLike]
else
perform assign[Helper.SpellLike]
perform focus.delete[Helper.SpellLike]
endif

~ We can't use focus here, because our root's selection is pointing at a
~ thing, not a pick. So we have to repeatedly transition instead... :(
~ No target tag means transition through the chooser
if (focus.tagis[Target.?] = 0) then
~ In some cases, the root which bootstraps us selects the spell we copy
~ with the second selector.
if (focus.tagis[Helper.ClonSpSel2] <> 0) then
~ Can't do anything if we haven't chosen anything
doneif (focus.field[usrChosen2].ischosen = 0)

searchexpr = focus.field[usrChosen2].chosen.idstring
else
~ Can't do anything if we haven't chosen anything
doneif (focus.field[usrChosen1].ischosen = 0)

searchexpr = focus.field[usrChosen1].chosen.idstring
endif
else
searchexpr = focus.tagids[Target.?,"|"]
searchexpr = replace(searchexpr,"Target.","",0)
endif

var starttext as string
var finaltext as string

foreach thing in idlist searchexpr
~ Set our name
starttext = eachthing.field[name].text

call CommaFlip

field[livename].text = prepend & finaltext
field[sbName].text = lowercase(prepend) & lowercase(finaltext)

~ Set our description
field[CustDesc].text = eachthing.field[descript].text

~ Set our spell info
perform eachthing.pulltags[sLevel.?]
perform eachthing.pulltags[sSchool.?]
perform eachthing.pulltags[sSubschool.?]
perform eachthing.pulltags[sDescript.?]
perform eachthing.pulltags[sComp.?]
perform eachthing.pulltags[sCastTime.?]
perform eachthing.pulltags[Helper.?]
perform eachthing.pulltags[usesource.?]

field[sFocusCost].value = eachthing.field[sCompCost].value
field[sFocusDesc].text = splice(field[sFocusDesc].text, eachthing.field[sFocusDesc].text, "|")
field[sCompCost].value = eachthing.field[sCompCost].value
field[sCompDesc].text = splice(field[sCompDesc].text, eachthing.field[sCompDesc].text, "|")
field[sArea].text = splice(field[sArea].text, eachthing.field[sArea].text, "|")
field[sEffect].text = splice(field[sEffect].text, eachthing.field[sEffect].text, "|")
field[sTarget].text = splice(field[sTarget].text, eachthing.field[sTarget].text, "|")

field[sDuration].text = splice(field[sDuration].text, eachthing.field[sDuration].text, "|")
perform eachthing.pulltags[sDuration.?]

field[sRange].text = splice(field[sRange].text, eachthing.field[sRange].text, "|")
perform eachthing.pulltags[sRange.?]

field[sSave].text = splice(field[sSave].text, eachthing.field[sSave].text, "|")
perform eachthing.pulltags[sSave.?]

field[sResist].text = splice(field[sResist].text, eachthing.field[sResist].text, "|")
perform eachthing.pulltags[sResist.?]
nexteach
]]></eval>
</thing>

Mergon
March 7th, 2016, 09:01 AM
Thank you Aaron, I'll look at it asap. :)

I'm in the middle of several projects, all of them being annoying. :)

P.S. - Someone is bring me a computer ladens with spyware and virus to try clean up <sigh> . . .