2 workshop Issues encountered when making game mode

I’m making a gamemode that includes the advanced parkour mechanics and with pickable weapons. But at the Weapon part, I’ve encountered 2 issues.

Here’s a Variable and Rule Trees I’m focused at.

Global.PLAYER = Me (Human Player)
Global.PRIMARY_WEAPON - Players in Slot 1 (TEAM OF (Global.PLAYER))
Global.SIDE_ARM - Players in Slot 2 (TEAM OF (Global.PLAYER))
Global.CURRENT_WELDED_WEAPON - For either Primary or Sidearm Weapon Dummy Bots.

/_Create HUD for the Player
Conditions:
Has Spawned (Global.PLAYER) = True
Actions:
Create HUD Text (Global.PLAYER)
Custom String
[0] (Ammo of Global.CURRENTLY_WELDED_WEAPON)
[1] (Gap Between the Texts)
[2] (Global.PLAYER.Bullet_Time_Left)
/_Player Picks Up Weapon
Conditions:
Distance Between (Global.Player), (Global.PRIMARY_WEAPON) <= 3
Is Button Held (Global.Player), (Interact) == True
*(Disabled) Is in View Angle (Global.PLAYER), (Global.PRIMARY_WEAPON), 25 = True
Actions:
Set Global Variable CURRENTLY_WELDED_WEAPON = (Global.PRIMARY_WEAPON)

The HUD Text’s client (me) can’t seem to read the current ammo of a Dummy Bot through two variables or something, or not at all. Even when I set them directly.

Custom String
[0] (Ammo, Players in Slot, 1, (Team Of, Global.PLAYER) - Shows 0, despite the current ammo of Dummy Bot is 30 for ex.

The Hud text still reads my current ammo though when I set it to myself.

Custom String
[0] (Ammo, Global.PLAYER) - Shows my current ammo just fine.

Thus, when testing the ability to pick up weapons, Distance Between, Is In View Angle + Is Button Held conditions doesn’t seem to cooperate with each other in my case. Despite the Weapon Dummy was in the range, and in view angle and I held Interact, nothing happened. I managed to pick the dummy bot weapon up only, when I distanced myself a bit from it, while holding Interact and looking at it, near equally to the Set Distance Number of <= 3.

Is there anything I can do or bypass this… bug somehow?

Maybe try a bigger angle than 25. 45 might be a good idea.

Can you explain your issue here?

Post updated. Check below.
Reminder variable - Global.PLAYER = Me (Human Player)

Seems that Players in Slot, even though filter options are applied, returns an Array or the string formatting can’t parse and convert it properly. Could you provide your full code. Meanwhile try an alternative and assign your Bot after its creation with Last Created Entity value as reference to a variable and use that variable in the Ammo function instead of Players in Slot and try if that solves it.

1 Like

https://workshop.codes/CC6SE

HUD texts can only read the local player’s ammo. The easiest fix is to just put the player’s ammo in a variable and display the variable instead. The condition problem seems like something weird with the in view angle function. It might work better if you use a dot product instead.

2 Likes