Jump to content


Photo

Can I attach a script to a character class??


  • Please log in to reply
6 replies to this topic

#1 Mahng

Mahng
  • Member
  • 15 posts

Posted 14 April 2008 - 09:47 PM

Hi! Is it possible to have a character class/kit always have a script attached to it? Basically, I don't want to have a script applied only if the AI is turned on. I want it on all the time for any character of a specific class. I've searched the forums and tried to figure out as many tutorials as I could but I couldn't find the answer to this. Seems it should be possible. I'm very anxious to figure this out - any help is appreciated. Thanks!

#2 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 14 April 2008 - 10:33 PM

It really depends greatly on what you want it to do. I would advice you to really think about the fact of; whether you want to make the playing of a kit, a job or just plain fun? Cause a casual player can't just play the game if for example his reputation is 1 so every NPC he meets, attacks him... etc.

But if it's a skill(spell) you want the kit to use all the time, you first need to give him the spell and then make the spell refresh after it has been cast. Then and only then you can determine the when you want it to be casted, which in turn gives you the IF -commands. No I can't help you there. :P

Deactivated account. The user today is known as The Imp.


#3 Kaeloree

Kaeloree

    Head Molder

  • Administrator
  • 9202 posts

Posted 14 April 2008 - 11:41 PM

Jarno, please don't post unless you actually know what you're talking about.

#4 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 15 April 2008 - 12:09 AM

Dear Mahng,

I realize they might the things stated above might be confusing (since they have nothing to do with your question), so please allow me to clarify--and also answer your question:

It really depends greatly on what you want it to do.

No, it really doesn't depend on what you want to do. Regardless of whether you want the kitted character to shout "I'm [kit]!" every thirty seconds, do variable setting/checking or cast custom spells, the circumstances do not change whether you are able to assign/attach a script to a certain kit. The short answer to the question is, no matter what you want it to do, "no." There are certain workarounds that can serve the same purpose, though. (See below.)

I would advice you to really think about the fact of; whether you want to make the playing of a kit, a job or just plain fun? Cause a casual player can't just play the game if for example his reputation is 1 so every NPC he meets, attacks him... etc.

Unfortunatly, I cannot clarify this since I have no idea whatsoever of what it means. Reading several times still doesn't make it clearer, I'm afraid. However, I can assure you that it has absolutely nothing to do with your question.

But if it's a skill(spell) you want the kit to use all the time, you first need to give him the spell and then make the spell refresh after it has been cast. Then and only then you can determine the when you want it to be casted, which in turn gives you the IF -commands. No I can't help you there. :P

I believe suggestion here is somewhat equivalent to "please shoot yourself in the foot." I don't advise doing that; hence, I don't advise you to listen to any of the above.

As for your question:

As mentioned, there are several workarounds you could use. The easiest one would be to use bladur.bcs (and baldur25.bcs for ToB). It is a script that always is running (regardless of whether AI is on or off), in which you can add scripting blocks that do exactly what you want them to. You will have to ensure that these blocks only execute if the character has your kit, which is accomplished by using the Kit() identifier. So, for example, if your scripting block looks like this in your intended kit-based script:

IF
  Condition()
THEN
  RESPONSE #100
   Action()
END
...it will have to look like this if put in baldur.bcs:

IF
  Kit(Player1,3)
  Condition()
THEN
  RESPONSE #100
   Action()
END
...if intended for the PC (Player1). Please note that the kit identifier value, 3, in this case refers to the Kensai kit. This value is unique to your script and will be assigned when you use WeiDU to ADD_KIT, and you cannot know beforehand what the value will be. To work around this, it gets slightly more complicated. You may want to look at CamDawg's excellent kit-making tutorial first to understand how ADD_KIT works, and then you can use what Cam calls the "internal name of the kit" to solve the problem.

For example, if you use ADD_KIT ~mykit~, then you can do the following in your script:

IF
  Kit(Player1,%mykit%)
  Condition()
THEN
  RESPONSE #100
   Action()
