Jump to content

2 scripting questions: race check and class change


subtledoctor

Recommended Posts

I'm trying to do something a little crazy, probably by the old invisible monster trick.

 

Part one is, I'd like the script triggered by the monster do different thing depending on the summoner' race. Is that possible? Something like, if race = human then do X, if race = elf then do Y.

 

Second: if the race is a demihuman, I'd like the script to actually change the summoner' class, specifically from a single-class to a multiclass (eg a fighter uses an item and becomes a fighter/cleric).

 

I know that sounds crazy and could create all sorts of issues that I would have to test. But the first question is whether it's even possible. Is there a class script function analogous to addkit/addsuperkit?

Link to comment

Yes. Usually the LastSummonerOf(Myself) works wonders in the script targeting as that's where & how the summoned invisible creature comes to play.
To get that in to the game, you just make an item or a spell that uses a particular .eff with the use eff opcode(177), you then just make the eff that summons the invisible .cre file(67), in my case it's always the same "invicre.cre" just renamed... you can have mine from here.
Class change script (the .bcs script file name):

  IF
    Global("uglyuglyevilp1","GLOBAL",0)
    Race(LastSummonerOf(Myself),ELF)
    Class(LastSummonerOf(Myself),FIGHTER)
  THEN
    RESPONSE #100
      SetGlobal("uglyuglyevilp1","GLOBAL",1)
      ChangeClass(LastSummonerOf(Myself),8)
  END 

8 = FIGHTER_CLERIC ... of course it needs the DestroySelf() at an end of the script composition.

Remember that you can add as many different GLOBAL + Race + Class combos as required for the different changes to the same script and you are on your way ... by the by, do you have an invisible creature .cre file ? I do, and I can upload it if you wish.

Part of the .tp2 code:

COPY ~modname/invicre.cre~ ~override/yourcres_name.cre~
  WRITE_ASCII ~0x0248~ ~somethi1~								//Override script .bcs files name
  WRITE_ASCII ~0x0280~ ~somethi2~								//Death Variable
Link to comment

by the by, do you have an invisible creature .cre file ? I do, and I can upload it if you wish.

Yes I have one I can adapt, from my kensai weapon focus component - thanks though.

 

I'm a bit confused, what purpose is that "GLOBAL" line serving there?

 

I'm also not sure what the .tp2 language does, unless it has to do with using different scripts with a single invisicre. (Newb that I am, I have been keeping everything separate, a different .cre for each component, and decompiling a different .baf for each .cre)

Link to comment

I'm a bit confused, what purpose is that "GLOBAL" line serving there?

 

I'm also not sure what the .tp2 language does, unless it has to do with using different scripts with a single invisicre. (Newb that I am, I have been keeping everything separate, a different .cre for each component, and decompiling a different .baf for each .cre)

The .tp2 code is there for the utility, I edit the code in the usual places: "modname", "yourcres_name", "somethi1" and "somethi2", and I can use the very same creature and tp2 code in all my mods .. that there are about 12. The .eff and it's user need to be remade, but that's quite easy most of the time, when you have these already.

The GLOBAL's actual name I dropped out of my hat... it just needs to be something original, and it ensures that the actions can be followed among other things... like you can destroy the creature upon it turning to a number of choice. I usually use GLOBALs even when not needed. To track things ...

Link to comment

Is this in the clab? The easiest way is to use apply eff by race. I have done it by alignment, and by gender and race (ie, check for gender, then race).

 

You can use a single spell in the clab that applies effs by race each of which summons different creatures that each does a different thing (or gives different options). You can cut down the scripting by doing it this way.

 

Anyway, I have a working template at home that I would be happy to share. It is partially based off of your work after all

Link to comment

You can use a single spell in the clab that applies effs by race each of which summons different creatures that each does a different thing (or gives different options). You can cut down the scripting by doing it this way.

Erhm, yeah, but considering that there won't be only one but dozens of different creatures that run dozen different scripts that all have different end results if they apply and if they won't, they "die". On a good day you won't notice anything. But on a bad day, there's things flying and skeletons attacking the "invisible" creatures and things get worse by the second ... and the lag monster, it smiles.

There's other ways to do things than a clabxxxx.2da file. That's actually pretty much the worst ...

