Author Topic: Client-Sided Relay  (Read 2792 times)

multiple players can fire a relay off the same brick

[THE SCENARIO]
I want a user to be able to click a brick to buy a spell. Once they buy the spell they can say it in chat and right click to activate it. I do this using VCE retro check and relays.

It works fine, except for when another user also owns the spell and tries to use it. This cancels out the first person who clicked it and instead the spell is only useable to the person who last clicked the brick. So basically I was wondering if its possible to have relays fire on the client/player instead of onto the brick

can you explain the whole thing a bit more? I'm not entirely sure that you even have to use relays

Sadly, VCE just isn't a good option for this. You're much better off making a simple weapon and selling them the item.


Although, this did give me a neat idea for making a spell system.

edit: I'm making a spell system.
« Last Edit: October 17, 2013, 11:43:57 AM by Pecon »

to fix it use print counts instead of relays

input -> incrimentprintcount[9]
input -> incrimentprintcount[1]
onprintcountoverflow -> incrimentprintcount[9]
onprintcountoverflow -> incrimentprintcount[1]
onprintcountoverflow -> do stuff

I've built these systems. Before i learnt about VCE loops, i simply used a database, where when a player 'bought' the spell, it fired a relay up a chain of bricks until it found one that hadn't had a relay, which then fired the relay to the side, where the spell events were. Hell, i could probably find a save of it.

However, it is much easier just to use VCE loops. onVariableTrue > Self > VCE_IfValue > "1" "Equals" "1" "Blah" will loop every however long, but it will work with as many clients as you can give it.
Another less-popular way is using functions. State a function called <var:cl:bl_id>, then call it, and have onVariableFunction > Self > CallFunction > "<var:cl:bl_id>" " ". That way, each client can only have one loop, and buying the spell multiple times will not make it fire twice as often, i think.

Edit: Turns out those spell database systems i built were for VCE v4.
« Last Edit: October 19, 2013, 12:28:24 PM by boodals 2 »

I've built these systems. Before i learnt about VCE loops, i simply used a database, where when a player 'bought' the spell, it fired a relay up a chain of bricks until it found one that hadn't had a relay, which then fired the relay to the side, where the spell events were. Hell, i could probably find a save of it.

However, it is much easier just to use VCE loops. onVariableTrue > Self > VCE_IfValue > "1" "Equals" "1" "Blah" will loop every however long, but it will work with as many clients as you can give it.
Another less-popular way is using functions. State a function called <var:cl:bl_id>, then call it, and have onVariableFunction > Self > CallFunction > "<var:cl:bl_id>" " ". That way, each client can only have one loop, and buying the spell multiple times will not make it fire twice as often, i think.

Edit: Turns out those spell database systems i built were for VCE v4.
This is genius. Can you write a more in-depth tutorial on the <var:cl:bl_id> method?

0 [X] [  0  ] OnInput            > Self   > VCE_StateFunction > "<var:cl:bl_id>" "2 3"
1 [X] [  0  ] OnInput            > Self   > VCE_CallFunction  > "<var:cl:bl_id>" " "
2 [X] [ 100 ] OnVariableFunction > Self   > VCE_CallFunction  > "<var:cl:bl_id>" " "
3 [X] [  0  ] OnVariableFunction > Client > DoStuff


Line 0, 1: States and calls the function which is named the clients bl_id.
Line 2: Loops the function every 100ms.
Line 3+: Does stuff with the client.

0 [X] [  0  ] OnInput            > Self   > VCE_StateFunction > "<var:cl:bl_id>" "2 3"
1 [X] [  0  ] OnInput            > Self   > VCE_CallFunction  > "<var:cl:bl_id>" " "
2 [X] [ 100 ] OnVariableFunction > Self   > VCE_CallFunction  > "<var:cl:bl_id>" " "
3 [X] [  0  ] OnVariableFunction > Client > DoStuff


Line 0, 1: States and calls the function which is named the clients bl_id.
Line 2: Loops the function every 100ms.
Line 3+: Does stuff with the client.
Thanks, that's going to be very useful.