Jump to content

What's wrong with this script?


Guest i30817

Recommended Posts

The pc doesn't move if i activate it. Even if i go near a npc before he doesn't actually pickpocket either.

 

//thief pickpocket

IF

	HotKey(T)

	ActionListEmpty()

	CheckStatGT(Myself,1,PICKPOCKET)

	LOS(Nearest([GOODCUTOFF]), 30)

THEN

	RESPONSE #100

			SetGlobal("thief_dive","LOCALS",1)

			FaceObject(LastSeenBy(Myself))

			MoveToObjectFollow(LastSeenBy())

			Continue()

END



//if near victim

IF

	Global("thief_dive","LOCALS",1)

	LOS(LastSeenBy(Myself),4)

THEN

	RESPONSE #100

			SetGlobal("thief_dive","LOCALS",0)

			PickPockets(LastSeenBy(Myself))

END



//if too far away since it is faster than us

IF

	Global("thief_dive","LOCALS",1)

	!LOS(LastSeenBy(Myself),30)

THEN

	RESPONSE #100

			SetGlobal("thief_dive","LOCALS",0)

END

//keep on trucking if in the range

Link to comment

I already tried that and tried replacing the

!LOS for !See, but no change.

 

It doesn't actually start the pc moving or facing the nearest non hostile npc, so something must be wrong in that first action most likely.

Link to comment

Now i replaced all the Lastseenby(Myself) by LastSeenBy()

Didn't work.

 

Is this a valid way to persist a npc reference across script file ai updates? Using lastseenby that is.

Link to comment

I'm thinking of this as a alternate targetting:

 

		OR(4)
	   See(Nearest([GOODBUTBLUE]))
	   See(Nearest([NEUTRAL]))
	   See(Nearest([EVILBUTBLUE]))
	   See(Nearest([ENEMY]))

Is there such a thing as NEUTRALBUTBLUE? Or is it neutal already all blues?

 

I ask because when i tried NOTGOOD, my chaotic neutral pc was returned, so i don't really understand if this applies to faction or alignment - the blue constants seem to indicate alignment.

 

What i really want is somthing like

 

NotInMyGroup(Nearest())

 

But more or less turned on it's head, since now it would always fail (nearest would return the pc, then probably the allies, maybe the familiar, then the ones i'm interested in).

Link to comment

I was trying this now

 

//thief pickpocket

IF
	HotKey(T)
	ActionListEmpty()
	CheckStatGT(Myself,1,PICKPOCKET)
THEN
	RESPONSE #100
			SetGlobal("thief_dive","LOCALS",1)
			Continue()
END

//find the target
IF
 ActionListEmpty()
 Global("thief_dive","LOCALS",1)
 See(SecondNearest([ANYTHING]))
 InMyGroup(LastSeenBy(Myself))
 See(ThirdNearest([ANYTHING]))
 InMyGroup(LastSeenBy(Myself))
 See(FourthNearest([ANYTHING]))
 InMyGroup(LastSeenBy(Myself))
 See(FifthNearest([ANYTHING]))
 InMyGroup(LastSeenBy(Myself))
 See(SixthNearest([ANYTHING]))
 InMyGroup(LastSeenBy(Myself))
 See(SeventhNearest([ANYTHING]))
 InMyGroup(LastSeenBy(Myself))
 See(EighthNearest([ANYTHING]))
 InMyGroup(LastSeenBy(Myself))
 See(NinthNearest([ANYTHING]))
 InMyGroup(LastSeenBy(Myself))
 See(TenthNearest([ANYTHING]))
 InMyGroup(LastSeenBy(Myself))
 False()
THEN
 RESPONSE #100
END
//turn it off
IF
InMyGroup(LastSeenBy(Myself))
Global("thief_dive","LOCALS",1)
THEN
RESPONSE #100
SetGlobal("thief_dive","LOCALS",0)
Continue()
END