You can check the area and a GLOBAL, summon a invisible creature right next to the PC, or approach the PC and then "speak" to the player, or you could even make a small dream theater which gives the options to choose in dialog and go from there.

Link to comment

Is this in the clab? The easiest way is to use apply eff by race. I have done it by alignment, and by gender and race (ie, check for gender, then race). You can use a single spell in the clab that applies effs by race each of which summons different creatures that each does a different thing

Whoa, that's actually genius - I never thought about using .eff effects to differentiate by race, I was going to do it with an item that has restricted usabilities.

 

I might as well come clean at this point, though I want to keep this kind of hush-hush over on the other boards. One of the points of this work has to do with multiclass kits. For instance I am going to prevent Rangers from dualling to clerics; but I will make an item, a "totem of Mielikki" that will addsuperkit the user into a "Woodscout of Mielikki" ranger kit that can dual to cleric; this is my way of rationalizing the R-C's druid spells, it's a special dispensation for being a priest of Mielikki. (Woodscouts are specialty priests that have Ranger abilities in 2e, so using a multiclass kit in BG2 is a good way to simulate that.)

 

It's a tougher question for demihuman R/Cs though, so I figured I would have the totem change a half-elf ranger into a multi R/C with the Woodscout kit.

 

But instead I can just apply spell effect via eff that targets R/Cs only, and if they are half-elves they will immediately get the Woodscout kit, and if they are full elves they'll become a Forestwalker of Rillifane Rallathil. (With the same benefit, access to druid spells - that one I made up myself.)

 

And Jarno, no worries about too many extra invisicres, since this will only happen once, at CharGen. (Yes I could attach it to the Candlekeep/Chateau Irenicus area scripts as well, but this seems like it should work fine.)

Link to comment

And Jarno, no worries about too many extra invisicres, since this will only happen once, at CharGen. (Yes I could attach it to the Candlekeep/Chateau Irenicus area scripts as well, but this seems like it should work fine.)

Yeah, it was nice to see how well the BG2 handled the char creation aftermath without the fixes when you had BGT, CtB, TDD, NEJ, Finn-Jo's subraces etc and etc installed on the game. LET ME TELL YOU, IT DIDN'T go so smoothly. At all.
Link to comment

...that is quite a big install.

 

You may be able to change class in the clab/itm as well. There is an effect that lets you change ids state--looks like 72. You can probably apply that without the summoned creature, probably in the same spl/itm file. (just do it before you summon the creature). You would use the same app eff opcode.

Link to comment

So I have this script to shuffle ranger/clerics who are elves, on the one hand, and those whoa re not elves, on the other hand, into the right kit.

 

IF
    Race(LastSummonerOf(Myself),ELF)
THEN
    RESPONSE #100
        ActionOverride(LastSummonerOf(Myself),AddSuperKit(D5RILLI))  
        DestroySelf()
END
IF
    !Race(LastSummonerOf(Myself),ELF)
THEN
    RESPONSE #100
        ActionOverride(LastSummonerOf(Myself),AddSuperKit(D5MIELI))  
        DestroySelf()
END

 

It sets the kit correctly, but keeps running over and over and over again. I'm completely new to BCS scripting... what did I do wrong? How do I make the invisicre appear once, do its thing, and then die for good?

Link to comment

It sets the kit correctly, but keeps running over and over and over again. I'm completely new to BCS scripting... what did I do wrong? How do I make the invisicre appear once, do its thing, and then die for good?

 

I don't know why the script would continue executing after the attached creature was killed with DestroySelf(), but you can prevent a script block from repeating by checking and setting a variable.

IF
    Global("AddedKit","LOCALS",0)
    Race(LastSummonerOf(Myself),ELF)
THEN
    RESPONSE #100
        SetGlobal("AddedKit","LOCALS",1)
        ActionOverride(LastSummonerOf(Myself),AddSuperKit(D5RILLI))  
        DestroySelf()
END

IF
    Global("AddedKit","LOCALS",0)
    !Race(LastSummonerOf(Myself),ELF)
THEN
    RESPONSE #100
        SetGlobal("AddedKit","LOCALS",1)
        ActionOverride(LastSummonerOf(Myself),AddSuperKit(D5MIELI))  
        DestroySelf()
END
Link to comment

Archived

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

×
×
  • Create New...