Sign in to follow this  
CapitaineSpoque

Help scripting training ground K1

Recommended Posts

Hi there !

So the plan is to introduce a new npc "trainer", that will teach and grant hand to hand combat feat in k1. There would be some fights to win, with rules, similar to handmaidens sparring on Telos/Ebon Hawk. How i'm going to pull this out :

- The hand to hand combat feat is a hidden item in the character sheet, that works only when unarmed. The item in itself provides the feat.  The idea would be to destroy the previous item and create the new one through scripting.

- Set a global variable in globalcat.2da to know the state of the training

- Check PC level to be sufficient + global state for the training to fire the desired dialogs (training 1,2,3 ...)

- As i can't set proper forfeit conditions, i decided to do something else. When the fight starts, a script strips the character from equipped items (besides our hidden items), the inventory and drops it to a a nearby footlocker. I set up a trigger in the .git with a script that fires OnExit, it would start a defeat dialog like "You can't run away".

- I would set player character and sparing partner min1hp to true, so both cannot die. 

I got 3 questions :

- Is it possible to check if the player use force power during the fight ? This is the only conditional left for my fighting rules

- Regarding the script that fires OnExit for the trigger area, is it possible to fire a dialog option from a current dialog file, or do i need to make it a separate dialog ?

- How to check if the player character or the sparring partner hit 1 hp, to properly fire the defeat/victory dialog ?

Thanks,

Share this post


Link to post
Share on other sites
6 hours ago, CapitaineSpoque said:

Is it possible to check if the player use force power during the fight ?

Give the opponent a custom UserDefine (you can use the vanilla k_def_userdef01 as a starting template). Event 1010 (on spell cast at) should let you catch the character being affected by a Force power. Their OnSpawn script will need the inclusion of GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_FORCE_AFFECTED).

6 hours ago, CapitaineSpoque said:

How to check if the player character or the sparring partner hit 1 hp

Basically the same way as above, but with other events. There are a multitude of vanilla examples of this happening in both games, and the TSL sparring ring on Dxun and/or sparring with the handmaidens on Telos should give you pretty much exactly what you want, differences in script functions between the games aside. In the opponent's 1006 event (on damaged), have it check its current health status. This will require the addition of GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DAMAGED) to its OnSpawn. To catch the player, you'll also have to use the opponent's UserDefine, since you can't do anything with the player themselves. That can go in event 1003 (on end of combat round) and basically works identically the opponent's own health check, but checking the PC's health instead. This will require adding GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_COMBAT_ROUND_END) to their OnSpawn. Look at TSL's k_fab_dueluser (vanilla and TSLRCM versions) and k_dojo_ud (vanilla and TSLRCM are the same I believe) for guidance.

6 hours ago, CapitaineSpoque said:

Regarding the script that fires OnExit for the trigger area, is it possible to fire a dialog option from a current dialog file, or do i need to make it a separate dialog ?

That's what starting conditionals are for. Add the necessary branches at the top of the DLG and gate them with the required starting conditional check. Typically you'll be doing this via setting local booleans (SW_PLOT_BOOLEAN_01 - 10, etc.). Every major dialogue does this, so you have plenty of potential examples to look through. But if it's easier to use separate DLGs then you just call those when triggering the DLG. Whichever way you prefer.

6 hours ago, CapitaineSpoque said:

I set up a trigger in the .git with a script that fires OnExit, it would start a defeat dialog like "You can't run away".

You could also physically block them leaving by spawning in some of the vanilla placeable walkmeshes. In TSL you could just create a custom one, but you don't want to be adding new placeables in K1 due to the 2DA row limit issue, so you'd have to spawn in a bunch of the vanilla ones and arrange them to suit. PLC_Blockage is one, which is a 6m long rectangle (so a bit unwieldy). There are some smaller ones like PLC_CageLgB which are intended for use with force cages and the like. Blocking them would let you switch the trigger to firing a bark bubble message about not running away instead of actively ending the combat.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you very much im gonna try things out

EDIT = So thx to you i'm on the right track. however :

  •  the even "spell cast at" only works for spell casted on the target right ? If i wish to check if the player self casted spells or buff, i may need something else ? Like check at the end of the combat round (1003) if the player has a spell (GetHasSpellEffect()) ? But i would need to fill the int for the spell right ? Or maybe i can try to get an even spell cast at but not directed toward the creature but the pc ?

 

 

Share this post


Link to post
Share on other sites

You can have a look at how they do it TSL for the Academy and Dxun sparring. At a guess, someone's OnHeartbeat is probably listening for the PC using powers. In either the opponent's OUD or maybe another NPC or an invisible placeable. Potentially even in the module's OnHeartbeat, but I'm not sure if that's necessary.

Edit: Ah, Obsidian added a dedicated function for it in TSL, SetForfeitConditions. Makes sense, but obviously that doesn't exist in K1. You'll have to try and manually catch the PC casting. You can probably just do a check in the OnHeartbeat for the PC casting at either the opponent or themselves.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

Sign in to follow this