Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Page 2 of 3 1 2 3
Rhidian #537811 06/08/14 08:19 AM
Joined: Jul 2014
member
OP Offline
member
Joined: Jul 2014
Originally Posted by Rhidian
Code
INIT
DB_JailBoolean(1);

KB Section
IF
CharacterLeftTrigger(_Char,TRIGGER_CellFloor)
AND
_Char.IsPlayer()
THEN
CharacterSetVarInteger(_Char, "LeftJail", 1);  

IF
CharacterSawCharacter(CHARACTER_Guard,CHARACTER_Player)
AND
CharacterGetVarInteger(CHARACTER_Player, "LeftJail", _check)
AND
DB_JailBoolean(_check)
THEN
Stuff


I've never used the set/getVars, so I'm not sure if that could work.


EDIITTETETEJIFDKSJLDA

ACTUALLY IT DIDNT WORK. it shows the dialog even if i didnt leave the trigger.

still curious about this question though. This whole thing is giving me a headache. Thanks for the help guys. I'm about to assume this is impossible lol.
But is there anyway to lower a characters visibility?

Last edited by Demonata08; 06/08/14 08:28 AM.
Joined: Jul 2014
member
OP Offline
member
Joined: Jul 2014
Edit: Read above >>

Oh hey with the var system it wont let me close out of the editor either. giving me a whole bunch of errors when i exit out.. Done it a few times now haha.

Last edited by Demonata08; 06/08/14 08:29 AM.
Joined: Jul 2014
enthusiast
Offline
enthusiast
Joined: Jul 2014
I was about to post a big hurray, then refreshed and saw your edit. Awww. Is visibility governed by Character.txt settings? I see that there's entries for 'Sight' and 'FOV'. Sight seems like it controls the length of the vision cone, FOV like it controls the angle? Guessing. Try forcing Sight (maybe.. Hearing also..?) to 1 and see what happens.

Oh and Rhidian, by the way. Thanks for taking the time and effort to explain your code earlier. I forgot to show my appreciation. I can't claim to fully wrap my head around what you explained, but at this point that's on me.


Escape From Smalcatraz: Steam/Nexus. Forum thread.
Joined: Jul 2014
I
iru Offline
apprentice
Offline
apprentice
I
Joined: Jul 2014
I haven't done any scripting in ages. Do you need to predefine variables in the story editor?
Could you use a simple integer to loop the IF CharacterCanSeeCharacter check until true?

My code isn't correctly written, it's simply to show my idea.

Int_EscapeValue = 0;

IF
ItemOpened(ITEM_DOOR_DungeonPrison_A_000, 1)
THEN
Int_EscapeValue = 1;

WHILE(Int_EscapeValue == 1)
IF
CharacterCanSeeCharacter(CHARACTER_LUCS_NPC_M_N_ImmaculatePrisonPatrolGuardBase_000, CHARACTER_Player2, 1)
THEN
DialogStartTwoSpeakerDialog("guardcatchkey", CHARACTER_LUCS_NPC_M_N_ImmaculatePrisonPatrolGuardBase_000, CHARACTER_Player2);
Int_EscapeValue = 3;

IF
LeftArea(DungeonPrison_A_000)
THEN
Int_EscapeValue = 4;

Last edited by iru; 06/08/14 08:44 AM.
iru #537899 06/08/14 11:00 AM
Joined: Jul 2014
member
OP Offline
member
Joined: Jul 2014
I see what your saying there. But they dont do while loops in the story editor for all i know. That'd be charscript that i cant get to function properly.

The scripts will work fine till i reload the editor then they disappear.

BUT ANYWAYS.

My belief on whats happening is it only seems to check to see if the variables are true once. and if they aren't then it doesn't trigger ever. If the guy sees me first on most of my ideas it works fine. But if i do the secondary trigger first then him seeing me which is what i need. it doesnt work.

Joined: Jul 2014
enthusiast
Offline
enthusiast
Joined: Jul 2014
Long shot, but what the hell. I'm thinking about how the game handles combat. If an enemy sees you, combat is initiated, right?

Can you code up so that the Guard has alignment "Evil NPC" when you escape the cell. When he spots you, instead of initiating combat, use that behaviour change to prompt the dialog.

Something like,

IF
CharacterLeftTrigger(CHARACTER_Player,TRIGGER_CellFloor)
THEN
CharacterSetFaction(CHARACTER_Guard,"Evil NPC");

