Quantcast
Channel: Recent Discussions — Beamdog Forums
Viewing all articles
Browse latest Browse all 105449

AI Scripting

$
0
0
I have a couple questions about scripting. Haven't done any since 2013 so maybe it's just slipped my mind, or maybe it's not possible.

First Question: How can I script to use the 2nd ability of a wand?

Normally a script to use a wand would look like:
IF
	ActionListEmpty()
	See([EVILCUTOFF])
	HasItem("WAND03",Myself)
THEN
	RESPONSE #100
		UseItem("WAND03",LastSeenBy(Myself))
END

How do I alter the UseItem() action to use the second ability instead of defaulting to the first ability - which is just an assumption on my part. BGEE has two wands with two abilities: Wand of Fire (WAND05) which does a Fireball and alternatively an Agannazar's Scorcher and Wand of Spell Striking (WAND18) which does Breach and Pierce Magic. Scripting this latter one would be especially useful in colourful fights.

For those interested in how I would normally code this:
IF	
	ActionListEmpty()							// don't interrupt
	RandomNum(2,1)								// 50% chance not to use wand at all
	See([EVILCUTOFF])							// do I see an enemy?
	CheckStatLT(LastSeenBy(Myself),34,RESISTMAGIC)				// make sure low magic resistance
	CheckStatGT(LastSeenBy(Myself),1,LEVEL)					// don't waste on kobolds
	HPPercentLT(LastSeenBy(Myself),95)					// preferably share targets with teammates
	HPPercentGT(LastSeenBy(Myself),15)					// don't waste it on something about to die
	!HaveSpell(WIZARD_MAGIC_MISSILE)					// why don't I use the spell up first?
	HasItem("WAND03",Myself)						// do I even have a Wand of Magic Missiles?
THEN
	RESPONSE #100
		UseItem("WAND03",LastSeenBy(Myself))				// yay I did 4 pts of dmg!
END

Viewing all articles
Browse latest Browse all 105449

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>