[ian-reeds-games] Re: getting skill/item/effect/point objects, given their unique IDs or IndexedName

  • From: "Craig Brett" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "craigbrett17@xxxxxxx" for DMARC)
  • To: ian-reeds-games@xxxxxxxxxxxxx
  • Date: Thu, 12 Mar 2015 19:39:04 +0000

Hi Victorious,

To be honest I'm a little confused as to what's actually going on here. So your flag takes in a comma-separated list of effects to apply, right? And you then want to see which are tile and which are unit ones.

So effect.AllFlags.get('tile') returns null all the time? How strange. Do any of the AllFlags things work for you?

Craig

On 10/03/2015 11:19, Victorious wrote:
Hi Craig,

Take a look at the following:

// checks for the existence of a specified flag on an effect. If present,
the line is then split into lists of effects, which is then passed to the
ApplyMultipleEffects function
function vicApplyMultipleEffectsOnFlag(effect, unit, targetTile, flag)
{
if (flag == null) return;
var line = effect.ScriptFlags.get(flag);
if (line == null) return;
var effects = line.split(", "); // string array of effect names
var isTileEffect = vicDictionaryHasKey(effect.AllFlags, "tile"); // needed
because the AllFlags.get(flag) don't return anything but null even if that
flag exists

if (isTileEffect)
{
// assume that effects to be applied are also tile effects
vicApplyMultipleTileEffects(effects, targetTile)
}
else
{
vicApplyMultipleEffects(effects, unit);
}
}

Is there a better way of me doing this? The problem is that the information
in the flags are strings of effect names, and I am not sure how to look up
their flags set without the corresponding object.

Victorious
-----Original Message-----
From: ian-reeds-games-bounce@xxxxxxxxxxxxx
[mailto:ian-reeds-games-bounce@xxxxxxxxxxxxx] On Behalf Of Craig Brett
(Redacted sender "craigbrett17@xxxxxxx" for DMARC)
Sent: Tuesday, March 10, 2015 3:01 PM
To: ian-reeds-games@xxxxxxxxxxxxx
Subject: [ian-reeds-games] Re: getting skill/item/effect/point objects,
given their unique IDs or IndexedName

Hi Victorious,

In short, no. There's no global "findSomethingWithThisName" type function,
mostly because 2 or more things can have the same name. Often skills and
effects will share a name, for example.

Though you do have the ability to check off any given object's IndexedName
against whatever value you have in your effect's script flags, etc. Is that
the sort of thing you're after?

Craig

On 09/03/2015 19:15, Victorious wrote:
Hi Craig/Ian,

Is there currently a way to get a effect/skill/item/point object if
you have its unique name? For example, I'd like to improve a
effects_on_apply flag on effects. I need to assume that the effect
type (unit or tile effect) that the script is used on, and the effects
specified match as otherwise bad things will happen. If I had that
ability, I could define custom behaviour - if the effect that script
is on is a tile effect and some effects in the effects_on_apply string
are actually unit effects, the map creater probably intended them to apply
to everything in the tile.
Victorious


Other related posts: