Jump to content


WizWom

Member Since 20 Nov 2003
Offline Last Active Oct 19 2024 01:38 PM

Topics I've Started

Backstab script

10 February 2010 - 06:18 PM

IF
	!ActionListEmpty()
	!See(NearestEnemyOf(Myself))
THEN
	RESPONSE #100
END

IF
	HotKey(S)
	Global("GBStealth","LOCALS",0)
THEN
	RESPONSE #100
		DisplayStringHead(Myself,34120) // Hide In Shadows
		SetGlobal("GBStealth","LOCALS",1)
END

IF
	HotKey(S)
	!Global("GBStealth","LOCALS",0)
THEN
	RESPONSE #100
		DisplayStringHead(Myself,4188) // Leaving Shadows
		SetGlobal("GBStealth","LOCALS",0)
END

IF
	Global("GBUnseen","LOCALS",0)
	OR(2)
		StateCheck(Myself,STATE_INVISIBLE)
		StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
THEN
	RESPONSE #100
		SetGlobal("GBUnseen","LOCALS",1)
END

IF
		Global("GBUnseen","LOCALS",1)
	!StateCheck(Myself,STATE_INVISIBLE)
	!StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
THEN
	RESPONSE #100
		DisplayStringHead(Myself,75113) // You look familiar. Did I see you earlier?
		SetGlobal("GBUnseen","LOCALS",0)
		SetGlobal("GBBackStabbingNow","LOCALS",0)
END

IF
	Global("GBStealth","LOCALS",1)
	!Detect([EVILCUTOFF])
	Global("GBUnseen","LOCALS",0)
	!StateCheck(Myself,STATE_INVISIBLE)
	!StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
THEN
	RESPONSE #100
		EquipMostDamagingMelee()
		SetGlobal("GBUnseen","LOCALS",1)
		Hide()
END

IF
	HotKey(B)
	Global("GBBackStab","LOCALS",0)
THEN
	RESPONSE #100
		DisplayStringHead(Myself,17591) // The thief will attempt to hide in shadows when an enemy is not in sight.  As soon as the thief is hidden, he will attempt to backstab the closest enemy. (<script>)
		SetGlobal("GBBackStab","LOCALS",1)
		SetGlobal("GBStealth","LOCALS",1)
END

IF
	HotKey(B)
	!Global("GBBackStab","LOCALS",0)
THEN
	RESPONSE #100
		DisplayStringHead(Myself,3042) // The backstab seems to have failed.
		SetGlobal("GBBackStab","LOCALS",0)
END

IF
	Global("GBBackStab","LOCALS",1)
	See(NearestEnemyOf(Myself))
	Global("GBUnseen","LOCALS",1)
	!Range(LastSeenBy(Myself),3)
THEN
	RESPONSE #100
		FollowObjectFormation(LastSeenBy(Myself),11,1)
		MakeUnselectable(3)
END

IF
	Global("GBBackStab","LOCALS",1)
	Global("GBUnseen","LOCALS",1)
	!ActuallyInCombat()
	See(NearestEnemyOf(Myself))
	Range(LastSeenBy(Myself),3)
THEN
	RESPONSE #100
		Attack(NearestEnemyOf(Myself))
END

IF
	See(NearestEnemyOf(Myself))
	Range(LastSeenBy(Myself),<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' />
	Global("GBAmmoless","LOCALS",0)
	!HasItemSlot(Myself,SLOT_MISC19)
	HasItemSlot(Myself,SLOT_WEAPON)
	!InParty(LastSeenBy(Myself))
	!Class(LastSeenBy(Myself),INNOCENT)
	Allegiance(LastSeenBy(Myself),EVILCUTOFF)
THEN
	RESPONSE #100
		SelectWeaponAbility(SLOT_WEAPON,0)
		Attack(LastSeenBy(Myself))
END

IF
	See(NearestEnemyOf(Myself))
	Range(LastSeenBy(Myself),<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' />
	OR(3)
		!HasItemSlot(Myself,SLOT_WEAPON)
		HasItemSlot(Myself,SLOT_MISC19)
		Global("GBAmmoless","LOCALS",1)
	!InParty(LastSeenBy(Myself))
	!Class(LastSeenBy(Myself),INNOCENT)
	Allegiance(LastSeenBy(Myself),EVILCUTOFF)
THEN
	RESPONSE #100
		EquipMostDamagingMelee()
		Attack(LastSeenBy(Myself))
END

IF
	OR(3)
		See(NearestEnemyOf(Myself))
		See(TenthNearestEnemyOfType([0.0.0.CLERIC_ALL]))
		See(TenthNearestEnemyOfType([0.0.0.LONG_BOW]))
	!Range(LastSeenBy(Myself),<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' />
	!Range(LastAttackerOf(Myself),<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' />
	Global("GBAmmoless","LOCALS",0)
	!HasItemSlot(Myself,SLOT_MISC19)
	HasItemSlot(Myself,SLOT_WEAPON1)
	!InParty(LastSeenBy(Myself))
	!Class(LastSeenBy(Myself),INNOCENT)
	Allegiance(LastSeenBy(Myself),EVILCUTOFF)
THEN
	RESPONSE #100
		SelectWeaponAbility(SLOT_WEAPON1,0)
		Attack(LastSeenBy(Myself))
END

IF
	OR(3)
		See(NearestEnemyOf(Myself))
		See(TenthNearestEnemyOfType([0.0.0.CLERIC_ALL]))
		See(TenthNearestEnemyOfType([0.0.0.LONG_BOW]))
	!Range(LastSeenBy(Myself),<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' />
	!Range(LastAttackerOf(Myself),<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' />
	OR(3)
		!HasItemSlot(Myself,SLOT_WEAPON1)
		HasItemSlot(Myself,SLOT_MISC19)
		Global("GBAmmoless","LOCALS",1)
	!GlobalTimerNotExpired("GBWizAlacrity","LOCALS")
	!InParty(LastSeenBy(Myself))
	!Class(LastSeenBy(Myself),INNOCENT)
	Allegiance(LastSeenBy(Myself),EVILCUTOFF)
THEN
	RESPONSE #100
		EquipRanged()
		Attack(LastSeenBy(Myself))
END

Issues:
  • sometimes when moving to the backstab position, it will prematurely attack
  • setting any variable takes you out of stealth, which makes doing anything complex problematical
  • hard to predict how long you'll have in stealth after the attack, you could become visible before you get in your swing (shortsword of backstabbing, anyone?)