I know how to affect all the players in island but, let’s say there is 2 players in the island and when a player presses a button, I want the other player’s class to change (even though he didn’t press the button). Is that possible?
Sure just modify the players not equal to the instigating actor.
It looks like you have a button that affects every other actor? You cannot affect just ONE other actor (unless there are only two) with the info going into the function.
To do that you’d need: OfferBoonToOtherPlayer(Grantor: actor, Recipient: actor): void
But if it’s every other actor then what you have going into the function is fine.
Thank you for your reply. Yes, only two player is the maximum limit in my island. But, I do have a doubt.
What should I fill in the place of “actor”?
If you have two players only, then one actor in the function just as you set it up originally should work.
The instigating actor is the guy pressing the button, then loop through all the actors and apply your action to everyone BUT the guy pressing the button.
I do get the theory behind what you said but I still do not know the code for looping through all the actors without affecting the instigator (I’m still new to verse and coding in general). Thanks to you I atleast theoritically understood how to do this.
The Agent object is unique, you could do a comparison between the two
The below compiles without issue, but has not been tested…
agent_grants_class(Grantor: agent): void =
for (Recipient : GetPlayspace().GetPlayers()):
if (Recipient <> Grantor):
grant_class_to(Recipient)
grant_class_to(Recipient: agent): void =
Print("In 'grant_class_to'")
Thanks you sm, I really appreciate the fact that you typed all this!
this really helps me out a lot
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.