Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Jul 2014
Z
stranger
OP Offline
stranger
Z
Joined: Jul 2014
I've setup a basic script where if the party enters a trigger, a combat will start.

Code
IF
CharacterEnteredTrigger(_player,TRIGGER_HIB_ZombieAmbush)
THEN
TriggerUnregisterForPlayers(TRIGGER_HIB_ZombieAmbush);
CharacterAppear(CHARACTER_HIB_ZombieAmbush_1,1);
CharacterAppear(CHARACTER_HIB_ZombieAmbush_2,1);
CharacterAppear(CHARACTER_HIB_ZombieAmbush_3,1);
CharacterAppear(CHARACTER_HIB_ZombieAmbush_4,1);


As you can see I used a generic variable _player. The issue with this script is that if more the one player enters the trigger, it repeats the commands CharacterAppear(). This usually happens when the party is linked and multiple characters enters the trigger almost simultaneously.

Any solutions guyz? :x

Joined: Jul 2014
enthusiast
Offline
enthusiast
Joined: Jul 2014
What would happen if you replaced 'CharacterAppear' with the 'CharacterSetOnStage' call? (Obviously with the INIT prep of positioning and setting them off stage prior.)


Escape From Smalcatraz: Steam/Nexus. Forum thread.
Joined: Jul 2014
Z
stranger
OP Offline
stranger
Z
Joined: Jul 2014
Uhm, the problem with the second one is that the NPC will not play their spawn animation frown

Joined: Aug 2014
stranger
Offline
stranger
Joined: Aug 2014
For your INIT, did you use TriggerRegisterForPlayers or TriggerRegisterForCharacter?

Just thinking that if you used TriggerRegisterForCharacter in your INIT and TriggerUnregisterForPlayers in KB, that may be the problem.

Joined: Jul 2014
Z
stranger
OP Offline
stranger
Z
Joined: Jul 2014
No the INIT section is correct ;(
I don't know, the script is similar to the video-tutorial one and that doesen't seems to have the same issues.

Joined: Jul 2014
member
Offline
member
Joined: Jul 2014
I dont't know the rest of your script or how your story is setup. But heres my guess on it

First if you used triggerregisterforplayers with _player and you don't have _player.Isplayer() in the _start Then it doesnt know who _Player is.


So first off start with uppercasing _Player. Just like i typed it. if your start script is right it will work.. If it doesnt try this
IF
CharacterEnteredTrigger(_Player,TRIGGER_HIB_ZombieAmbush)
AND
_Player.IsPlayer()
THEN
CharacterAppear(CHARACTER_HIB_ZombieAmbush_1,1);
CharacterAppear(CHARACTER_HIB_ZombieAmbush_2,1);
CharacterAppear(CHARACTER_HIB_ZombieAmbush_3,1);
CharacterAppear(CHARACTER_HIB_ZombieAmbush_4,1);
TriggerUnregisterForPlayers(TRIGGER_HIB_ZombieAmbush);

More then likely its just that capitalization error that is your problem.

Last edited by Demonata08; 08/08/14 07:17 PM.
Joined: Jul 2014
Z
stranger
OP Offline
stranger
Z
Joined: Jul 2014
In my _Start INIT section I have both player1.isPlayer(); and player2.isPlayer();. Even with the addition of the second condition and uppercasing _Player the result is the same. I really don't know what I should do frown

Joined: Jul 2014
member
Offline
member
Joined: Jul 2014
Originally Posted by ZakMcKracken
In my _Start INIT section I have both player1.isPlayer(); and player2.isPlayer();. Even with the addition of the second condition and uppercasing _Player the result is the same. I really don't know what I should do frown


I've had strange results with character appear too. As well has having osiris do the same function in a row a couple times seems to hold it up sometimes.

Try restarting the editor first. If that doesnt work ill give you a code that should work.

Oh and also what kind of trigger are you using?

edit: its not the player1isplayer that you need

You have to make _Player reference to the player. So somewhere you have to put _Player.IsPlayer() Not in the init though. Make it where the gamestart event is.


If none of that works heres a code that should work.


IF CharacterEnteredTrigger(_Player, TRIGGER_HIB_ZombieAmbush)
THEN
TriggerUnregisterForPlayers(TRIGGER_HIB_ZombieAmbush);
TimerLaunch("1", 100);

IF TimerFinished("1")
THEN
CharacterAppearAtTrigger(CHARACTER_HIB_ZombieAmbush_1,TRIGGER_Something1,1);
CharacterAppearAtTrigger(CHARACTER_HIB_ZombieAmbush_2,TRIGGER_Something2,1);
TimerLaunch("2", 100);

IF TimerFinished("2")
THEN
CharacterAppearAtTrigger(CHARACTER_HIB_ZombieAmbush_3,TRIGGER_Something3,1);
CharacterAppearAtTrigger(CHARACTER_HIB_ZombieAmbush_4,TRIGGER_Something4,1);

Make 4 individual point triggers where you want them to spawn.

Change the TRIGGER_Something to whatever those triggers will be.

I doubt the timers are needed but. Just incase laugh

Last edited by Demonata08; 08/08/14 07:54 PM.
Joined: Jul 2014
Z
stranger
OP Offline
stranger
Z
Joined: Jul 2014
It actually works with CharacterAppearAtTrigger(). My only comment on this whole thing: WTF!?!!!?!?

PS: Btw. the line _Player.isPlayer() was giving me an error, so I didn't used that.

Last edited by ZakMcKracken; 08/08/14 08:23 PM.
Joined: Jul 2014
member
Offline
member
Joined: Jul 2014
Originally Posted by ZakMcKracken
It actually works with CharacterAppearAtTrigger(). My only comment on this whole thing: WTF!?!!!?!?

PS: Btw. the line _Player.isPlayer() was giving me an error, so I didn't used that.


Heh yeah i misread my start. Thats actually a condition not a call. My bad! But i'm glad its working for you. I was looking at a few times i used appear and i never used just appear. I always used the appearattrigger.

Anyways! Glad i could help. have fun laugh


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