Jump to content


Photo

[Solved] General Attack script not working

bug

  • Please log in to reply
14 replies to this topic

#1 chuft

chuft
  • Member
  • 40 posts

Posted 03 August 2019 - 02:43 PM

Hello, playing BGT-WiDU and I noticed the General Attack script does not seem to work.  And it resets to None after a load.

 

I have seen users in the past commenting about this, in 2013, they were going to report it as a bug since it seemed BGT was corrupting aGen.bs somehow.

 

In the SETUP-BGT.DEBUG file I notice

 

[bgt/base/bs/agen.bs] loaded, 583 bytes
scripts/agen.bs copied to bgt/backup/0/agen.bs, 417 bytes
Copied [bgt/base/bs/agen.bs] to [scripts/agen.bs]

 

This seems to indicate BGT is modifying this script somehow. I can't see what the script does with a text editor.

 

Does anyone know why BGT modifies it, and what it is doing?  Is it safe to replace the broken one I ended up with, with \bgt\backup\0\agen.bs?

 

Thanks for any insight!  I'd like to have a general attack script where the character attacks with whatever weapon they already have in hand, neither charging nor backing up if they have a ranged weapon equipped.  Basically a "stand and shoot till they reach me then switch to melee" standard front line script.


Edited by skellytz, 26 March 2023 - 06:39 AM.
topic tags


#2 The Imp

The Imp

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

  • Member
  • 5155 posts

Posted 03 August 2019 - 11:21 PM

The BGT-weidu contain the very original agen.bs file the original game has.

aika2.jpg

It has nothing about attack range. Just attacking. It's not corruption, it's a restoration.

Now, if you want to get what you want, you ought to reconsider your install order, cause the change done here is a restoration to the origin. And the only way you get to consider it to be corruption is by assuming a mod that was installed before BGT-weidu, is there by default... but it's not. 

... not even the BG1EE has a script you want as it's agen.bs... there's no weapon switching. As what you describe is not a standard frontline fighter... it's archery script. What you want to use is the apass.bs -file. And, if memory serves... saving and loading removes the characters script in BG2, so complaining that, is like yelling to the void. Sometimes really worth it, but only because you hate yourself. But they say that hate and love is the same emotion... I can't verify or deny, for I am part of a greater machine, without such flaws, as emotions.

 

You can't open random files and expect to be able to know how it works with a text editor, you need an interpriter, the above is from Near Infinity, it's a Java program that is community build and still maintained. Here's a link for more info on this very forum about it.


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 chuft

chuft
  • Member
  • 40 posts

Posted 04 August 2019 - 06:39 AM

Thank for you reminding me about Near Infiity; I had it installed from years ago but didn't remember what it was for.

 

The script in the scripts folder and the script in the BGT backup folder have the same timestamp for Date Modified, which tells me nothing modified it after BGT. So the version in the scripts folder is the BGT version and nothing changed it after BGT install.

 

Backup version in BGT\Backup\0\:

 

IF
    AttackedBy([ANYONE],DEFAULT)
THEN
    RESPONSE #100
        AttackReevaluate(LastAttackerOf(Myself),30)
END

IF
    See(NearestEnemyOf(Myself))
THEN
    RESPONSE #100
        AttackReevaluate(NearestEnemyOf(Myself),30)
END

 

 

BGT installed version currently in Scripts:

 

IF
    AttackedBy([ANYONE],DEFAULT)
    ActionListEmpty()
THEN
    RESPONSE #100
        AttackReevaluate(LastAttackerOf(Myself),30)
END

IF
    See(NearestEnemyOf(Myself))
    ActionListEmpty()
THEN
    RESPONSE #100
        AttackReevaluate(NearestEnemyOf(Myself),30)
END

 

So the backup version matches what you say is the BGT version.  The BGT-installed version I have adds a condition for the script only firing if the character's action list is empty. So that seems odd, what you say is the BGT version is actually what it backed up for me and replaced.  Makes me wonder if you and I are using different versions of BGT-WeiDU.

 

Only the General Attack script becomes "None" on load, and it doesn't work even if newly assigned.  Same problem this person had with BGT:

 

https://www.gog.com/...tain_characters

 

The ranged script makes the character run away if enemies get close, which is not the behavior I want.

 

The new script BGT installed doesn't look obviously bad in its logic, but it doesn't work and is lost on load, so something must be wrong with the file.



#4 chuft

chuft
  • Member
  • 40 posts

Posted 04 August 2019 - 06:58 AM

I decided to have a look at all the other scripts and noticed "ActionListEmpty()" is always the first condition in a condition block, except in scripts reported as not working such as aGen.bs and the apass.bs, and also Default which I seem to recall didn't work right either. I doubt this is a coincidence, the IE engine must want that check first for some reason.

 

I edited the script to put "ActionListEmpty()" as the first condition in each block instead of last, like all the other scripts, recompiled it and launched the game.  The aGen.bs script now works as intended.  So this seems to be a coding error.



#5 The Imp

The Imp

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

  • Member
  • 5155 posts

Posted 04 August 2019 - 07:42 AM

What the ActionListEmpty() does is, is that the script only acts if you have not assigned an order to the character... so if you keep assign walk commands in a middle of a combat, they will now start to walk and only when they stop moving, they can start to shoot at range.. if they haven't already recieved another command. So if you sloppily assign bad orders, the commands you made will be excecuted to the letter, rather than what the game just decides to be best... this is because there's also a PAUSE command, at where you can assing the best orders and take hours just to assign them and then unpause. In PCs that's the SPACE button, but the in game interface has it too in the main clock, which is in the left bottom corner.

It's not a coding error, it's a logic difference.

 

The agen.bs doesn't change weapon setup... like you intend. The apass.bs does that(1), at range of 5, 4 or 3 "feet", depending on the game, a "feet" is a few pixels, about 10 in a line, so it's not very far appart from melee... and auto-attack(2) if seeing an enemy, nothing else.

The runaway thing is not in apass.bs ... it's the other archer only script called arang.bs. I don't know what the files are called in your game, so I can only use file names.

 

So removing the ActionListEmpty() will allow the characters to ignore your commands and interrupt their walks by any visible monsters ... and take the fireball hits to face just cause the kobold came to view, rather than retreating away from the blast zone. See it now ? Have to ask, have you played other RPG games recently and just haven't remembered where the pause is in BG's ?


Edited by The Imp, 04 August 2019 - 07:54 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.


#6 skellytz

skellytz
  • Staff
  • 578 posts

Posted 04 August 2019 - 08:01 AM

Hi chuft,

 

Thanks for going through all the trouble. I've nailed it down to invalid line endings: compiled scripts (BS, BCS) need LF line endings, but the two BS files copied over from the BGT package had been incorrectly converted to CR LF by Ascension64's text editor or GitHub. This has nothing to do with ActionListEmpty().

 

Added to my unofficial fork.



#7 chuft

chuft
  • Member
  • 40 posts

Posted 04 August 2019 - 08:07 AM

I am very familiar with pause, interrupting orders etc.  Characters with the General script, if given no orders, just stand there, even if attacked in melee.  They do nothing at all.

 

I am not removing the ActionListEmpty().  I am moving it from the bottom to the top of the conditional code block where it is in every other script except the non-working ones.  And now it works.

 

In other words changing

 

IF
    AttackedBy([ANYONE],DEFAULT)
    ActionListEmpty()
THEN
 

to

 

IF

    ActionListEmpty()
    AttackedBy([ANYONE],DEFAULT)
THEN

 

fixed the script.

 

In general it seems IF (a=1) AND (b=1) should be the same as IF (b=1) AND (a=1). But in this case, for whatever reason, probably due to the ActionListEmpty() method doing something to a global variable, it is not equivalent. The ActionListEmpty() check always comes first in all the working scripts. I looked.

 

Now that I know what the problem is, I have decided to copy the Ranged script into the aGen script and remove the block for running away.  This should give the behavior I want from front line fighters - act like archers unless the enemy is close, then switch to melee and attack in melee.



#8 chuft

chuft
  • Member
  • 40 posts

Posted 04 August 2019 - 08:10 AM

Hi chuft,

 

Thanks for going through all the trouble. I've nailed it down to invalid line endings: compiled scripts (BS, BCS) need LF line endings, but the two BS files copied over from the BGT package had been incorrectly converted to CR LF by Ascension64's text editor or GitHub. This has nothing to do with ActionListEmpty().

 

Added to my unofficial fork.

 

Hello,

 

I figured the other possibility was that something went wrong with the compilation process and merely by recompiling it I was fixing the problem, but that seemed remote, since it would seem that if the script was corrupted, Near Infinity would have problems reading it, and it didn't.

 

I guess Near Infinity is less finicky about line endings than IE.

 

Thanks for confirming.  Now that I am messing around with Near Infinity, I decided to change the aGen to act like a ranged script that never runs away, since it does switch weapons, so some good came of this.



#9 Sergio

Sergio
  • Member
  • 954 posts

Posted 04 August 2019 - 12:39 PM

