Jump to content


Photo

Scripting Help


  • Please log in to reply
10 replies to this topic

#1 Adul

Adul
  • Member
  • 61 posts

Posted 16 December 2009 - 03:06 AM

Hello folks,

Again I'm stuck with some kit I'm trying to make. I tried searching for this specific issue in both the forum and the tutorials, but so far I haven't found anything about it. So I apologize if this has been asked before.

So I'm making a kit, and in order for it to function properly, I will need to attach a small script to BALDUR.BCS and BALDUR25.BCS.

This is roughly what the script is structured like:

IF
  //Player1 is of SOMEKIT kit
  //some other triggers
THEN
  RESPONSE #100
	//some actions
	Continue()
END

IF
  //Player2 is of SOMEKIT kit
  //some other triggers
THEN
  RESPONSE #100
	//some actions
	Continue()
END

// ... and so forth for all 6 players
So the idea is basically to detect if ANY of the players have the new kit on them, and if so, then execute some kit-specific scripting goodness on them.

The problem is that I'm not sure which trigger to use to reliably detect whether the specified player has the SOMEKIT kit. I've read that the Kit() trigger is not very reliable as it does not check the whole dword the kit is stored in. (Also, I have no idea how to replace the kit parameter with the actual integer that my kit would be assigned to in the IDS file.)

Another possible solution was to check if the specified player had a spell memorized that was to be added to the kit as a special ability, using the HaveSpellRES() trigger. However, HaveSpellRES() can only check memorized spells on the active object, and that seems to be a problem (for me anyway), because the script needs to check the condition for all 6 players.

Could you guys please help me out with this? I'm not quite sure how to proceed from here.

Thanks for any help in advance.

#2 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 16 December 2009 - 06:38 AM

So I'm making a kit, and in order for it to function properly, I will need to attach a small script to BALDUR.BCS and BALDUR25.BCS.

Is this kit something you can acquire mid-game? If not (or perhaps even if so) you should just apply the scripting it on creation in the starting areas, meaning you just have to extend maybe 3 or so areas (for SoA, ToB and BGT/Tutu). Or is this something that has to script at all times constantly? I'd advise some other sort of workaround, because anything is preferable to bloating the global scripts.

Possibly the Kit() value could be determined at install time if necessary, and replaced with the proper value when the scripts are compiled at install time (assuming you use a proper fixed kit.ids file it should work).

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#3 Adul

Adul
  • Member
  • 61 posts

Posted 16 December 2009 - 07:22 AM

Is this kit something you can acquire mid-game? If not (or perhaps even if so) you should just apply the scripting it on creation in the starting areas, meaning you just have to extend maybe 3 or so areas (for SoA, ToB and BGT/Tutu). Or is this something that has to script at all times constantly? I'd advise some other sort of workaround, because anything is preferable to bloating the global scripts.

Unfortunately, I think that the script would need to run constantly for the kit to work properly. This is because the kit relies heavily on having a "natural weapon" effect active all the time, and this effect seems to be partially bugged (meaning that it will disappear randomly at times, for example at death). The script is responsible for applying the effect back to the character should it disappear.

I guess I could simply add an innate ability for the player to use in case the natural weapons disappear, but this seems like an annoying workaround and too much micro-management to be enjoyable.

Possibly the Kit() value could be determined at install time if necessary, and replaced with the proper value when the scripts are compiled at install time (assuming you use a proper fixed kit.ids file it should work).

I suspected something like that was possible, but my scripting and WeiDU code knowledge is too scarce for me to work that out on my own. I've tried to do that, but so far with no luck. Could you perhaps show me a sample code that does something like that? I've been searching for one for some time.

Thank you for your time.

#4 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 16 December 2009 - 11:10 AM

This is because the kit relies heavily on having a "natural weapon" effect active all the time, and this effect seems to be partially bugged (meaning that it will disappear randomly at times, for example at death). The script is responsible for applying the effect back to the character should it disappear.

Oh, well in that case you just want to give your weapon or effect a timing mode of 9, which is "permanent after death" rather than the default which is just "permanent." If that's all it is then it shouldn't be necessary to gum up baldur.bcs.

I suspected something like that was possible, but my scripting and WeiDU code knowledge is too scarce for me to work that out on my own. I've tried to do that, but so far with no luck. Could you perhaps show me a sample code that does something like that? I've been searching for one for some time.

Well you probably want to read all of this (all 4 topics) if you haven't. But nowhere in that does it talk about kit.ids nor does it in the WeiDU docs, so I'm not sure how folks do it unless they do it manually. In that case, the code would just be
APPEND kit.ids ~0x#### MyKit~
Where #### is the number for your kit you picked out manually. And in that situation, you know the value because you picked it yourself. That is a rather cumbersome and conflict-prone way to do it, though. There should really be an ADD_KIT function in WeiDU that works like ADD_PROJECTILE and adds and returns the next value automatically. Maybe ADD_KIT does this already but it certainly doesn't say so.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#5 Adul