IF
CharacterIsInCombat(CHARACTER_Guard,1)
AND
CombatGetIDForCharacter(CHARACTER_Guard,_Jailbreak)
THEN
CharacterSetFaction(CHARACTER_Guard,"Neutral NPC");
EndCombat(_Jailbreak);
DialogStartTwoSpeakerDialog("JailBreakChat",CHARACTER_Guard,CHARACTER_Player);


Like I say, a long shot!


EDIT: I think you need your character's Alignment set to Hero Player1 or Hero Player2.



Last edited by Noaloha; 06/08/14 12:47 PM.

Escape From Smalcatraz: Steam/Nexus. Forum thread.
Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
...Wait a moment. Are you starting a New Game *each* and every time you're making a change to the Story, to see if your story changes are in effect?

Because if you don't start a New Game, you will not see your changes in effect. Making changes to the Story and then loading up a save-game won't work; the Story rules for a save are defined/set only when the game starts a New Game.

I ran into this issue when I was working on my Lone Wolf mod. Zixzax was refusing to acknowledge my changes no matter how many times I loaded, but when I finally started a new game to test something else, the changes I had made earlier (that I thought didn't work) were finally in effect.

You can have your party teleport to a Trigger in your jail cell or whatever immediately after Character Creation for testing purposes.

Edit:
Revision of my earlier attempt-

Code
INIT
DB_JailBreak("LeftJail", False);


KB Section
IF
CharacterLeftTrigger(_Char,TRIGGER_CellFloor)
AND
_Char.IsPlayer()
THEN
NOT DB_JailBreak("LeftJail", False);
DB_JailBreak("LeftJail", True); 

IF
CharacterSawCharacter(CHARACTER_Guard,CHARACTER_Player)
AND
DB_JailBreak("LeftJail", _boolCheck)
AND
_boolCheck
THEN
Stuff


Last edited by Rhidian; 06/08/14 05:13 PM.
Rhidian #538237 06/08/14 06:23 PM
Joined: Jul 2014
member
OP Offline
member
Joined: Jul 2014
Originally Posted by Rhidian
...Wait a moment. Are you starting a New Game *each* and every time you're making a change to the Story, to see if your story changes are in effect?

Because if you don't start a New Game, you will not see your changes in effect. Making changes to the Story and then loading up a save-game won't work; the Story rules for a save are defined/set only when the game starts a New Game.

I ran into this issue when I was working on my Lone Wolf mod. Zixzax was refusing to acknowledge my changes no matter how many times I loaded, but when I finally started a new game to test something else, the changes I had made earlier (that I thought didn't work) were finally in effect.

You can have your party teleport to a Trigger in your jail cell or whatever immediately after Character Creation for testing purposes.

Edit:
Revision of my earlier attempt-

Code
INIT
DB_JailBreak("LeftJail", False);


KB Section
IF
CharacterLeftTrigger(_Char,TRIGGER_CellFloor)
AND
_Char.IsPlayer()
THEN
NOT DB_JailBreak("LeftJail", False);
DB_JailBreak("LeftJail", True); 

IF
CharacterSawCharacter(CHARACTER_Guard,CHARACTER_Player)
AND
DB_JailBreak("LeftJail", _boolCheck)
AND
_boolCheck
THEN
Stuff



I reload the story everytime. Usually i reload the story and the level just incase. Theres a bug with the editor that when you reload enough times while having automatic dialog it'll mess up as soon as you start and you have to restart the editor.

At least for me anyways lol. So i restart the editor every few tries.

Rhidian your newest attempt says "THEN unexpected"

IF
CharacterLeftTrigger(_Char,TRIGGER_PlayerCell)
AND
_Char.IsPlayer()
THEN
NOT DB_JailBreak("LeftJail", False);
DB_JailBreak("LeftJail", True);

IF
CharacterSawCharacter(CHARACTER_LUCS_NPC_M_N_ImmaculatePrisonPatrolGuardBase_000,CHARACTER_Player2)
AND
DB_JailBreak("LeftJail", _boolCheck)
AND
_boolCheck
THEN
DialogStartTwoSpeakerDialog("guardcatchkey",CHARACTER_LUCS_NPC_M_N_ImmaculatePrisonPatrolGuardBase_000,CHARACTER_Player2);


Noal i think the combat workaround will look really strange.. entering combat then having it stop everytime the guard sees you.

Last edited by Demonata08; 06/08/14 06:38 PM.
Joined: Jul 2014
enthusiast
Offline
enthusiast
Joined: Jul 2014
Originally Posted by Demonata08
Noal i think the combat workaround will look really strange.. entering combat then having it stop everytime the guard sees you.


Oh, if it actually procs the start-combat sequence then yeah, no good. I'm wondering if the start-combat sequence would even fire though. I have a similar(ish) code in one of my scripts and it works neatly enough, but it's slightly different in set up to your situation, so I'm not sure how it would realise itself in-game in this case. It probably won't work at all. But... it might!


Escape From Smalcatraz: Steam/Nexus. Forum thread.
Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
*Looks through Cys_General*

Looking at how the game handles the Tutorial...

Code
IF
CharacterLeftTrigger(_Char,TRIGGER_PlayerCell)
AND
_Char.IsPlayer()
THEN
DB_JailBreak(1); 

IF
CharacterSawCharacter(CHARACTER_LUCS_NPC_M_N_ImmaculatePrisonPatrolGuardBase_000,CHARACTER_Player2)
AND
DB_JailBreak(1)
THEN
NOT DB_JailBreak(1);
DialogStartTwoSpeakerDialog("guardcatchkey",CHARACTER_LUCS_NPC_M_N_ImmaculatePrisonPatrolGuardBase_000,CHARACTER_Player2);



If I'm understanding how the tutorial is done, the first IF will make a new database, and then the second IF (your event) will check whether that Database exists.

Rhidian #538355 07/08/14 02:25 AM
Joined: Jul 2014
member
OP Offline
member
Joined: Jul 2014
Originally Posted by Rhidian
*Looks through Cys_General*

Looking at how the game handles the Tutorial...

Code
IF
CharacterLeftTrigger(_Char,TRIGGER_PlayerCell)
AND
_Char.IsPlayer()
THEN
DB_JailBreak(1); 

IF
CharacterSawCharacter(CHARACTER_LUCS_NPC_M_N_ImmaculatePrisonPatrolGuardBase_000,CHARACTER_Player2)
AND
DB_JailBreak(1)
THEN
NOT DB_JailBreak(1);
DialogStartTwoSpeakerDialog("guardcatchkey",CHARACTER_LUCS_NPC_M_N_ImmaculatePrisonPatrolGuardBase_000,CHARACTER_Player2);



If I'm understanding how the tutorial is done, the first IF will make a new database, and then the second IF (your event) will check whether that Database exists.


Sorry for the late reply i had work frown

That bit of code i actually understand. I have a good feeling about it. I'll get back to you in 5 minutes smile

And yeah noel it starts the combat sequence frown


Back with your alignment suggestion i figured if it doesnt update alignment for neutral or good until the person is attacked or buff i had the idea that maybe when the player leaves the cell it would change the guard to hostile. Thinking that might proc the conversation when the guard sees the player.

Unfortunately combat starts way before the guard sees the player. Making that impossible.

Rhidian suggestion works. with a small change to charactersawcharacter(guard, player) as the player has to come first and not the guard.

Its too bad he has eyes in the back of his head though.

I really appreciate the help you two. If either of you need anything please feel free to send me a PM. i'm not the best scripter. But i'm 3d designer.

Last edited by Demonata08; 07/08/14 02:46 AM.
Joined: Jul 2014
member
OP Offline
member
Joined: Jul 2014
You know what. I take it back again. It doesnt work properly. This must be impossible right now or something. The piece of script works fine when the guard is standing still. But as soon as i do the trigger that causes him to patrol. he wont trigger dialog properly anymore. Its so strange. When i go right outside of the cell and wait for him he triggers. But if i wait in the cell for him to turn around and walk back to his start spot. i can walk in front of him and he wont do a thing.

I'm going to post my whole script for this level. My _start is the basic one with nothing really added to it.

then i have a script for my character creation that shouldnt interfere with this one. and my dungeon script.

http://pastebin.com/zbweFhBY

The timer part is the patrol. It activates when you talk to the companion. Perhaps osiris isnt good at doing two things at once.

Last edited by Demonata08; 07/08/14 02:47 AM.
Joined: Jul 2014
member
OP Offline
member
Joined: Jul 2014
Okay guys I've finally managed to accomplish a bit of what i was trying to do. The guard triggers the dialog each and everytime he sees me outside the cell. It works for the most part though its got an unfortunately large range. I can work around it though.

Not to wear out my welcome but..

Do you guys know a story editor call to force a character to stop everything hes doing? Since the patrol keeps moving even through dialog. I did a some searching and found "Characterfreeze" But it doesnt seem to do anything. And if anyone knows the proper way to use the "fadetoblack" or a similar function i could really use it. As when the guard catches my lowly character it resets everything and is hard on the eyes.

Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
You might want to place his patrol route into a .charScript or something as a Behavior that can be interrupted.

Rhidian #538453 07/08/14 06:13 AM
Joined: Jul 2014
member
OP Offline
member
Joined: Jul 2014
Originally Posted by Rhidian
You might want to place his patrol route into a .charScript or something as a Behavior that can be interrupted.


See thats my thoughts on it all together. And thats what i want to do but the scripts seem to be wildly unstable. I followed a bit on how to get scripts working with a mod>public>main>script folder. and it let me save the scripts but they dont function when attached to the character. And when the client is restarted the script is replaced with a random mess of words.

Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
For stopping the guard, you might want to take a look at
CharacterSetStill(CHARACTER_Guard)
or
CharacterGetPosition(Guard, _x, _y, _z)
CharacterMoveToPosition(Guard, _x, _y, _z, "event")

Edit:
Scripts for functions for mods have nothing to do with the Public/Main folder.

To get a script working in a mod, you need to create a Scripts folder in your Public/(Mod name)/ folder. Make an empty txt, then save as a .charScript file using NotePad or equivalent.

Then in the editor use the Script Editor to open and edit your script file (or do it outside the editor, doesn't matter). The important part is *after* you have made your script! you need to make it usable in the Editor. To do so, at the top there is a Resources Manager button. Click that, and then make a New Package for your mod. Name it whatever. Then Import your script file from your Script folder and place it within that package.

Upon doing so, you can now place your charScript file onto a character.

Edit #2:
I misread your file location. Regardless, creating a script with the Script editor is insufficient for getting the Script working with your mod. You also need to import it as a Resource.

Last edited by Rhidian; 07/08/14 06:25 AM.
Joined: Jul 2014
member
OP Offline
member
Joined: Jul 2014
Yeah i had imported it. Though not under my packaged mod. I imported it under main/script and it always caused errors.. I just now imported it under my own mod so hopefully it works

Can you see a reason why something like this wouldnt work?

#INCLUDE State_Manager

INIT
USING State_Manager

CHARACTER:__Me
TRIGGER:%Trigger1 = Guard1_dbd403c5-0d1e-49bd-9368-09734f48ef74

BEHAVIOUR

REACTION Character_Moving, 0
USAGE PEACE
ACTIONS
CharacterMoveTo(%Trigger1, 1)

I'm a bit of a noob at scripting and i know this isnt sufficient for a patrol but i just wanted to see if i could get him to move with it lol.

Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
Anything with a priority of 0 or less (like your reaction) will never occur until their priority is set higher than 0. You would need to either have it start with a higher priority, or use something else (like OnInit event) to change its priority in-game.

Rhidian #538493 07/08/14 06:40 AM
Joined: Jul 2014
member
OP Offline
member
Joined: Jul 2014
Originally Posted by Rhidian
Anything with a priority of 0 or less (like your reaction) will never occur until their priority is set higher than 0. You would need to either have it start with a higher priority, or use something else (like OnInit event) to change its priority in-game.


Actually my bad because thats not the script i had made back when i was messing with it.

This is.

INIT
USING State_Manager

CHARACTER:__Me
TRIGGER:%Trigger1 = Guard1_baab9f39-28b5-4c16-a0ac-44c8e68e144c

BEHAVIOUR

REACTION Character_Moving, 1
USAGE PEACE
ACTIONS
CharacterMoveTo(%Trigger1, 1)

EVENTS

EVENT Init
ON
OnInit()
ACTIONS
CharacterForceUpdate(1)

EVENT Died
ON
OnDie(__Me,_,_,_)
ACTIONS
CharacterForceUpdate(0)

And though the errors i was getting have stopped thanks to your advice <3 The guard refuses to move.

Also if you have a minute could you maybe explain the reactions? Are they a preset group somewhere that i tap into or is it just some random thing i specify somewhere else?

Last edited by Demonata08; 07/08/14 06:43 AM.
Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
The only thing I can think of right now (without looking at the files) would that there might be a Reaction in the State_Manager that has a higher priority (if it has reactions). Otherwise there doesn't seem to be anything obviously wrong with it.

That being said, character/item scripting is still a murky subject for me, so take my words with a grain of salt. More so since I'm not able to look at the files that the game uses right now.

Edit:
From what I can tell there are no preset reactions per se; you need to define them yourself. You can take a look at other charScript files to get a better feel of how reactions work. I suggest looking at the SkeletonKing and SkeletonQueen charScripts, since they switch their behaviors quite a lot in-game depending on the situation.

If your guard is using any other scripts, they might have a reaction with a higher priority as well.

Last edited by Rhidian; 07/08/14 06:51 AM.
Page 2 of 3 1 2 3

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5