User Variables on Avatar Clothing
-
Bosskafett
- Posts: 41
- Joined: 24 Jan 2012, 00:04
User Variables on Avatar Clothing
Hi, I have been developing a multiplayer game with Ducks at http://duckclub.sytes.net.
I have created a clothing engine but I am unsure on how to make the server see the current movie clip frame of the clothing. I have tried making user variables to make the clothing movie clip current frame visible on all screens.
Please help, all of the users want it to work properly and I have done all I can.
Thanks,
Jacko
I have created a clothing engine but I am unsure on how to make the server see the current movie clip frame of the clothing. I have tried making user variables to make the clothing movie clip current frame visible on all screens.
Please help, all of the users want it to work properly and I have done all I can.
Thanks,
Jacko
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
-
Bosskafett
- Posts: 41
- Joined: 24 Jan 2012, 00:04
Structure
How exactly would I structure this? I have tried setting a user variable under "hd" and set it to a number 'var hd:Number' and made it equal the current frame of the head movieclip. 'var hd:Number = mc.duck.duck_3d.head._currentframe'.
Then 'smartfox.setUserVariables{(hd:hd, init=false)}'. Im not sure where to put this and what else to do... perhaps could you help me with what to put in and where.
Cheers, oh and thanks for getting back to me.
Then 'smartfox.setUserVariables{(hd:hd, init=false)}'. Im not sure where to put this and what else to do... perhaps could you help me with what to put in and where.
Cheers, oh and thanks for getting back to me.
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
-
Bosskafett
- Posts: 41
- Joined: 24 Jan 2012, 00:04
ok
Ok I will check it out and get back to you
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
-
Bosskafett
- Posts: 41
- Joined: 24 Jan 2012, 00:04
More help??
Ok right, the variables should be updated when the button is clicked to change frame of the clothing movieclip. None of the other variables such as px and py or col, relate to what I a m trying to do. Its very confusing and the documentation dosent help much with the problem. As you said this is a simple situation so I am not to sure on how to get all this to work. I have tried everything I can. Please help me 
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
-
Bosskafett
- Posts: 41
- Joined: 24 Jan 2012, 00:04
yes
Yeah I managed to figure it out. The only problem is that it dosent update that variable unless you rejoin the room or a new user logs in. If you made the changes in a room at the same time someone else was there, they see no changes...
Is there something extra I need to put into the onUpdateVariables function?
Reminder that I built upon col so thats designed for room joining updates so its not.. live... if you get me.
Any suggestions?
Thanks
Is there something extra I need to put into the onUpdateVariables function?
Reminder that I built upon col so thats designed for room joining updates so its not.. live... if you get me.
Any suggestions?
Thanks
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
You have three separate cases you have to handle, listening to the appropriate SFS events:
1) you enter a room: all users already in that room are notified; they must read your User Variables and create your avatar on their clients accordingly
2) a client enters the room you joined previously: it receives the list of users inside that room, reads their UV and create their avatars accordingly
3) you are inside a room and make changes to your UV: all the other clients inside that room receive an event informing them that your UV has/have been updated, and should change your avatar appearance accordingly.
1) you enter a room: all users already in that room are notified; they must read your User Variables and create your avatar on their clients accordingly
2) a client enters the room you joined previously: it receives the list of users inside that room, reads their UV and create their avatars accordingly
3) you are inside a room and make changes to your UV: all the other clients inside that room receive an event informing them that your UV has/have been updated, and should change your avatar appearance accordingly.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
-
Bosskafett
- Posts: 41
- Joined: 24 Jan 2012, 00:04
Check out my code
.: Please advise me on making this current room update work, heres the function :.
smartfox.onUserVariablesUpdate = function(user:User)
{
var currRoom:Number = this.getActiveRoom()
var id:Number = user.getId()
var uVars:Object = user.getVariables()
var mc:MovieClip
if (uVars.init)
{
mc = avatarMC.attachMovie("avatar", "avatar_" + id, Number(id))
mc._x = uVars.px
mc._y = uVars.py
mc.duck.duck_3d.head.gotoAndStop(uVars.hd)
mc.duck.duck_3d.gotoAndStop(uVars.xc)
mc.disc.gotoAndStop(uVars.col)
mc.name.text = user.getName()
}
else
{
mc = avatarMC["avatar_" + id]
mc.easingTo("Quint", "InOut", uVars.px, uVars.py, 100)
}
}
smartfox.onUserVariablesUpdate = function(user:User)
{
var currRoom:Number = this.getActiveRoom()
var id:Number = user.getId()
var uVars:Object = user.getVariables()
var mc:MovieClip
if (uVars.init)
{
mc = avatarMC.attachMovie("avatar", "avatar_" + id, Number(id))
mc._x = uVars.px
mc._y = uVars.py
mc.duck.duck_3d.head.gotoAndStop(uVars.hd)
mc.duck.duck_3d.gotoAndStop(uVars.xc)
mc.disc.gotoAndStop(uVars.col)
mc.name.text = user.getName()
}
else
{
mc = avatarMC["avatar_" + id]
mc.easingTo("Quint", "InOut", uVars.px, uVars.py, 100)
}
}
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
-
Bosskafett
- Posts: 41
- Joined: 24 Jan 2012, 00:04
thanks
thanks for helping, I already figured this out. The variables now update properly.
Cheers Bax
Cheers Bax
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D