Create account / Log in

How to implement player specific interactions

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

How to implement player specific interactions

Postby msoong » January 11th, 2021, 1:05 am

Hi all,

I have a game with a common board and each player have their own table in a separate player window.

I want to
1. Select something on the main map, then right click on it to select a "bring it home" action
2. Now If I am the red player, I want it to move to the red tableau, but I am a yellow player, the same action should send the same piece to the yellow tableau.

Any hints on how to go about this (or if even possible) appreciated...
msoong
 
Posts: 62
Joined: November 18th, 2015, 12:26 am

Re: How to implement player specific interactions

Postby jrwatts » January 11th, 2021, 1:33 am

You need 1 trigger action for the menu item, then 1 more for each player. The first trigger action has a menu command ("bring it home") and a key command (for example, BringItHome). The other trigger actions each look for BringItHome, with only trigger when "PlayerSide=<color>", leaving out the quotes, (or {PlayerSide=="<color>"} if you prefer BeanShell syntax), where <color> is the color for that specific player, then triggers BringItTo<color>, again, replacing <color> with the actual color.
You then need a Send To Location trait for each color, triggered on BringItTo<color>, sending it to the appropriate tableau.
jrwatts
 
Posts: 221
Joined: April 29th, 2020, 10:30 pm

Re: How to implement player specific interactions

Postby jrwatts » January 11th, 2021, 1:45 am

Actually, there's a much simpler way to do this, if your tableaus are named correctly; simply add a single Send To Location trait with the menu command "bring it home", and the destination map set to "$PlayerColor$ tableau", without the quotes (assuming the red tableau is named "Red tableau", for instance), and similar with the destination board. If you prefer BeanShell syntax, the destination map would be {PlayerColor + " tableau"}.
jrwatts
 
Posts: 221
Joined: April 29th, 2020, 10:30 pm

Re: How to implement player specific interactions

Postby msoong » January 11th, 2021, 5:13 pm

Many thanks, will try these...
msoong
 
Posts: 62
Joined: November 18th, 2015, 12:26 am


Return to Module Design

Who is online

Users browsing this forum: shilinski and 4 guests