Jump to content


Photo

Visual range of creatures. Why are they half-blind?


  • Please log in to reply
13 replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 02 October 2016 - 01:52 PM

I have a script triggered by Nearest, and I tried substituting LastSeenBy() in the same trigger block with Nearest, plus a custom spell state. I also have a SecondNearest trigger and response block, identical, down in the script. This is for an invisible creature, temporarily visible actually, who is supposed to cast a spell on the nearests who satisfy this condition. I'm testing it in the courtyard of the Friendly Arm Inn, where there are some standing, ass-scratching peasants, a few guards and a couple of NPC I conjured up for the test.

 

Well, the script is simple, just what it says above. And I can't say it never works. Sometimes the creature sees - that is, detects - the enchanted one and casts the spell on him. But sometimes it doesn't, even if he's rubbing against it. One time I put an Ajantis in that spell state, the creature ignored him, but the second one, summoned with the same effect, did see him. And so on, and so forth. I've never had it happen to me in the game that an enemy would fail to see someone next to him, but these one-eyed menials regularly just stand there gawking.

 

Any ideas about what may be going on? I have an extra spell up in the beginning of the list that the creature casts on itself before other actions. My attempt at glasses - it sets Self Visual range to 15 (the maxiumum, according to the G3 guide).



#2 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5155 posts

Posted 02 October 2016 - 11:13 PM

Are you sure the effected creature is NOT effected ? Cause for example, some of the peasant characters might not have a walk animations (if they are sitting down).
And remember, when you have invisible creatures, well you have invisible creatures and so the blindness is only on your part as you can't see the effected target. :P

Edited by The Imp, 03 October 2016 - 12:21 AM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#3 temnix

temnix
  • Member
  • 983 posts

Posted 03 October 2016 - 07:23 AM

I'm sure they are half-blind alright. But I solved the problem: if spawning one dumbass cyclops won't do it, spawning three will! Eventually I cut the number down to two. They huff and they puff, but they sort it out between themselves.



#4 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 04 October 2016 - 12:50 PM

You should post part of your script that has the issue. LastSeenBy() needs a trigger, typically See(), in order for it to find a target.


Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#5 temnix

temnix
  • Member
  • 983 posts

Posted 04 October 2016 - 03:26 PM

There was a Detect there. No, I don't think there is an error, otherwise they would never see the target. They are just myopic. Like I said, spawning two gets the job done.



#6 Himself

Himself

    CEO of the ENDLESS WAVES OF BAD DOGGIE

  • Member
  • 230 posts

Posted 04 October 2016 - 03:40 PM

Thats why I hoped your script could use a junction of LastTargetedBy-LastSummonerof-Myself for your invis cre to automatically target the last creature the spellcaster used a spell on, avoiding conditional circunstances like See. Its hard to give advice on scripting when we don't know exactly what u wanna do and we can't see the script in its entirety. Specially me as I'm dumber than most... :DD


Edited by Himself, 04 October 2016 - 03:41 PM.

...to be isn't important, we're no longer than we're :)

#7 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 04 October 2016 - 05:12 PM

They are just myopic.

Well... they are cyclopes after all. They should be half-blind, or even fully blind if you happen to be a sailor called Odysseus.

 

Seriously though, there's a whole boatload of things that can go wrong with IE scripts for no good reason. Having said that, if something works only in some cases or half the time, there is usually a reason (not necessarily good, but a reason) and it is tough to say without (as Himself and I said) seeing some of the script.


Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#8 temnix

temnix
  • Member
  • 983 posts

Posted 05 October 2016 - 12:04 PM

Okay, here is the script.

 

IF
	Detect(Nearest)
	Allegiance(LastSeenBy(Myself),GOODBUTBLUE)
	CheckSpellState(LastSeenBy(Myself),CHARMED)
THEN
	RESPONSE #100
		ClearActions(LastSeenBy(Myself))
		ActionOverride(LastSeenBy(Myself),MoveToObject(Player1))
		DestroySelf()
END

IF
	Detect(SecondNearest)
	Allegiance(LastSeenBy(Myself),GOODBUTBLUE)
	CheckSpellState(LastSeenBy(Myself),CHARMED)
THEN
	RESPONSE #100
		ClearActions(LastSeenBy(Myself))
		ActionOverride(LastSeenBy(Myself),MoveToObject(Player1))
		DestroySelf()
END

IF
	Detect(ThirdNearest)
	Allegiance(LastSeenBy(Myself),GOODBUTBLUE)
	CheckSpellState(LastSeenBy(Myself),CHARMED)
THEN
	RESPONSE #100
		ClearActions(LastSeenBy(Myself))
		ActionOverride(LastSeenBy(Myself),MoveToObject(Player1))
		DestroySelf()
