UGX-Mods

Call of Duty 5: World at War => Tutorial Desk => Modding => Topic started by: gympie6 on September 20, 2022, 08:37:08 pm

Title: Set object visible/invisible to player explained.
Post by: gympie6 on September 20, 2022, 08:37:08 pm
In case you want to make something visible to two players,
would it be something like this?:
Code Snippet
Plaintext
card = spawn("script_model", something.origin);

players = get_players();

card SetVisibleToPlayer(players[0]);
card SetVisibleToPlayer(players[1]);

card SetInvisibleToPlayer(players[2]);
card SetInvisibleToPlayer(players[3]);
No, only the second player is able to see the card.
 
This is how it should be done:
Code Snippet
Plaintext
card = spawn("script_model", something.origin);

players = get_players();

card SetInvisibleToPlayer(players[0], false);
card SetInvisibleToPlayer(players[1], false);

card SetInvisibleToPlayer(players[2]);
card SetInvisibleToPlayer(players[3]);
The functions explained:
Code Snippet
Plaintext
- SetVisibleToPlayer(player): object is ONLY visible to that player.
 
- SetInvisibleToPlayer(player, false): object is visible to player.
 
- SetInvisibleToPlayer(player): object is NOT visible to player.
This also counts for the fx playing on that script_model. If you hide the object it is no longer visible to the player.
When you show the script_model again the fx that is being played is gone.
The only current way to show the fx is delete the script_model and play the fx on the script_model again.
 
Cod is wonderful sometimes. :facepalm2: