Dryicefox Posted December 17, 2018 Share Posted December 17, 2018 (edited) Alright, so a friend and I are working on a character that is able to "store" another character in them. We are essentially making an action that sets the affected character's location to the location of the affecting character, and also sets their anim build to an "invisible" build. My method of thinking is to create an action that sets a tag on the affected character "stored" to ensure that the character cannot be "stored" twice Function "onstored" that sets the affected character's anim build to invisible, sets their location to that of the acting character, and strips them of their actions Function "onunstored" that sets the affected character's anim build back to the target's original anim build and gives them their autonomy back. My main problem is finding a way to code a target object that refers to the affected user. Edited December 17, 2018 by Dryicefox Link to comment Share on other sites More sharing options...
BakaSchwarz Posted December 18, 2018 Share Posted December 18, 2018 With target object, do you mean something like a staff? Not sure i understand your main problem. Could you rephrase? Link to comment Share on other sites More sharing options...
Dryicefox Posted December 18, 2018 Author Share Posted December 18, 2018 Sure. Attacker clicks/acts on Target, Target's location is changed to attacker's location. Link to comment Share on other sites More sharing options...
BakaSchwarz Posted December 18, 2018 Share Posted December 18, 2018 Ah, okay. In that case you may want to look at playercontroller.lua. You could add your code to the OnLeftClick function like so: AddClassPostConstruct("components/playercontroller", function(self) local oldleftclickfn = self.OnLeftClick self.OnLeftClick = function(self, down) -- Your code here oldleftclickfn(self, down) end end) In your code you check that the currently played character is your character. Get yourself the ThePlayer variable and check its prefab. Does this go in the direction you intended? I am not sure the playercontroller is networked as is though. Never needed to do stuff with it. Maybe someone else can say more about this. Link to comment Share on other sites More sharing options...
Dryicefox Posted December 18, 2018 Author Share Posted December 18, 2018 It's taking the location of the character one has clicked on and setting their location to the location of your own character. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now