Jump to content
  • 0

Comparing Player Variables


AlfyG

Question

Hi all,

 

Is there a way to compare a player variable with the same variable for another player?

 

Eg, if player A "FavColour" == player B "FavColour", then do *something*

 

For context, I'm looking to create a basic faction system using player variable to store the faction number, then use that to compare players in a PvP situation. If a player kills someone of the same faction, they lose points. Different factions, they gain points.

 

If anyone can shed light, I'd be grateful. Cheers.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

If you could do that, it would be revolutionary, It's impossible to do, and there are no plans that the intersect will ever have.

Solution: Have two global variables, then pass the value of one to one variable and the value of another to another variable and compare the two global variables and then reset the global variables

Problems:

1 - having many variables, because at least you'll need two to store the player's name, and others for other actions

2 - ESPECIALLY IN PVP you won't get the results you're looking for, because if it's a player against a player that's fine will work perfectly, but if a player uses an area spell and kills several players, there will be strange behavior, or if the player uses a projectile that pierces and kills several in a row , strange behaviors will also occur, and so on.

Test my solution and test all scenarios and see for yourself

Link to comment
Share on other sites

  • 0

Cheers Waylon. Reading around, it seems like using the global variable idea is the only way to achieve something like this, but its a bit too hacky for me. As you say, lots of chances for unexpected behaviour.

 

I find it surprising when you say that comparing two player variables directly would be impossible in intersect. I'm only starting out in dev, but it seems like pulling out and comparing two stored variables wouldn't be beyond doing, especially when it can be done indirectly in the API?

 

It's not a critique, I think the engine is amazing and what has been done so far is really impressive!

 

Thanks for your answer.

Link to comment
Share on other sites

  • 0

It's mostly that the event system was never really designed to do such a thing. It has no knowledge of any players or entities outside the player it runs the event for. 

 

Honestly I would likely go for a hybrid approach for this with both programming and events combined. Events for basic stuff and joining factions but code for the implementation of specific features related to them. 

Link to comment
Share on other sites

  • 0

Hi Cheshire. Yeah, I think that would be the way forward. As I say, its not a critique. Things are designed to work a certain way, they can't tick all boxes!

 

I'll work on some other aspects, this isn't a crucial feature atm.

 

I've asked a few questions recently, and they've been answered quickly and constructively, its really appreciated. Great community spirit ☺

Link to comment
Share on other sites

  • -1
22 hours ago, AlfyG said:

Hi all,

 

Is there a way to compare a player variable with the same variable for another player?

 

Eg, if player A "FavColour" == player B "FavColour", then do *something*

 

For context, I'm looking to create a basic faction system using player variable to store the faction number, then use that to compare players in a PvP situation. If a player kills someone of the same faction, they lose points. Different factions, they gain points.

 

If anyone can shed light, I'd be grateful. Cheers.

 

i got complete Faction/Nation System for Intersect if you interesting send pm

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...