END

I put two creature spawns in the spell to make sure they work. I had to use a definite object, Player1, for the object to move to, because LastSummonerOf(Myself) only caused the commanded creature to strain. It was as if it wanted to go to ITS OWN summoner, and, of course, there wasn't one. That's why I asked in another place who Myself or () refers to for ActionOverride - the commanding creature or the commanded creature. Or maybe the straining was because the commander disappeared too quickly. Maybe if I put a little delay before DestroySelf()... I'll test for it.



#9 Himself

Himself

    CEO of the ENDLESS WAVES OF BAD DOGGIE

  • Member
  • 230 posts

Posted 05 October 2016 - 04:01 PM

Err... Now I'm puzzled  :huh:, my splstate.ids doesn't has CHARMED, running un-modded EE latest(2.3), can you experts tell if thats normal?


Edited by Himself, 05 October 2016 - 04:23 PM.

...to be isn't important, we're no longer than we're :)

#10 Fiann of the Silver Hand

Fiann of the Silver Hand
  • Member
  • 286 posts

Posted 05 October 2016 - 07:04 PM

I think his spell sets a custom splstate with a newer EE-only opcode.



#11 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 07 October 2016 - 11:20 AM

I may not be intimately familiar with current scripting syntax, but how does this:

StateCheck(LastSeenBy(),STATE_CHARMED)

Differ from this:

CheckSpellState(LastSeenBy(Myself),CHARMED)
?

From what I gather, the former looks at state.ids whereas the latter looks at some newer IDS (splstate.ids), but why was it necessary to change syntax that previously worked just fine? I reckon state.ids didn't have every state required, but it certainly had CHARMED.

LastSummonerOf() should work, but then I don't know how your CREs are getting spawned. Another example from Aurora's Shoes (running literally on a pair of boots, or an invisible CRE linked to them anyway):

IF
  AreaCheck("AR0516")
THEN
  RESPONSE #100
    DisplayStringNoNameHead(LastSummonerOf(Myself),@5) //The boots will be no help here.
    Wait(1)
    DisplayStringNoName(LastSummonerOf(Myself),@4) //There is a brief sound of dismay and a sense of something getting out of the area as fast as it possibly can.
    SmallWait(5)
    DestroySelf()
END

Notice the Wait() and SmallWait(). I forget whether we put these in for aesthetic reasons or to prevent the possibility of the DestroySelf() somehow preventing string display in the same block. A SmallWait doesn't hurt anyway, and will hardly be noticeable. In addition, you are calling ClearActions() in the same block as other actions. An action immediately thereafter should work in theory, but theory is not always the same as practice in IE scripting. In this respect, MoveToObjectNoInterrupt() might be more successful than MoveToObject().

In all your blocks, you can substitute LastSeenBy(Myself) with Nearest() etc. Will it make a difference in script performance? I don't know; it might. I can't swear to it, but I think I have seen glitches occur with Detect() and LastSeenBy(). It shouldn't hurt anyway, and might help.

In addition, your script may have more blocks, but your example only goes to ThirdNearest. You probably want to go to at least Sixth and maybe Tenth, to account for a full party, summonees, "ass-scratching peasants" as you put it. If someone is right next to the CRE, he *should* be the nearest, but the engine is funny here. And another odd thing - for large creatures such as cyclopes, the target may need to be actually beyond the creature's "bump" range (similar to foot circle but not always) for the CRE to recognize the target at all. (Don't quote me on that, but of all the oddities in IE scripting, that wouldn't surprise me.)

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#12 temnix

temnix
  • Member
  • 983 posts

Posted 07 October 2016 - 02:49 PM

StateCheck looks at STATE.IDS. You can't add lines in there. CheckSpellState looks at SPLSTATE.IDS, where you can, and I have a custom state CHARMED there. I used to switch people over in SPECIFIC, but somebody told me they can be only in one state from that file at a time. I didn't want to mess with shamans' spirits, simulacrums and so on.

 

Detect() should work fine with LastSeenBy(), it's just a better equivalent of See().

And no, the script doesn't need anything more than ThirdNearest. The invisibles spawn right next to the creature.

 

It all works fine, all I need is to try putting a delay before DestroySelf() to see if I can get the target to go to the summoner.



#13 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5155 posts

Posted 07 October 2016 - 08:24 PM

StateCheck looks at STATE.IDS. You can't add lines in there.

Actually you can. Now of course the fact is, all the states are depending on the .cre -files headers offset 0x0020 ... but you can add "0x3 BERSERK_SLEEPING"


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#14 temnix

temnix
  • Member
  • 983 posts

Posted 08 October 2016 - 03:19 AM

It's news to me, and not necessary.