Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
#560388 26/12/14 06:05 PM
Joined: Oct 2014
Location: Hogwarts
member
OP Offline
member
Joined: Oct 2014
Location: Hogwarts
I'm trying to get the fade to black script to work, but I'm getting two errors: conflict with function definition and error in rule THEN-part.

FadeToBlack((Character)_character,(REAL)_Seconds,(INTEGER)_ToBlack)

IF
GlobalEventSet("CaughtStealing")
THEN
CharacterTeleportPartyToTrigger(TRIGGER_Prison_P1,"");
CharacterTeleportToTrigger(CHARACTER_Guard, TRIGGER_Prison_Guard,0,"");
FadeToBlack(CHARACTER_Player1,500,1);

Joined: Dec 2014
journeyman
Offline
journeyman
Joined: Dec 2014
Move all the THEN commands to a PROC function.

Ex :

IF
GlobalEventSet("CaughtStealing")
THEN
ProcYourFunctionName(Variable1,Variable2...)

PROC
ProcYourFunctionName((VariableType)_Variable...)
THEN
CharacterTeleportPartyToTrigger(TRIGGER_Prison_P1,"");
CharacterTeleportToTrigger(CHARACTER_Guard, TRIGGER_Prison_Guard,0,"");
FadeToBlack(CHARACTER_Player1,500,1);

Joined: Aug 2014
old hand
Offline
old hand
Joined: Aug 2014
I'm not sure if you need to make it a PROC. I think you need to make the bool for FadeToBlack 0, not 1. Wiki says it's opposite of what you would expect, 0 fades to black, 1 fades back in.

Joined: Oct 2014
Location: Hogwarts
member
OP Offline
member
Joined: Oct 2014
Location: Hogwarts
@Baardvark: Switching the bool from 1 to 0 still produces the same error unfortunately.

@TheMasterRat: I'm not quite sure how the PROC command works. When I input the word Proc the only thing that appeared was PROC in yellow. What information should I put in ProcYourFunctionName(Variable1,Variable2...)?

Joined: Aug 2014
old hand
Offline
old hand
Joined: Aug 2014
Wait, what's going on with the the quotes at the end of these lines?

CharacterTeleportPartyToTrigger(TRIGGER_Prison_P1,"");
CharacterTeleportToTrigger(CHARACTER_Guard, TRIGGER_Prison_Guard,0,"");

Is that how you make variables for strings? If so, maybe the script is confused because they're trying to make the variable the same for those two different commands. I would think you'd have to fill in the strings with something, at least "_Event."

Do you still get the same problems if you take away the FadeToBlack call? Try each line by itself and see if you get the errors.

And you've made all these things global, right? And made sure you're using all the right names and stuff...

Joined: Dec 2014
journeyman
Offline
journeyman
Joined: Dec 2014
@Baardvark You are right, moving it to Proc doesn't change anything. I thought it was one of those functions called only in Proc commands.

@JecklynHyde

For your error, it's simply that the function FadeToBlack() takes REAL seconds as second argument, which means a number with a decimal. The error reported by Osiris was complaining that the definition was changed. That means that one of your variable is the wrong type.

FadeToBlack(CHARACTER_Player1,500.0,1);

For scripting references, these tutorials helped me a lot!
http://www.larian.com/forums/ubbthreads.php?ubb=showflat&Number=521809#Post521809

Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
Instead of the empty String literals "" (double quotes), try using an underscore _ at the end of the teleport lines.

Edit: Actually, that probably won't work because it's an unbound variable where a String is supposed to go.

Edit: What's that 0 doing in the CharacterTeleportToTrigger function? That's probably where the conflict with function definition error is coming from.

Last edited by Rhidian; 26/12/14 08:34 PM.
Joined: Oct 2014
Location: Hogwarts
member
OP Offline
member
Joined: Oct 2014
Location: Hogwarts
Adding the decimal allowed the build to complete without an error, but the fadetoblack effect still doesn't show up. Could this problem be occurring because I'm making a custom module?

FadeToBlack(CHARACTER_Player1,500.0,1);

I removed the quotation marks ^

Last edited by JecklynHyde; 26/12/14 08:36 PM.
Joined: Aug 2014
old hand
Offline
old hand
Joined: Aug 2014
http://www.divinityengine.net/index.php?title=FadeToBlack

FadeToBlack(CHARACTER_Player1,500.0,0)

Remember, put a 0 at the end, not a 1. Also, is the timer actually in seconds, or is it miliseconds? If it's in seconds, it might take almost 10 minutes to fade out with 500 in there. Put it down to 5.0 to make sure.

Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
There shouldn't be a 0 in the CharacterTeleportToTrigger function. It doesn't use an integer as an argument.

Edit:
So the script should look like this:
Code
IF
GlobalEventSet("CaughtStealing")
THEN
CharacterTeleportPartyToTrigger(TRIGGER_Prison_P1,"");
CharacterTeleportToTrigger(CHARACTER_Guard, TRIGGER_Prison_Guard,"");
FadeToBlack(CHARACTER_Player1,5.0,0);

Last edited by Rhidian; 26/12/14 09:18 PM.
Joined: Oct 2014
Location: Hogwarts
member
OP Offline
member
Joined: Oct 2014
Location: Hogwarts
The problem was the timer thanks laugh


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