Author Topic: Modifying another player's VCE variables?  (Read 2069 times)

I am in the middle of making what is effectively a control point using VCE, and would like to know how one would allow the control point to remember the control point's last player owner, and then detract from their currency variable when the control point block is activated by another player.

At the moment it simply grants +2 "Tech" and sets the "T1Used" to 1, so it cannot be used by the same player again.
OnActivate - Client - VCE_IfVariable: (T1Used) = (1)
OnActivate - Client - VCE_modVariable: (T1Used) Set (1)
OnVariableFalse - Client - VCE_modVariable: (Tech) Add (2)

The first problem is that I need to have the block know that the next person is different than the first, preferably using BL_ID.

The second problem is that while the second person gains +2 Tech and has his T1Used set to 1, the first person who used it loses -2 Tech and has his T1Used set to 0.

If it is not possible to do so with VCE alone, but is possible with VCE in tandem with other add-ons I am willing to download a few more to make this work.

If you used a second brick here's how you could do it. When you control a brick and auxiliary brick will begin cycling through relays on you. When someone captures the brick after you, it will enable events on your cycle that subtract the necessary variables and also terminate the cycle. After the cycle is terminated for you, it will begin for the new capturer.

If you used a second brick here's how you could do it. When you control a brick, an auxiliary brick will begin cycling through relays on you. When someone captures the brick after you, it will enable events on your cycle that subtract the necessary variables and also terminate the cycle. After the cycle is terminated for you, it will begin for the new capturer.

Fixed a typo that might cause some difficulty.

I'd say it's time that you forget that silly event stuff and look into scripting

Quote from: Doomonkey
If you used a second brick here's how you could do it. When you control a brick, an auxiliary brick will begin cycling through relays on you. When someone captures the brick after you, it will enable events on your cycle that subtract the necessary variables and also terminate the cycle. After the cycle is terminated for you, it will begin for the new capturer.

Fixed a typo that might cause some difficulty.

I hadn't thought of that, that's exactly what I would need. Thank you very much.

Quote from: Zeblote
I'd say it's time that you forget that silly event stuff and look into scripting.

I'd honestly love to, and I've thought about doing it for some years now. I'll see what I can do.

I've thought about doing it for some years now
...
With "some years" or practice you could already be a master.

does the variable need to be on the player?
you can make the brick remember the last BLID to trigger it

does the variable need to be on the player?
you can make the brick remember the last BLID to trigger it

Yes, the variables have to be specific to the player's client. I'd need the brick to remember the last player who played it while another player activates it, then be able to modify both clients variables.

If you used a second brick here's how you could do it. When you control a brick, an auxiliary brick will begin cycling through relays on you. When someone captures the brick after you, it will enable events on your cycle that subtract the necessary variables and also terminate the cycle. After the cycle is terminated for you, it will begin for the new capturer.

Fixed a typo that might cause some difficulty.

After doing this it appears to modify the client who is actually doing the toggling, the next player, instead of the original one. Could you please show me how you did it correctly, as I cannot seem to get this to work?

what are the variables being used for besides this brick?
and I think doom means to have a relay that's going which was triggered by the old player, toggle an event on which sets their value to not clicked it, and stop the loop
then after a delay it starts the new loop with the new player

what are the variables being used for besides this brick?
and I think doom means to have a relay that's going which was triggered by the old player, toggle an event on which sets their value to not clicked it, and stop the loop
then after a delay it starts the new loop with the new player

The variables are for a mini-empires server, for keeping score and managing the server's many different statistics, such as food, water, technology level, population, and then I plan to use it later on with a turn-based strategy game to keep score as well. As it gets painful to do the math yourself, I'm attempting to have the server keep track of them.

What you describe is pretty much what I did, but it seems that by activating a toggle to turn on-off relay events the ownership for doing so is passed to the new player.

What you describe is pretty much what I did, but it seems that by activating a toggle to turn on-off relay events the ownership for doing so is passed to the new player.
Don't you want the ownership to be passed on to a new player? So that way the next person to control a brick will effect the newest player to have done so.

Don't you want the ownership to be passed on to a new player? So that way the next person to control a brick will effect the newest player to have done so.

Yes, but what I meant is that the ownership of the relay events is passed to the person who toggles the modvariable events, making the newest player the target of both modvariable.

Yes, but what I meant is that the ownership of the relay events is passed to the person who toggles the modvariable events, making the newest player the target of both modvariable.
I think you are doing it in the wrong order then, but maybe it is impossible with just VCE.

Code: [Select]
0 onActivate self vce_retrocheck bl_id != <var:br:currentID> 1 7
1 onVariablefalse client centerprint "You have this already"
2 onVariabletrue self vce_modvariable currentID set <var:cl:bl_id>
3 onVariabletrue self vce_modVariable looping set false
4 onVariabletrue client vce_modvariable tech add 2
5 onVariabletrue client centerprint "Tech acquired"
[1000] 6 onVariabletrue self vce_modvariable looping set true
[1000] 7 onVariabletrue self fireRelay
8 onRelay self vce_ifvariable looping == true 9 11
9 [1000] onVariabletrue self fireRelay
10 onVariablefalse client centerprint "Tech lost"
11 onVariablefalse client vce_modvariable tech sub 2
Bleh... That was boring to type...

Anyway: clicking this the first tine will give the player tech, set their id to the brick, and fire a relay. Onrelay, it checks to see if its looping. If it is, it'll fire another relay a second later [delay is changable].

Then when someone else clicks it, looping becomes false, and within a second the first persons looping is canceled and they lose tech.

After making sure no one is looping anymore, looping is turned back on for the next person.