Adul
  • Member
  • 61 posts

Posted 16 December 2009 - 11:36 AM

Regarding the natural weapons, unfortunately the problem goes deeper than that. I've been trying to get along with Opcode 111 for weeks (without exaggeration) and I can honestly say that from what I've seen this effect is as unreliable as it gets. Even though the duration type is already set to 9, I will need to use scripts to regulate this effect from ending itself whenever the game deems it necessary.

I will try to look into if a kit is appended into kit.ids by using the ADD_KIT command and how to use this in my script. Thank you for the suggestion.

#6 -AG-

-AG-
  • Guest

Posted 16 December 2009 - 08:38 PM

Can't you simply fill all weapon slots with weightless unremovable copies of the same item?

#7 Adul

Adul
  • Member
  • 61 posts

Posted 17 December 2009 - 01:49 AM

Tried that. The problem was that the weapons would sometimes get deselected. E.g. even if the guy had all of his weapon slots filled with weapons, every once in a while he used unarmed attacks instead.

#8 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 17 December 2009 - 04:46 AM

Create Magical Weapon in Slot with Taimon's anti-Dispel hack?


Icen
Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#9 Adul

Adul
  • Member
  • 61 posts

Posted 17 December 2009 - 05:15 AM

I'm not familiar with that solution, but I will look into it. Thanks for the advice.

#10 Hoppy

Hoppy

    Mage Hunter

  • Member
  • 2107 posts

Posted 17 December 2009 - 12:24 PM

And in that situation, you know the value because you picked it yourself. That is a rather cumbersome and conflict-prone way to do it, though. There should really be an ADD_KIT function in WeiDU that works like ADD_PROJECTILE and adds and returns the next value automatically. Maybe ADD_KIT does this already but it certainly doesn't say so.



ADD_KIT works in WeiDU but I don't fully comprehend it yet. Example from TDD kit installation:

ADD_KIT ~Faith~
~Faith				   0		   0		   1		   1		   0		   1		   0		   0~
~Faith 0  0  0  0  3  0  0  1  0  0  0  0  0  0  0  0  3  1  0  0  3  3  1  0  0  0  0  1  1  1  1  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ~
~Faith				   0	   0	   0	   0	   9	   0~
~Faith				   0	   0	   0	   0	  -5	   0~
~Faith				   0	   0	   0	   0	   17	  0~
~Faith				   0	   0	   0	   0	   15	  0~
~Faith				   1	   0	   0	   1	   0	   0	   1	   0	   0  ~
~Faith				   0	   0	   0	   0	   0	   0	 ~
~TDD/KITS/CLABPR10.2DA~
~ K_C_HO  K_C_HL  K_C_G  K_C_D ~
~0X01000000 3~
~CL0~
~ CHAN09  *  HELM07  BAG26  RING06  RING31  *  BOOT01  AMUL20  BRAC10  BELT06  AROW11,40  BULL03,40  BOLT06,40  POTN52,5  POTN04,2  POTN14,5  HAMM07  SW1H27  STAF08 ~
SAY @21659
SAY @21659
SAY @21660

~ K_C_HO K_C_HL K_C_G K_C_D ~ probably wouldn't be needed for Adul's case since these files control kit selection at character creation. It sounds like Adul's kit is applied from the gaining of a certain item, levels or other predetermined attribute.

The other values will append to the relevant .2da files.
?May God defend me from my friends; I can defend myself from my enemies.? - Voltaire

"If you think that a size of the mod indicates an amount of bugs that it introduces and their severity you're totally wrong...
Try not to use next time a load of shitty "super-mega-improving-tweaking-revising" small mods that you have installed and try to meet Wulfgar once again."
- King Diamond


Posted Image The Definitive Guide to Trolls

"Finding food and a place to sleep is your own business. I imagine Paul the Cat should have some fun with you, too" - Potencius in The Darkest Day
"You have been warned, little bastard!" -Khelben to a young <CHARNAME>in Check the Bodies
There are those who will snivel, and offer nothing in return except criticism, meanwhile never lifting a finger to do other than to cut other peoples labor down simply for the fact that they lack the capability to put anything of their own together. -erebusant

#11 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 21 December 2009 - 06:55 AM

ADD_KIT works in WeiDU but I don't fully comprehend it yet.

I know it mods the .2da files but it does nothing with kit.ids apparently, unless it does so in the background or something.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle