Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
#559506 04/12/14 09:47 PM
Joined: Nov 2014
Gordyne Offline OP
apprentice
OP Offline
apprentice
Joined: Nov 2014
Noob question:

How is the best way to move the player to another trigger?

I've set:

KB:

IF
CharacterCreationFinished(CHARACTER_NULL)
THEN
CharacterTeleportPartyToTrigger(TRIGGER_Game_Beginning, "");
CHARACTER_Player1.isPlayer();
CHARACTER_Player2.isPlayer();

Then I created a Box Trigger and a Point Trigger and created another item in the story editor:

INIT:

TriggerRegisterForPlayers(TRIGGER_Box_Beginning);

KB:

IF
CharacterEnteredTrigger(_Player,TRIGGER_Box_Beginning)
THEN
CharacterMoveToTrigger(_Player,TRIGGER_Point_Arrival);


I've placed the Box trigger so that the player teleports right next to it after the character creation. I must be doing something wrong because the characters refuse to move to the Point Trigger.

Last edited by Gordyne; 04/12/14 09:50 PM.
Joined: Oct 2014
B
enthusiast
Offline
enthusiast
B
Joined: Oct 2014
You're a bit backwards on some things. I'll post some script later on tonight for you - I'm in the office at work right now and don't have access to the engine to get the scripts I wrote.

Joined: Nov 2014
Gordyne Offline OP
apprentice
OP Offline
apprentice
Joined: Nov 2014
I've modified some things.

Created a _Start Item with:

INIT:

CHARACTER_Player1.isPlayer();
CHARACTER_Player2.isPlayer();
Proc_ResetCompanions();
Proc_ExclamationMarkCleanup();

KB:

IF
GameEventSet("GAMEEVENT_GameStarted")
AND
CharacterAddToCharacterCreation(CHARACTER_Player1, 0, 1)
AND
CharacterAddToCharacterCreation(CHARACTER_Player2, 0, 1)
THEN
TimerLaunch("Doesn't Matter, just need something in the then statement", 100);
InitStory();
GoalCompleted;

IF
CharacterCreationFinished(CHARACTER_NULL)
THEN
CharacterTeleportPartyToTrigger(TRIGGER_Game_Beginning, "");

This _Start thing is a bit confusing I just use it for character creation screen and teleporting though I believe it's missing something...

Joined: Oct 2014
Location: Hogwarts
member
Offline
member
Joined: Oct 2014
Location: Hogwarts
This would be a useful tutorial; I don't know how to implement character creation either.

Joined: Nov 2014
Gordyne Offline OP
apprentice
OP Offline
apprentice
Joined: Nov 2014
There is a topic around the forums that explains it.

It's basically unpacking Main.pak and copying the CharacterCreation folder from Mods/Main/Level and Mods/Main to the respective directories of your mod.

Then rename both your player characters to Player1 and Player 2.

Finally use the code I used up above and set starting level to CharacterCreation.

Joined: Oct 2014
Location: Hogwarts
member
Offline
member
Joined: Oct 2014
Location: Hogwarts
Okay, I have that much implemented so far smile.

Joined: Oct 2014
B
enthusiast
Offline
enthusiast
B
Joined: Oct 2014
My script for character creation and teleporting to a start location:

Note that my character creation is done in the same map as the main game, the map does not have to be named CharacterCreation nor does the starting level.

_Start:
Quote

INITSECTION
CHARACTER_Player1.isPlayer();
CHARACTER_Player2.isPlayer();
KBSECTION
IF
GameEventSet("GAMEEVENT_GameStarted")
THEN
InitStory();
GoalCompleted;



Create:
Quote

INITSECTION

KBSECTION
IF
GameEventSet("GAMEEVENT_GameStarted")
AND
CharacterAddToCharacterCreation(CHARACTER_Player1, 0, 1)
AND
CharacterAddToCharacterCreation(CHARACTER_Player2, 0, 1)
THEN
TimerLaunch("", 100);


EndCreate:
Quote

INITSECTION

KBSECTION

IF
CharacterCreationFinished(CHARACTER_NULL)
THEN
CharacterTeleportPartyToTrigger(TRIGGER_TheGameBegins, "");



You're using a box trigger for something, but it's not necessary. You just need an event trigger to teleport the party to and nothing else should be needed.

Last edited by Burgee; 05/12/14 04:22 AM.
Joined: Nov 2014
Gordyne Offline OP
apprentice
OP Offline
apprentice
Joined: Nov 2014
Sorry I must have expressed myself badly.

I can teleport my characters just fine.

I want them to start walking in a given direction right after they teleport.

I'm trying to use CharacterMoveToTrigger(_Player,TRIGGER_My_Trigger)

But I can't ind a way to make it work.

Joined: Oct 2014
B
enthusiast
Offline
enthusiast
B
Joined: Oct 2014
Originally Posted by Gordyne
Sorry I must have expressed myself badly.

I can teleport my characters just fine.

I want them to start walking in a given direction right after they teleport.

I'm trying to use CharacterMoveToTrigger(_Player,TRIGGER_My_Trigger)

But I can't ind a way to make it work.


Gotcha. You're missing a couple of arguments in your function which may be causing the issue.

CharacterMoveToTrigger(CHARACTER_character,TRIGGER_trigger, INTEGER_running, STRING_event) are all required. You'd want to try it more like:

CharacterMoveToTrigger(CHARACTER_Player1,TRIGGER_My_Trigger, 0, "")
CharacterMoveToTrigger(CHARACTER_Player2,TRIGGER_My_Trigger, 0, "")

I'd use two lines on this one to ensure both characters move and I'd reference the players specifically _Player1 and _Player2 instead of just _Player

I have used this command on player characters before and it does work if done right so keep at it!

Last edited by Burgee; 05/12/14 03:24 PM.
Joined: Nov 2014
Gordyne Offline OP
apprentice
OP Offline
apprentice
Joined: Nov 2014
Hmm, strange I did just like that the first time, so I thougth my mistake was in using CHARACTER_Player1 then I changed to _Player.

I'll try again and experimento some, will soon post the results.

Thanks, btw.

Joined: Nov 2014
Gordyne Offline OP
apprentice
OP Offline
apprentice
Joined: Nov 2014
Strange it's not working...

Box_Beginning is a box trigger with 10;10;10 in size.

Point_Arrival is a point trigger.

I have _Start with the necessary code to teleport them.

As a Sub-item of _Start I have Start_Reposition with the code:

KB:

IF
CharacterEnteredTrigger(CHARACTER_Player1,TRIGGER_Box_Beginning)
THEN
CharacterMoveToTrigger(CHARACTER_Player1,TRIGGER_Point_Arrival, 0, "");
CharacterMoveToTrigger(CHARACTER_Player2,TRIGGER_Point_Arrival, 0, "");

Last edited by Gordyne; 05/12/14 05:49 PM.
Joined: Oct 2014
B
enthusiast
Offline
enthusiast
B
Joined: Oct 2014
I always use Event Triggers destinations to move players - not sure if that makes a difference but give that a shot for the move command.

Also, make sure the bottom of your box trigger is slightly under the ground so the player is 100% inside the box. If the box trigger is floating off the ground slightly it won't register the player.

Last edited by Burgee; 05/12/14 07:16 PM.
Joined: Nov 2014
Gordyne Offline OP
apprentice
OP Offline
apprentice
Joined: Nov 2014
The box trigger was floating a bit then I buried half of it.

Changed Point trigger to event trigger.

Nothing. The editor must be trolling me.

TriggerRegisterForCharacter or TriggerRegisterForPlayer command is mandatory? Doesn't the triggers register by default?

Do I have to test the new code running the game(Outside the engine) or it can be tested inside the editor? I'm testing on both.

Also, how can I see the actual box? I can see only the 3 size coords.

Last edited by Gordyne; 05/12/14 11:17 PM.
Joined: Nov 2014
Gordyne Offline OP
apprentice
OP Offline
apprentice
Joined: Nov 2014
Did it!

I found a Doc file around the web called UsefulOsirisSystems, a good source of learning smile
I thought we didn't have to specifically register triggers for players so that code line was missing.

Thanks for the box physics tips btw!

Joined: Oct 2014
Location: Hogwarts
member
Offline
member
Joined: Oct 2014
Location: Hogwarts
Triggers seem strangely inconsistent. Why must I register my character with the trigger in order for them to speak lines or walk to locations, yet I don't need to register the character if they're just teleporting to a certain spot?

Also, why does there need to be an integer?

And what's the point of the string thing ""?

Last edited by JecklynHyde; 16/12/14 03:55 AM.

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