Jump to content

IWD2 Trying to identify Golems via script


Recommended Posts

Posted
IF
	Race(NearestEnemyOf(Myself),GOLEM)
THEN
	RESPONSE #100
		Spell(NearestEnemyOf(Myself),WIZARD_LANCE_OF_DISRUPTION)
END

The trigger never returns true. I've tried a few different RACE.IDS like GIANT, ELEMENTAL, NO_RACE, SHAMBLING_MOUND, TROLL, SNOW TROLL without success

I've wrote a paladin/cleric script for detecting and turning undead, and that successfully detects and turns undead using.

IF
	Race(NearestEnemyOf(Myself),UNDEAD)
THEN
	RESPONSE #100
		Spell(NearestEnemyOf(Myself),INNATE_TURN_UNDEAD)
END

Obviously there's a bit more to the scripts than that, I'm just trying to keep the question and examples simple.

Does anyone have any ideas on how I might be able to detect a Golem so then I can use effective means to take them down?

Posted
2 hours ago, Grantus said:
IF
	Race(NearestEnemyOf(Myself),GOLEM)
THEN
	RESPONSE #100
		Spell(NearestEnemyOf(Myself),WIZARD_LANCE_OF_DISRUPTION)
END

The trigger never returns true. I've tried a few different RACE.IDS like GIANT, ELEMENTAL, NO_RACE, SHAMBLING_MOUND, TROLL, SNOW TROLL without success

I've wrote a paladin/cleric script for detecting and turning undead, and that successfully detects and turns undead using.

IF
	Race(NearestEnemyOf(Myself),UNDEAD)
THEN
	RESPONSE #100
		Spell(NearestEnemyOf(Myself),INNATE_TURN_UNDEAD)
END

Obviously there's a bit more to the scripts than that, I'm just trying to keep the question and examples simple.

Does anyone have any ideas on how I might be able to detect a Golem so then I can use effective means to take them down?

 

Probably some obvious stuff, but have you checked all of these things using something like Near Infinity?

- The enemy creature being tested on is indeed race "GOLEM"

- The spell is memorized by the caster, this is needed for the Spell() script action.

- WIZARD_LANCE_OF_DISRUPTION is the correct IDS name for the spell that's memorized. You might want to test SpellRES() instead.

Also ensure the script priority is correct, because this script might not be firing if higher priority scripts are taking precedence. 

Posted

Hi, thanks for the reply. Some good points you mentioned. I never thought of cracking open the creature file of an Ice Golem, which is what I'm currently targeting.

So I've found the Ice Golem and it's race is set to Orc, goodness knows why?

Here's the entry from Near Infinity

https://imgur.com/vKNpBgt

I would have inserted the image from URL so you didn't have to click but It doesn't seem to like the link.

 

And it's not just the Ice Golem that's set to Orc... They all are, except Adamantine Golem, who's set to Goblin...

It seems the only mention of "Golem" in the creature file is either it's:

1) Name 2)Animation or 3)The script it uses.

I'm thinking of using something like IsScriptName(S:ScriptName*,O:Object*)

So maybe:

IF
	Or(3)
		IsScriptName("41GoleIC",NearestEnemyOf(Myself))	//	Ice Golem
		IsScriptName("41GolemC",NearestEnemyOf(Myself))	//	Crystal Golem
		IsScriptName("52GOLIR",NearestEnemyOf(Myself))	//	Iron Golem
THEN
	RESPONSE #100
		Spell(NearestEnemyOf(Myself),WIZARD_LANCE_OF_DISRUPTION)
END

I'll give it a try. 

Posted

There is no way of checking an objects name

Golems are not actually the race of GOLEM, they are Orc or Goblin race. So checking for Golems by checking for Orcs just doesn't compute for me.

And they don't use the script they're supposed to be using. So you can't Identify them by checking the objects script.

However, animations are unique for pretty much every creature.

Therefor, using the trigger___ IsAnimationID(O:Object*,I:AnimID*Animate) ___is probably the most reliable way of checking to see if you're targeting a Golem, or any other "Monster" with unique animations for that matter.

IF
    !TimerActive(01)	//	Check for local timer to prevent spamming and allow for other spells to be cast
    Or(4)
        IsAnimationID(NearestEnemyOf(Myself),"""""Golem, Ice""""")
        IsAnimationID(NearestEnemyOf(Myself),"""""Golem, Iron""""")
        IsAnimationID(NearestEnemyOf(Myself),"""""Golem, Iron (BG2)""""")
        IsAnimationID(NearestEnemyOf(Myself),"""""Golem, Clay (BG2)""""")	//	These are to detect if your near ANY Golem in game
    HaveSpell(WIZARD_LANCE_OF_DISRUPTION)	//	Basically, stop here if you don't have the spell
THEN
    RESPONSE #100
        Spell(NearestEnemyOf(Myself),WIZARD_LANCE_OF_DISRUPTION)  // SPWI319.SPL (Lance of Disruption)
        StartTimer(01,15)	//	Start a local timer. Explanation of the arguments () are (UniqueID: Integer of 2 digits,Duration: In real time seconds)
        Continue()	//	To give the rest of the script a chance
END

That's my final script snippet.

Posted
11 minutes ago, Dan_P said:

That's probably a mod doing that. Unmodded GOG version, all golems are set to Golem race.

I see. I'm playing the Enhanced Edition collection of mods. And I like it so far. It's almost fresh again :) Although, when I realized all the default scripts were kind of broken I had a gut feeling it was something to do with Enhanced Edition. Because I don't remember the AI being THAT useless.

Posted

Did a quick check of possible components that could affect this.

It's the "Better racial enemies for rangers" component that changes the race to Orc. This looks like it's intentional. In the install file for the compatibility patch, it says "turn constructs into orcs" in the part where it edits CRE files to match that component. It's just a different way of grouping races together, but it can mess with scripts that check race if not updated.

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...