Jump to content

Some questions about scripts


Luke

Recommended Posts

1) I'd like to make a certain summoned CRE act as if it were a "Familiar". This is my script:

 

 

IF
OnCreation()
THEN
RESPONSE #100
  ChangeEnemyAlly(Myself,FAMILIAR)
  MakeGlobalOverride()
  AddFamiliar()
END

 

 

 

My question is: is action ChangeEnemyAlly() useless since there is AddFamiliar()?

 

2) When patching existing game scripts (e.g., baldur.bcs), is it better to use EXTEND_TOP or EXTEND_BOTTOM?

Link to comment

1. I use both to make a familiar out of my "normally spawned" NPC. (Private project)

 

2. It is better to use EXTEND_BOTTOM. If for some reason you need it to be EXTEND_TOP, always (like, ALWAYS) add a "Continue()" to the end of your script. In your script above you use "OnCreation()" which only gives true if the area is newly loaded. You might want consider using a unique checkvariable instead.

Edited by jastey
Link to comment

1. I use both to make a familiar out of my "normally spawned" NPC. (Private project)

 

2. It is better to use EXTEND_BOTTOM. If for some reason you need it to be EXTEND_TOP, always (like, ALWAYS) add a "Continue()" to the end of your script. In your script above you use "OnCreation()" which only gives true if the area is newly loaded. You might want consider using a unique checkvariable instead.

Thanks for answering.

The previous script is attached to a CRE and it is the first script block (it must give true only when the CRE is summoned......)

 

As far as EXTEND_TOP/BOTTOM is concerned, I guess I'll stick with EXTEND_BOTTOM if it's better (the script block that I'd like to add to baldur.bcs doesn't make use of OnCreation()......)

 

Separately, I noticed that if the class (offset 0x0273) of the previous CRE is, say, THIEF, then that CRE is not a Thief when it's summoned (the action bar lacks the Stealth button, the Find Traps button and the like....) ---> it becomes a Thief only after entering a building (or changing area). Why?

Link to comment

Oh, I wasn't even aware OnCreation() can be used for a newly created cre. Heh.

 

To the cre question: I can only speculate. Maybe the class with according attributes is not properly assigned to the cre and therefore the buttons only show after the game reassigned the cre in some way after moving it to another area - but I don't know.

Link to comment

To the cre question: I can only speculate. Maybe the class with according attributes is not properly assigned to the cre and therefore the buttons only show after the game reassigned the cre in some way after moving it to another area - but I don't know.

What do you mean by properly assigned? This is my assignment: WRITE_BYTE 0x0273 4.

 

Moreover, I noticed the same happens if I write:

 

 

IF
OnCreation()
THEN
RESPONSE #100
  ChangeClass(Myself,THIEF)
END

 

 

 

However, if I open the CRE file in NearInfinity, everything seems to be correct, so I really can't understand......

Edited by Luke
Link to comment

I was referring to a hand-made cre file of some sort. In your case, maybe assigning the class is not "enough" to make it a real thief with all the buttons etc., and as soon as the engine reassembles the cre file it is corrected. (Same for kicking out of teh group and rejoining etc.)

But I don't know enough to really help you.

 

The only thing I could think of is a workaround: spawn your cre in another area and let it EscapeAreaMove to where you want it.... But that's a very unprofessional hack and only makes sense if the NPC isn't in teh party already, of course.

Edited by jastey
Link to comment

I *think* buttons are connected to the animation.

I don't think so.....

 

I tried changing the class of the ghast summoned by Tiax to Thief and when he summons it, all the buttons are there..... So there is probably something wrong with my script (1st post), but it's really odd (anyway, the animation of my CRE is GREATCAT_LEOPARD....)

Edited by Luke
Link to comment

Well, try changing the animation of *your* creature to ghast and see if it makes a difference.

The problem seems to be related to my script (1st post): if I don't assign it to my CRE and change its allegiance to 5 (controlled), then all the buttons are there......

But what is wrong with my script!?

Link to comment

So, the problem is due to the action AddFamiliar() ----> this action temporarily sets all of a creatures non-EA values to 0 (GENERAL, CLASS, RACE, GENDER, ALIGNMENT, SPECIFICS). Anything that forces that character's action-bar to update itself will revert the creature to it's normal values (and action-bar).

For example:

  • Casting a spell from a quick-spell slot (needs to update the quantity)
  • Changing the spell in a quick-spell slot
  • Using a quick-item with quantity/charges

Then re-select the character. (courtesy of @kjeron)

Link to comment

2. It is better to use EXTEND_BOTTOM. If for some reason you need it to be EXTEND_TOP, always (like, ALWAYS) add a "Continue()" to the end of your script.

The following script

IF
    Global("gt_dead","global",1)
    Kit(Player1,GTBSMS)
    AreaType(16)
    PartyRested()
    THEN
        RESPONSE #100
            ActionOverride(Player1,AddSpecialAbility("GTALLY")
            SetGlobal("gt_dead","global",0)
END
doesn't work if I use EXTEND_BOTTOM (i.e., when it's added at the bottom of baldur.bcs....). Instead, if I use EXTEND_TOP (plus the action continue()), then it works fine..... Why? Edited by Luke
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...