Greatest/least integer/real gets picked.

Xbing

New Member
Reaction score
0
is there a way to use an action on any integer/real variable that the greatest integer/real gets picked and be used for an action? any help would be greatly appreciated. if my phrasing is confusing, then let me give an example.

eg.. voting system.

easy_votes
normal_votes
hard_votes

is there a way to pick the one with the largest value and do an action with it?
 

Lehona

New Member
Reaction score
12
votes = normal_votes

if easy_votes > votes
votes = easy_votes

if hard_votes > votes
votes = hard_votes

Now do whatever you want with that variable 'vote'.
 

canons200

New Member
Reaction score
50
yup, set easy vote 1 point(integer), normal 2 point (integer), hard 3 point (integer)

then do your action.
 

Xbing

New Member
Reaction score
0
yeah thats the current method i know... (its not a voting system by the way, the variables are NOT defined nor fixed, they are of distance from a unit to any unit that is in 2500 range around it.)

edit: i don't think there are any solutions for this is there?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Sure there is... Pick all units within 2500 range, set a "Real" variable to some VERY high value (1000000), and then compare the distance between each unit and the caster (Or whatever the "middle" unit is :S) and see if it's lower than that "Real" variable.
If so, set that current distance to that variable, and a "Unit" variable to the (Picked unit) and there you'll have the unit closest to the caster.

Just do everything the opposite for the unit furthest away ;)
 

canons200

New Member
Reaction score
50
?? what are you taling about? it is voting system, when a player click easy, use another variable to record it. i give you example

event time elaped is 10 seconds.

if condition hard mode is greater than medium AND hard mode is greater than easy, then do your action, same to other mode.
 

Xbing

New Member
Reaction score
0
that is for fixed variable.

Komaqtion stated a very good method. So i pick all the units within 2500, and for every unit i compare it to the 1000000 "real" and change the value if its lower, and so in the end the one with the lowest value would end up being the one selected, and i would have to change the "real" to 0 if it was to be getting the greatest value and compare and get the highest vaule. am i mistaken in any way?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Exactly ;)

You also (As I said, and you might have gotten it) need a unit variable, so you know which unit it is ;)
 

Xbing

New Member
Reaction score
0
yep i just have to if - distance from picked unit to source unit < "real"
then - set the unit to picked unit

thanks!:D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top