Hi chuft,

 

Thanks for going through all the trouble. I've nailed it down to invalid line endings: compiled scripts (BS, BCS) need LF line endings, but the two BS files copied over from the BGT package had been incorrectly converted to CR LF by Ascension64's text editor or GitHub. This has nothing to do with ActionListEmpty().

 

Added to my unofficial fork.

hey, 

what are the differences between BG:T and your fork?


Low hung brow, dazed look on your face..... It appears that you are correct, my friend. You are indeed a complete imbecile.


#10 skellytz

skellytz
  • Staff
  • 578 posts

Posted 04 August 2019 - 01:00 PM

what are the differences between BG:T and your fork?

 

I'm logging every change in the commits descriptions. They're just unofficial post-v1.20 fixes:

 

  • Restored the classic BG1 area spawns based on the correct formula adjusted for the BG2 engine:
    BGT used a spawn group system devised by King Diamond back in the early days. Unfortunately, without all the research data and tools available today, the author had made incorrect assumptions regarding the area spawn points. King Diamond's system erroneously spawned all the creatures from the given spawn point slots together at the same time, which resulted in strange combinations of a fixed number of monsters, rather than same-type creatures in scaling numbers.

  • Restored a patrolling Watcher in Candlekeep:
    A missing StartTimer (ID: 3) prevented a patrolling Watcher (WATCH3.cre) from spawning in Candlekeep (AR0015.are).

  • Fixed closing the barracks door by the patrolling Watcher in Candlekeep:
    MoveToPoint coordinates had to be slightly adjusted to get CloseDoor to work properly.

 

And only recently fixed the line endings of the two scripts discussed in this thread.



#11 Sergio

Sergio
  • Member
  • 954 posts

Posted 04 August 2019 - 01:12 PM

Did you report these issues in BG:T forum? Camdawg seems to be still active. Anyway, thanks for releasing your fork :)


Low hung brow, dazed look on your face..... It appears that you are correct, my friend. You are indeed a complete imbecile.


#12 chuft

chuft
  • Member
  • 40 posts

Posted 04 August 2019 - 01:20 PM

This is fascinating.  I complained here

 

https://www.gibberli...&comment=271586

 

about getting attacked by ogrillons and an ogre mage at the same time in Waylaid by Enemies at second level, and people seemed dubious that that could happen. Another mystery solved.



#13 skellytz

skellytz
  • Staff
  • 578 posts

Posted 04 August 2019 - 01:55 PM

Did you report these issues in BG:T forum? Camdawg seems to be still active. Anyway, thanks for releasing your fork :)

 

Yes, I PMed Cam at G3 some time ago. Sadly, no interest at all. That's why it's on GitHub -- so that anyone can help collect fixes and spare Cam even more busy work.



#14 Azazello

Azazello

    The Anti-Spammer

  • Staff
  • 1912 posts

Posted 04 August 2019 - 08:44 PM

"Sadly, no interest at all" is sadly incorrect - neither CamD or G3 forums are the maintainers - official or un - of BGT. And mod errors are never to be PM'd - they should be shared in the mod's official forum.
Which is here. So this is exactly the right place to report them.

In terms of fixing, that's what we're all here for - to help resolve and get at least one of the moderators to released an updated version.

 

skellytz, I don't mean to sound harsh. Your contributions are very much appreciated!


Edited by Azazello, 05 August 2019 - 05:07 PM.

"I gladly simp for jastey" -- Aza
==========================================================
"You ever notice that "What the hell?!" is the answer to just about everything?"
==========================================================

"Girls are like phones, they like to be held and talked too, but if you press the wrong button, you will be disconnected!" DJ Nikodemus
================================================================
Community Contributions
* Level 1 NPCs * gMinion: expanded TP2 for MegaInstalls * PSM (PSQM): expanded scripts for Melanthium * Shar Nadal (DSotSC-BGT) revision * non-detectable Cloak of Non-Detection ?? * Weimer's-Tactics: revised TP2 for MegaInstalls * a directory of Mega-Installation Guides *

   
   
   


#15 ALIEN

ALIEN
  • Modder
  • 983 posts

Posted 05 August 2019 - 04:32 AM

@skellytz It's not that he isn't interested, he is simply very busy. Please continue the work and when there will be opportunity, I'm sure that you fixes will endup inside official version.


Project Infinity public BETA - mod manager for Infinity Engine games

Infinity Auto Packager - automatically generate and adds mod packages to GitHub release

Modder's Guide to GitHub - you cannot have progress without committing changes






Also tagged with one or more of these keywords: bug