END
...as long as you EXTEND_* or COMPILE the script in your .tp2 (if you're appending baldur.bcs, please use EXTEND_TOP) after you've added the kit. Make sure you use EVALUATE_BUFFER in your EXTEND_* or COMPILE statement, like this:

EXTEND_TOP ~baldur.bcs~ ~mykit/scripts/script.baf~ EVALUATE_BUFFER
It should also be noted that while this may solve the direct question you asked, there might be other ways to do what you intend to accomplish without using a script at all. In order to evaluate the situation and make sure what the best solution is, we would need to know exactly what you want to do. :)

I hope this has been a bit more informational, and that it makes sense. Please don't hesitate to reply with additional questions if there's anything you don't quite understand or are unsure about! ;)

Good luck modding! :)

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#5 Azkyroth

Azkyroth
  • Modder
  • 3496 posts

Posted 15 April 2008 - 01:23 AM

As an addendum, in case you're thinking about the "class" script slot in the CRE format, everything except the Override script is, as I recall, wiped when a character joins a party, so that's not going to help much either. (...assuming this is a joinable character, of course; we really do need more detail than this to help much, unfortunately).

As a reminder, I assume you realize that using two of every punctuation character will tend to break scripts, when you go to write them?

Edited by Azkyroth, 15 April 2008 - 01:26 AM.

"Tyranny is a quiet thing at first, a prim and proper lady pursing her lips and shaking her head disapprovingly, asking, well what were you doing (wearing that dress, walking home at that hour, expressing those inappropriate thoughts) anyway? It's subtle and insidious, disguised as reasonable precautions which become more and more oppressive over time, until our lives are defined by the things we must avoid. She's easy enough to agree with, after all, she's only trying to help -- and yet she's one of the most dangerous influences we face, because if she prevails, it puts the raping, robbing, axe-wielding madmen of the world in complete control. Eventually they'll barely need to wield a thing, all they'll have to do is leer menacingly and we fall all over ourselves trying to placate them." -godlizard


#6 Mahng

Mahng
  • Member
  • 15 posts

Posted 17 April 2008 - 01:44 PM

Thanks SConrad (and Azkyroth)! Yes, this is very informative and does answer my question. It looks to me like it will work but I will have to try it out. To get my feet wet in this modding scene, all I'm trying to do now is to make a rebalanced Shapeshifter that isn't unbalanced in the other direction (too powerful). Seemed like just a matter of adjusting innate spells and items. Basically the problems that Bioware, and that the current Shapeshifter Rebalanced mod creator had are that Magical Weapons (the claws) can always be dispelled, and if you use a real weapon, you have to settle for permitting infinite shapeshifting. In trying to resolve this, I see there is also a bug where if you "create an item in slot", a weapon in the equipped slots, it doesn't show up (it is invisible, though functional if you use a hotkey to equip melee weapon). Otherwise you have to go to the Inventory screen and physically click the weapon and set it back down. Unless perhaps someone knows how to use the "unknown" effect of "Item: (Equip Weapon)[113]"??

Other problems I want to handle include: You cannot have a casting time or cool effects when transitioning back to human (weapon switching just immediately switches you to human, which nags at my role-playing consciousness), and also the mod permits unlimited spell casting while shapeshifted. I think this is wrong (and unbalanced) - a Druid trains all his life to control the shapeshifting, mastering speaking should be a whole other matter (whereas Gnoll mages were born as Gnolls and naturally develop Gnoll linguistic skills). I know the latter can be handled by adjusting the weapon item with miscast magic or some such but I'm going for having everything the way I think it should be. I've also added effects such as a damage animation and falling down after reverting to human, confused for the 1st 3 secs of becoming a werewolf, etc.). But after a lot of messing around and adjusting, I think that I can't get exactly what I want to trigger and untrigger the werewolf form without some scripting. Probably, I will go for a script that detects the presence of the werewolf form (created by an unmovable armor item created in the armor slot when the ability is used) and the lack of presence of the werewolf paws, and if this is true (which means the paw was dispelled), than the script immediately re-casts the magical werewolf paws.

Any other views?

#7 Mahng

Mahng
  • Member
  • 15 posts

Posted 17 April 2008 - 02:30 PM

I guess Jarno is roleplaying his chaotic character. Thanks for coming Jarno. :)