//follow victim
IF
Global("thief_dive","LOCALS",1)
THEN
RESPONSE #100
	SetGlobal("thief_dive","LOCALS",2)
	FaceObject(LastSeenBy(Myself))
	DisplayString(LastSeenBy(Myself), 12)
	MoveToObjectFollow(LastSeenBy(Myself))
END

//if near victim
IF
	Global("thief_dive","LOCALS",2)
	LOS(LastSeenBy(Myself),1)
THEN
	RESPONSE #100
			SetGlobal("thief_dive","LOCALS",0)
			PickPockets(LastSeenBy(Myself))
END



//if too far away since it is faster than us
IF
	Global("thief_dive","LOCALS",2)
	!LOS(LastSeenBy(Myself),30)
THEN
	RESPONSE #100
		SetGlobal("thief_dive","LOCALS",0)
END

//keep on trucking if in the range

 

Apparently, doors can be returned by nearest.

 

:cool:

Link to comment

The priority system above is really out of wack.

 

SecondNearest returns the second nearest any humanoid, ok.

 

Nearest returns the PC.

 

Where the fuck is the first nearest humanoid that is not the pc or a part of his team?

Link to comment

This seems t work (though i don't know what is doing NearestMyGroupOfType - Can't exclude party members).

 

 

IF
	HotKey(T)
	ActionListEmpty()
	CheckStatGT(Myself,1,PICKPOCKET)
	See(NearestMyGroupOfType([ANYTHING.HUMANOID]))
	LOS(LastSeenBy(Myself),5)
THEN
	RESPONSE #100
			FaceObject(LastSeenBy(Myself))
			MoveToObjectFollow(LastSeenBy(Myself))
			PickPockets(LastSeenBy(Myself))
END

 

Something equivalent for traps would be cool, but there is no way to list the nearest trap object...

Link to comment
Nearest returns the PC.
Nearest() does not function. Do not use it.

 

[spec] already returns the nearest visible living object matching spec.

 

Where the fuck is the first nearest humanoid that is not the pc or a part of his team?
See([NOTGOOD.HUMANOID]), I think is what you want. But since you can't pickpocket hostile creatures (IIRC), just use See([NEUTRAL]) (that's most everybody in the game with a blue circle).

 

Note that LOS() may not really be useful in BG2 (it's not guaranteed to work, from what I recall). Use See() or Detect() instead. (You can couple it with Range() if you need.)

 

Note that group matching is a comparison of specifics values (which will be 0 for PCs and a ton of NPCs). InMyGroup() is returning true if the object has the same specifics value of the person running the script. It has nothing to do with the player's party.

 

Note that actions in a block which Continue()s aren't executed until all triggers are processed (those SetGlobal() calls won't execute until the next round, so the value will remain as it is while the rest of the script is checked until either a block without Continue() returns true or it runs out of things to check).

 

Your targeting block isn't functional. Triggers are processed in order until a false one is found, so if you don't See(SecondNearest([0])) then the block is dropped entirely and it moves on to the next (where you use LastSeenBy(), which is now not guaranteed to hold a usable value).

Link to comment

Thanks. That information about the [] and nearest really should be in IESDP (and i still don't understand what the EA ids mean. Goodbutblue and it has nothing to do with alignment? )

 

 

 

I don't suppose you know of a way to get a hold of the nearest trap object to use disarm traps on?

Link to comment

Allegiance, not alignment. Alignment is a D&D character property lawful/neutral/chaotic good/neutral/evil. Allegiance is PC, neutral, or enemy, with some special values for other specific uses. E.g., GOODBUTBLUE is a character of technically ALLY allegiance but has a forced blue selection circle (it's treated like a green-circle, but you interact with it and see it as a blue-circle).

 

I'm a bit rusty, but from all I can remember it's next to impossible to reliably return generic non-actor objects. Don't bother trying (the only sure way is to refer to them by name, and they're almost all different) unless you really enjoy wasting your time (I'm sure somebody could come up with ideas about editing every trap in the game and hacking together something that would work at least some of the time; I know I wouldn't bother).

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...