Author Topic: Transfer Variables From A Brick To A Player  (Read 1270 times)

What events do you have to use to transfer x variables on a brick to player?

set variable of the player to the variable on the brick. I don't know, I haven't used variable events in a while.

All I can think of is transferring 5 variables at a time.

I would suppose you would do exactly that..

Just for a test, I had two bricks. The one getting/giving variables, and another to toggle whether that first brick magicly got some variables or gave them all to the player.
Code: [Select]
The Toggle Brick

[X] [0] onActivate -> namedBrick(GetGive) -> toggleEventEnabled -> 0 1 2 3 4 5
[X] [0] onActivate -> client -> chatMessage -> <color:ffffff>Brick Toggled!
Code: [Select]
The GetGive Brick

[X] [0] onActivate -> Self -> VCE_modVariable -> Brick -> Test -> Add -> 1
[X] [0] onActivate -> Client -> chatMessage -> <color:ffff00>[Status]<color:ffffff>: This brick currently has <var:br:Test> variables.
[  ] [0] onActivate -> Client -> chatMessage -> <color:ffff00>[Status]<color:ffffff>: All of the variables have been transfered to you.
[  ] [0] onActivate -> Self -> VCE_modVariable -> Player -> Test -> Add -> <var:br:Test>
[  ] [0] onActivate -> Client -> chatMessage -> <color:ffff00>[Self]<color:ffffff>: You now have <var:pl:Test> variables!
[  ] [0] onActivate -> Self -> VCE_modVariable -> Brick -> Test -> Set -> (Blank)
The brick increments by one 'Test' value each click. Then when toggled, it deletes all of it's variables after giving the player all of them.

I was thinking
Code: [Select]
Onactivate->Client->Prompt->Do you want to transfer 5 variables?
Onpromptaccept->Self->ifvariable->[variable][>=][5]
Onvariabletrue->Self->Modvariable->[variable][subtract][5]
Onvariabletrue->client->modvariable->[variable][add][5]
Onvariablefalse->client->This brick does not have 5 variables

What exactly are you trying to do? Do you have a server that I may come to, to help you accomplish this? Why am I asking so many questions?

I'm am trying to create a system where someone buys something, the "money" goes to a brick, and I can collect that "money" later.

Oh that's easy. Subtract the clients variable, and right under, just add X to the bricks 'Money' var. Then have an event down the line where if <var:cl:Name> == GenaralSkar, then add <var:br:Money> to player/clients Money and set <var:br:Money> to blank.

Explain with the events.

The events I did before is pretty much what you're doing here..

--Choices for people to buy stuff-
-give them the stuff
-take away their money var
-add the money they spent and add it to the bricks Money var

--when Skar activates
-add bricks money to Skar
-set bricks money to blank

I was thinking
Code: [Select]
Onactivate->Client->Prompt->Do you want to transfer 5 variables?
Onpromptaccept->Self->ifvariable->[variable][>=][5]
Onvariabletrue->Self->Modvariable->[variable][subtract][5]
Onvariabletrue->client->modvariable->[variable][add][5]
Onvariablefalse->client->This brick does not have 5 variables

Code: [Select]
Onactivate->Client->Prompt->Would you like to take the money?
Onpromptaccept->Self->vce_ifvariable->brick->[money][>=][1]
Onvariabletrue->Self->Modvariable->[variable][set][0]
Onvariabletrue->client->modvariable->[variable][set][<var:br:money>]
Onvariablefalse->client->This brick doesn't have any money!
onvariabletrue->client->chatMessage->You collect the money and now have <var:cl:money>!

Along those terms, using your format.

Thanks. I didn't know you could use the <var> stuff to mod variables.

What server are you on and get on steam.


So I can come help you if you need any more help.