Jump to content


Morkfel

Member Since 04 Jul 2011
Offline Last Active Jul 22 2013 07:53 PM

Posts I've Made

In Topic: Why Doesn't This Script Block Work in BGEE?

16 July 2013 - 10:44 AM

I think you could do either 

 

IF
	See(NearestEnemyOfType(OGRE))
THEN

 

Or

IF
	See([ENEMY.0.OGRE])
	Range(LastSeenBy(Myself),#)
THEN

 

With the range being optional if you need it. But in either case I can't make it universal for whatever favored enemy the player has chosen by accessing the HATEDRACE stat.

 

 

 

 

I've moved over to using STATS from STATE to improve scripting efficiency. For example, some spells:

// 2120 WIZARD_REFLECTED_IMAGE
// 2212 WIZARD_MIRROR_IMAGE
// 2607 WIZARD_MISLEAD
// 2703 WIZARD_PROJECT_IMAGE
// 2804 WIZARD_SIMULACRUM

 

Have a similar function. You can tell if one is already active:

	!StateCheck(Myself,STATE_MIRRORIMAGE)
	!StateCheck(Myself,STATE_INVISIBLE)
	!StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
	!CheckStat(Myself,1,PUPPETMASTERTYPE)
	!CheckStat(Myself,2,PUPPETMASTERTYPE)
	!CheckStat(Myself,3,PUPPETMASTERTYPE)
// 1 = Mislead, 2 = Project Image, 3 = Simulacrum

So if the player chooses to memorize multiple variations they won't overlap and will get used in sequence instead.

 

I wish I could do this for Protection from Evil and Petrification. There don't seem to be states or stats for them.


In Topic: Why Doesn't This Script Block Work in BGEE?

15 July 2013 - 10:49 PM

Hmmm. I don't think I like listing all the areas where it is acceptable to use a spell, since it disables it in any added content/modules.

 

Since I'm asking you about things on my wishlist for scripting, how about favored enemies? It would be nice to be able to script to get Rangers to target their favored enemies first.

 

It's available to scripts through the STATS.IDS as 'HATEDRACE', but I assume it's a string and even if it were an integer which appears in the RACE.IDS, I'm not even sure how I would use that in a script. I would have to retrieve the integer value for HATEDRACE and use it in [EA.GENERAL.RACE] format; something like (pseudocode):

 

IF

GetStat(HATEDRACE > Var1)

See([ENEMY.0.$Var1])

THEN

 

But I don't think we can create variables on the fly like that...


In Topic: Object identifiers

15 July 2013 - 10:11 PM

Here is an example of what I'm talking about:

 

	OR(18)
		See([ENEMY.0.0.BARD])
		See([ENEMY.0.0.BARD_ALL])
		See([ENEMY.0.0.CLERIC_MAGE])
		See([ENEMY.0.0.CLERIC])
		See([ENEMY.0.0.CLERIC_RANGER])
		See([ENEMY.0.0.CLERIC_THIEF])
		See([ENEMY.0.0.DRUID])
		See([ENEMY.0.0.DRUID_ALL])
		See([ENEMY.0.0.FIGHTER_CLERIC])
		See([ENEMY.0.0.FIGHTER_DRUID])
		See([ENEMY.0.0.FIGHTER_MAGE])
		See([ENEMY.0.0.FIGHTER_MAGE_CLERIC])
		See([ENEMY.0.0.FIGHTER_MAGE_THIEF])
		See([ENEMY.0.0.MAGE])
		See([ENEMY.0.0.MAGE_ALL])
		See([ENEMY.0.0.MAGE_THIEF])
		See([ENEMY.0.0.SORCERER])
		See([ENEMY.0.0.OGRE_MAGE])

 

Should trigger as true whenever there is an enemy in LOS of the given class.

 

Some spells have a range centered on the caster with a 5, 20, or 30 foot range. For these you may want to ensure that there are at least two enemies in range but that at least one of them is a caster. This:

 

	See(SecondNearestEnemyOf(Myself))
	OR(18)
		Class(LastSeenBy(Myself),BARD)
		Class(LastSeenBy(Myself),BARD_ALL)
		Class(LastSeenBy(Myself),CLERIC_MAGE)
		Class(LastSeenBy(Myself),CLERIC)
		Class(LastSeenBy(Myself),CLERIC_RANGER)
		Class(LastSeenBy(Myself),CLERIC_THIEF)
		Class(LastSeenBy(Myself),DRUID)
		Class(LastSeenBy(Myself),DRUID_ALL)
		Class(LastSeenBy(Myself),FIGHTER_CLERIC)
		Class(LastSeenBy(Myself),FIGHTER_DRUID)
		Class(LastSeenBy(Myself),FIGHTER_MAGE)
		Class(LastSeenBy(Myself),FIGHTER_MAGE_CLERIC)
		Class(LastSeenBy(Myself),FIGHTER_MAGE_THIEF)
		Class(LastSeenBy(Myself),MAGE)
		Class(LastSeenBy(Myself),MAGE_ALL)
		Class(LastSeenBy(Myself),MAGE_THIEF)
		Class(LastSeenBy(Myself),SORCERER)
		Class(LastSeenBy(Myself),OGRE_MAGE)
	Range(LastSeenBy(Myself),30)

 

Should do that, but actually would only fire when the second nearest matches the Class. A better way of scripting that would be:

	See(SecondNearestEnemyOf(Myself))
	Range(LastSeenBy(Myself),30)
	OR(18)
		See([ENEMY.0.0.BARD])
		See([ENEMY.0.0.BARD_ALL])
		See([ENEMY.0.0.CLERIC_MAGE])
		See([ENEMY.0.0.CLERIC])
		See([ENEMY.0.0.CLERIC_RANGER])
		See([ENEMY.0.0.CLERIC_THIEF])
		See([ENEMY.0.0.DRUID])
		See([ENEMY.0.0.DRUID_ALL])
		See([ENEMY.0.0.FIGHTER_CLERIC])
		See([ENEMY.0.0.FIGHTER_DRUID])
		See([ENEMY.0.0.FIGHTER_MAGE])
		See([ENEMY.0.0.FIGHTER_MAGE_CLERIC])
		See([ENEMY.0.0.FIGHTER_MAGE_THIEF])
		See([ENEMY.0.0.MAGE])
		See([ENEMY.0.0.MAGE_ALL])
		See([ENEMY.0.0.MAGE_THIEF])
		See([ENEMY.0.0.SORCERER])
		See([ENEMY.0.0.OGRE_MAGE])
	Range(LastSeenBy(Myself),30)

Which combines two See() checks to ensure that there are two enemies within 30 feet and that at least one of them is a caster.

 

 

It's also pretty useful here:

	See([ANYONE])
	OR(2)
		Gender(LastSeenBy(Myself),SUMMONED_DEMON)
		Race(LastSeenBy(Myself),DEMONIC)

Becomes:

 

	OR(2)
		See([ENEMY.0.0.0.0.SUMMONED_DEMON])
		See([ENEMY.0.0.DEMONIC])

 

Anyway, this is mostly theoretical for me. I write scripts and my characters are pretty badass, so I guess it works.


In Topic: Object identifiers

15 July 2013 - 01:46 PM

Zombie thread.

 

It certainly deserves to be brought back, for a couple reasons.

 

(1) [EA.GENERAL.RACE.CLASS.SPECIFIC.GENDER.ALIGN] is fantastic for scripting

 

(2) Having some user-generated documentation for how these descriptionless identifiers work would be nice.

 

I know a lot of people use [EVILCUTOFF] but in my scripts I prefer to use [ENEMY]. I know there is a difference but I can't remember what. My intuition tells me that it has to do with evil party members, but I am pretty sure that's not it.


In Topic: PST Actions

15 July 2013 - 01:43 PM

Have you tried using the search feature in NearInfinity? Everyone says PST is a bit different (and it is, because it was first).

 

Find a character that appears only in the area you want and search for their name/string and then you can find files that reference it.