So effectively I’m trying to play an audio clip on “level up” of a player. I could handle it different ways obviously but I have it nested in an IncreaseXP function if the player reached a certain amount of “XP” it will level up and reset XP (obviously there is checking to see if their data exists). Now my initial thought was just to use the Play(Agent) method since I already have the player getting passed as “Agent”.
Though since it’s within an “if” I get a no_rollback error trying to pass “Agent”. If I need to post a snippet I can but this is repeatable regardless of specific code. I’m just wondering if there is a way to get around this with out having to re-write how I handle player “data” that I make.
I don’t understand your issue, I think almost 1.0 functions are no_rollback so there’s nothing specific about your case, just put the call outside the “if”
I think because the way I have it. Because I have to obviously check if all my “data” exists. Which is more like:
if (ThePlayer := player[Agent]){
if (PlayerData := Data[ThePlayer]){
if: <#This might be the part that might be a problem, but without
using it like this, because of something with the <decides> effect
and "ThePlayer", it wont work#>
OldData := Data[ThePlayer]
if(OldData.TheData <= (OldData.TheData2 * 25) + 50){
#Do something, where audio could play
}else{
#Do something, where audio could play
}
}
}
Your honestly making a good point. My syntax is always messy, not a huge programmer still very “beginner” and verse is kind hard for me to understand a bit coming just knowing a little of C#.
Though doing this breaks the recognizing of the existing data and throws syntax errors because it cant find the map I gave it. It might help if I showed how I’m setting up this data on the player:
OnPlayerSpawn(Agent : agent):void = {
if (ThePlayer := player[Agent]){
if (PlayerExists := PlayerMap[Agent]){
#If The "PlayerMap" data exists, no nothing
}else{
if (set PlayerMap[ThePlayer] = spawners{}){
if (not Data[ThePlayer]){
if (set Data[ThePlayer] = player_profile_data{}){
Print("New Player Data Created")
}
}
spawn{UpdateValues(ThePlayer)}
}
}
}
}