Jump to content

Example use of "ChangeClass"


St_Vitruvius

Recommended Posts

ChangeClass(O:Object*,I:Value*Class)

 

The original class doesn't matter, so something like this:

 

IF
!Class("Bob",FIGHTER_MAGE)
Global("CDBobFighter","GLOBAL",0)
THEN
 RESPONSE #100 
ChangeClass("Bob",FIGHTER_MAGE)
SetGlobal("CDBobFighter","GLOBAL",1)
END

 

should work. Classes are from class.ids.

Link to comment
ChangeClass(O:Object*,I:Value*Class)

 

The original class doesn't matter, so something like this:

 

IF
!Class("Bob",FIGHTER_MAGE)
Global("CDBobFighter","GLOBAL",0)
THEN
 RESPONSE #100 
ChangeClass("Bob",FIGHTER_MAGE)
SetGlobal("CDBobFighter","GLOBAL",1)
END

 

should work. Classes are from class.ids.

 

A couple of questions:

By asking "If !.." you ask for the game to check if your class is NOT a Fighter/Mage, right? Sort of like java..

 

By "Bob", do you mean a reference to the character? Which reference can you use?

Link to comment

The object reference is the death variable of the object (in this case the NPC). Example:

 

IF
!Class("jaheira",FIGHTER_MAGE)
Global("CDJaheiraFighter","GLOBAL",0)
THEN
 RESPONSE #100 
ChangeClass("jaheira",FIGHTER_MAGE)
SetGlobal("CDJaheiraFighter","GLOBAL",1)
END

says basically "if Jahera is not a fighter mage, and this script hasn't run before, then: run it, change object labled "jaheira"'s class to FIGHTER_MAGE, and mark down that the script has run so it doesn't keep looping back and doing it again."

Link to comment
A couple of questions:

By asking "If !.." you ask for the game to check if your class is NOT a Fighter/Mage, right? Sort of like java..

Exactly.

 

By "Bob", do you mean a reference to the character? Which reference can you use?

Every creature file can be assigned a 'death variable' or 'script name', depending on what your editor of choice calls it. :) The DV can be used to uniquely identify the creature in scripts and dialogues.

 

Probably should've mentioned that there are more ways than the DV to reference a creature. The engine also supports several 'objects' you can use to identify targets for scripting actions and triggers. For example, Myself refers to the object running the script, or you can use more complicated goodies like NearestEnemyOf(Myself) or Nearest([PC]). More on this can be found in the IESDP.

Link to comment

I can't seem to get it to work properly.. as the game keeps crashing. Does anyone know what is wrong?

 

I'm trying to make this Bladesinger Kit. Bit I'm horribly stuck!

 

 ADD_KIT ~C!Bsinger~

 IF
  ~!Class("Myself",FIGHTER_MAGE)
Global("CDMyselfFighter","GLOBAL",0)~
  THEN
~RESPONSE #100
 ChangeClass("Myself",FIGHTER_MAGE)
 SetGlobal("CDMyselfFighter","GLOBAL",1)~
 END

 

The If-statement have been added right after I use ADD_KIT and before anything else related to the Kit. Is that wrong?

 

The rest is just a standard kit-description and should work fine.

 

The whole kit I've done so far can be found here.

Link to comment

well, some basics to get set up for the master modders, who will come in and help clarify, I'm sure:

 

according to your .rar, you are creating a bladesinger kit you have named C!Bsinger (so you have registered the prefix C! at BWL to make sure no-one else has a conflicting filename. If you haven't done this step, then you may want to set up a different designation :)). Ingame, it will show up as Bladesinger, and be available as a Kit choice on character generation. I don't know enough about kits to know whether that code is right, but it looks like you are following a template, so you may be absolutely o.k.: you may need to post it for a WeiDU Guru to double check.

 

Here is where things go astray:

The code

IF
~!Class("Myself",FIGHTER_MAGE)
Global("CDMyselfFighter","GLOBAL",0)~ //the CD is CamDawg's designation for variables; you may want to change this)
THEN
~RESPONSE #100
ChangeClass("Myself",FIGHTER_MAGE)
SetGlobal("CDMyselfFighter","GLOBAL",1)~
END

is designed to be compiled into a script called on during a game. The tp2 creates the kit; different things assign the kit for use ingame.

 

Your original question sounded like you wanted to change a kit on a character during the course of a game (say, for instance, an existing character experienced a religious conversion and the Kit associated with the religion was forced on the character). To have a character use a new kit, something completely different has to happen.

 

The quickest way to use the kit is to simply install it via tp2, as your rar has set up (or actually once you have checked the code for accuracy) - create a new character and assign the new kit. That does not need anything but the addition of the Kit to the list of kit choices.

 

I would do the same thing if I wanted to create an NPC and add the NPC to the game; create and install the kit, create a new character, assign the new kit, export the character, and edit whatever you want.

 

If you are trying to change an in-game character to a brand new kit via a script, then you would need to add something to the CLASS.2DA file that would reference your kit, and append a modified version of the script block you currently have in the tp2... wow, never mind --- this is the long and very involved/troubled way. Skip it. Go back to just creating the NPC and then spawning him/her in game. If you must change an existing NPC, it would be quicker to get some of these folks to teach you how to patch the .cre.

Link to comment

cmorgan: The bladesinger kit was a trick used by TDD (?) to introduce a multi-class kit to the game. IIRC you select a single class character, choose the bladesinger kit, and then a script would change your character to the multiclass as soon as the game started. It was funky, but it almost kinda sorta worked, much like TDD itself. :)

 

As for C!, that's also registered to me and you may want to select a different prefix. :)

 

ADD_KIT is a WeiDU command; if you're looking to add the kit via WeiDU, use the kit making tutorial. If you're looking to apply a kit via script, check about for Sim's scripting tutorial and check the IESDP.

Link to comment

Wow, well... never thought of multi-class kits; certainly never thought of assigning them via script! I learn something new every day :). Sounds like St Vitruvios is doing just what I did (and still do some times) - confusing the IESDP actions with WeiDU commands. This script-switch of class is an interesting idea, though....

Link to comment
Those tildes (~) in the script do not look right either, but that might be WeiDU ADD_KIT kind of thing (which I've never bothered with).

 

You're right--the ~ aren't wanted in the scripts.

 

As for the C!: No problem, I'll use just use the name of the kit, then..

 

Sim's Scripting Tutorial, where do I find that?

 

Try here: http://forums.pocketplane.net/index.php/topic,16217.0.html

Link to comment

I use either ConTEXT or Crimson Editor, but Notepad will do. Avoid MSWord; it tends to add hidden characters that mess up your scripts. The way to turn any one of these straight text (*.txt) documents into a compilable script or dialog file is to

save as

"all files (*.*)"

 

with the name and extension you want

 

save as...

all files (*.*)

myscript.baf

 

or

 

save as...

all files (*.*)

mydialogue.d

 

 

Then you can compile them via .tp2, or check them in NI or DLTCEP. The advantage here is you can work on scripts or dialogues on computers that you cannot install additional programs onto (like work computers... :)).

Link to comment

This is the .baf-file used in TDD, the one doing the trick:

 

IF
Global("multypart1a","LOCALS",0)
XPLT(Myself,250000)
THEN
RESPONSE #100
	ChangeClass(Myself,FIGHTER_MAGE)
	SetGlobal("multypart1a","LOCALS",1)
END

IF
Global("multypart1a","LOCALS",1)
XPGT(Myself,499999)
CheckStat(Myself,8,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",0)
	SpellNoDecRES("SPBSBL",Myself)
	ChangeClass(Myself,FIGHTER)
	AddKit(16417)
	SmallWait(5)
	PauseGame()
END

IF
Global("multypart1a","LOCALS",0)
CheckStat(Myself,9,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",1)
	SpellNoDecRES("SPBSAL",Myself)
	ChangeClass(Myself,FIGHTER_MAGE)
	AddKit(16417)
END

IF
Global("multypart1a","LOCALS",1)
XPGT(Myself,1999999)
CheckStat(Myself,11,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",0)
	SpellNoDecRES("SPBSBL",Myself)
	ChangeClass(Myself,FIGHTER)
	AddKit(16417)
	SmallWait(5)
	PauseGame()
END

IF
Global("multypart1a","LOCALS",0)
CheckStat(Myself,12,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",1)
	SpellNoDecRES("SPBSAL",Myself)
	ChangeClass(Myself,FIGHTER_MAGE)
	AddKit(16417)
END

IF
Global("multypart1a","LOCALS",1)
XPGT(Myself,3499999)
CheckStat(Myself,14,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",0)
	SpellNoDecRES("SPBSBL",Myself)
	ChangeClass(Myself,FIGHTER)
	AddKit(16417)
	SmallWait(5)
	PauseGame()
END

IF
Global("multypart1a","LOCALS",0)
CheckStat(Myself,15,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",1)
	SpellNoDecRES("SPBSAL",Myself)
	ChangeClass(Myself,FIGHTER_MAGE)
	AddKit(16417)
END

IF
Global("multypart1a","LOCALS",1)
XPGT(Myself,4999999)
CheckStat(Myself,17,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",0)
	SpellNoDecRES("SPBSBL",Myself)
	ChangeClass(Myself,FIGHTER)
	AddKit(16417)
	SmallWait(5)
	PauseGame()
END

IF
Global("multypart1a","LOCALS",0)
CheckStat(Myself,18,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",1)
	SpellNoDecRES("SPBSAL",Myself)
	ChangeClass(Myself,FIGHTER_MAGE)
	AddKit(16417)
END

IF
Global("multypart1a","LOCALS",1)
XPGT(Myself,6499999)
CheckStat(Myself,20,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",0)
	SpellNoDecRES("SPBSBL",Myself)
	ChangeClass(Myself,FIGHTER)
	AddKit(16417)
	SmallWait(5)
	PauseGame()
END

IF
Global("multypart1a","LOCALS",0)
CheckStat(Myself,21,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",1)
	SpellNoDecRES("SPBSAL",Myself)
	ChangeClass(Myself,FIGHTER_MAGE)
	AddKit(16417)
END

IF
Global("multypart1a","LOCALS",1)
XPGT(Myself,7999999)
CheckStat(Myself,23,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",0)
	SpellNoDecRES("SPBSBL",Myself)
	ChangeClass(Myself,FIGHTER)
	AddKit(16417)
	SmallWait(5)
	PauseGame()
END

IF
Global("multypart1a","LOCALS",0)
CheckStat(Myself,24,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",1)
	SpellNoDecRES("SPBSAL",Myself)
	ChangeClass(Myself,FIGHTER_MAGE)
	AddKit(16417)
END

IF
Global("multypart1a","LOCALS",1)
XPGT(Myself,9499999)
CheckStat(Myself,26,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",0)
	SpellNoDecRES("SPBSBL",Myself)
	ChangeClass(Myself,FIGHTER)
	AddKit(16417)
	SmallWait(1)
	PauseGame()
END

IF
Global("multypart1a","LOCALS",0)
CheckStat(Myself,27,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",1)
	SpellNoDecRES("SPBSAL",Myself)
	ChangeClass(Myself,FIGHTER_MAGE)
	AddKit(16417)
END

IF
Global("multypart1a","LOCALS",1)
XPGT(Myself,10999999)
CheckStat(Myself,29,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",0)
	SpellNoDecRES("SPBSBL",Myself)
	ChangeClass(Myself,FIGHTER)
	AddKit(16417)
	Wait(1)
	PauseGame()
END

IF
Global("multypart1a","LOCALS",0)
CheckStat(Myself,30,LEVEL)
THEN
RESPONSE #100
	SetGlobal("multypart1a","LOCALS",1)
	SpellNoDecRES("SPBSAL",Myself)
	ChangeClass(Myself,FIGHTER_MAGE)
	AddKit(16417)
END

 

As I can see, they check for each time the character advances to a predetermined level, changes him to a Fighter, adds his bonuses and reverts him to a Fighter/Mage again. Last of all, they add the Kit. Correct?

 

As all of the abilities the Bladesinger gains above lvl 1 are combat oriented, would it not then be easier to Make the character change class to a Fighter/Mage, then force him to take a "PURE" Fighter Kit called Bladesinger? Thus acutally making him a Bladesinger/Mage? Could be done by creating two kits, where the first handles character-creation and changes class and adds the later?

 

I once made a Fighter/Assassin via Shadow Keeper.

Link to comment

Archived

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

×
×
  • Create New...