Vrakner
|
  |
| Joined: 19 Feb 2013 |
| Total Posts: 323 |
|
|
| 01 Aug 2013 06:51 AM |
I have a system for my FPS:
There is a script that will constantly weld arms to a screen. It can move and rotate those arms based on two values, RIGHT/LEFT Arm Position and Rotation (RAP, RAR, LAP, LAR).
In my gun script, I made a function that will clone a script that will execute a bit of code in a StringValue called sourc. Sourc will be set by the gun script as follows:
------------------------------------------------------------
function RunCoding(code) if code then clone = ScriptsGroup.zzzGUIDEzzz.RunScript:Clone() clone.Parent = script clone.Name = "CodeGo" Sourc = Instance.new("StringValue", clone) Sourc.Name = "Sourc" Sourc.Value = code clone.Disabled = false return clone end end
function OnFire()
blabla gunstuff
--STOP ANIMATION HERE if CoroutinesSk then CoroutinesSk.Disabled = true CoroutinesSk:Destroy() RAP = RAP end
--start anim here local CoroutinesSk = RunCoding([[ print("doin it") MyPlayer = game.Players.LocalPlayer ScriptsGroup = MyPlayer.PlayerGui.Scripts local LAR = ScriptsGroup.ArmsFollowScreen.LeftArmRotation.Value local LAP = ScriptsGroup.ArmsFollowScreen.LeftArmPosition.Value local RAR = ScriptsGroup.ArmsFollowScreen.RightArmRotation.Value local RAP = ScriptsGroup.ArmsFollowScreen.RightArmPosition.Value local RAPP = ScriptsGroup.ArmsFollowScreen.RightArmPosition.Value for i=1, 3 do wait(.1) RAP = RAP - Vector3.new(0,0,.1) end print("SHOOTING ANIMATION HALF WAY THROUGH: " .. tostring(RAP)) for i=1, 3 do wait(.1) RAP = RAP + Vector3.new(0,0,.1) end RAP = RAPP print("DONE") script:Destroy() --haha ]])
blabla gunstuff
end
---------------------------------------------------------------
This allows it to simulate coroutines. I have a problem though. The above script is supposed to be a recoil script. When I shoot it, the arm doesn't even move. Not one bit. Why is this happening? |
|
|
| Report Abuse |
|
|
Vrakner
|
  |
| Joined: 19 Feb 2013 |
| Total Posts: 323 |
|
| |
|
|
| 01 Aug 2013 08:09 AM |
Is there output?
Also, what's this?
'blabla gunstuff'
|
|
|
| Report Abuse |
|
|
Vrakner
|
  |
| Joined: 19 Feb 2013 |
| Total Posts: 323 |
|
|
| 01 Aug 2013 05:11 PM |
Output:
doin it doin it SHOOTING ANIMATION HALF WAY THROUGH: 1, 0.200000003, -1.30000007 doin it SHOOTING ANIMATION HALF WAY THROUGH: 1, 0.200000003, -1.30000007 doin it Configurator Plugin loaded DONE SHOOTING ANIMATION HALF WAY THROUGH: 1, 0.200000003, -1.30000007 doin it DONE SHOOTING ANIMATION HALF WAY THROUGH: 1, 0.200000003, -1.30000007 doin it DONE SHOOTING ANIMATION HALF WAY THROUGH: 1, 0.200000003, -1.30000007 DONE SHOOTING ANIMATION HALF WAY THROUGH: 1, 0.200000003, -1.30000007 DONE DONE
Also, blabla gunstuff is essentially the bullet, the takedamage, the recoil spread, the flash, etc. Not really required for the post. |
|
|
| Report Abuse |
|
|
Vrakner
|
  |
| Joined: 19 Feb 2013 |
| Total Posts: 323 |
|
| |
|
Vrakner
|
  |
| Joined: 19 Feb 2013 |
| Total Posts: 323 |
|
| |
|
9HB
|
  |
| Joined: 11 Dec 2012 |
| Total Posts: 2461 |
|
|
| 02 Aug 2013 07:44 AM |
| Jw is RAP = RAP necessary? What does it do? |
|
|
| Report Abuse |
|
|
|
| 02 Aug 2013 07:50 AM |
From a glance of the script it resets RAP
Although thats pointless with the introduction of local variables |
|
|
| Report Abuse |
|
|
9HB
|
  |
| Joined: 11 Dec 2012 |
| Total Posts: 2461 |
|
| |
|
Vrakner
|
  |
| Joined: 19 Feb 2013 |
| Total Posts: 323 |
|
|
| 02 Aug 2013 05:48 PM |
Allow me to clarify. RAP is actually defined in the gun script ABOVE the functions. Thus, when I state RAP = RAP, it takes the value that it last has of RAP (which is the original) and makes that the value of RAP (Right Arm Position). It resets it.
The value of RAP in the gun script isn't changed at all by any code in CoroutinesSk, as that is merely a string to be executed in another script.
But still, it doesn't explain the problem - why does the animation not show? |
|
|
| Report Abuse |
|
|
Vrakner
|
  |
| Joined: 19 Feb 2013 |
| Total Posts: 323 |
|
| |
|
Vrakner
|
  |
| Joined: 19 Feb 2013 |
| Total Posts: 323 |
|
|
| 03 Aug 2013 03:26 AM |
BUUUMP.
Idea: Maybe it's because it takes too long to create a script with the StringValue and Enable it? |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 03 Aug 2013 03:32 AM |
Not deciphering your code, your problem is probably scope. I don't know for sure exactly what the precedence is, but if you have something like this:
local RAP = whatever
...bluh...
function(RAP) RAP = RAP --whut end
change one of the variables' names to avoid the ambiguity. |
|
|
| Report Abuse |
|
|
Vrakner
|
  |
| Joined: 19 Feb 2013 |
| Total Posts: 323 |
|
|
| 03 Aug 2013 03:40 AM |
Alright, but that still doesn't explain why the second script isn't producing the animation.
I'm thinking of perhaps getting rid of the entire secondary script method and using a normal coroutine, but I would need some way to kill it outside of the coroutine, which I haven't found yet. |
|
|
| Report Abuse |
|
|
Vector2D
|
  |
| Joined: 11 May 2013 |
| Total Posts: 195 |
|
|
| 03 Aug 2013 04:13 AM |
@OP From the title, it looks like you want us to prioritise this over helping others... why? What makes this any more important than helping someone with a simple function which breaks the joints of a character? |
|
|
| Report Abuse |
|
|
Vrakner
|
  |
| Joined: 19 Feb 2013 |
| Total Posts: 323 |
|
|
| 03 Aug 2013 04:25 AM |
Well, Vector, if you want to go help someone else first, go do it by all means. I came here because it said "Scripting Helpers." I didn't come here to be asked insulting questions.
So if you would rather ask me why I worded a title the way I did than help me fix my problem, then I guess I'll just have to try and fix this myself.
So much for Scripting "Helpers."
--R.R.R. |
|
|
| Report Abuse |
|
|
Vector2D
|
  |
| Joined: 11 May 2013 |
| Total Posts: 195 |
|
|
| 03 Aug 2013 04:31 AM |
If you think that was an insulting question, then you've no idea about the *other* sub-forums. You're right, the name of the sub-forum is "Scripting Helpers", but not one place does it, nor should it, say that one person should be prioritised over another. I will return to my initial question. |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 03 Aug 2013 04:31 AM |
@Vrakner; for the most part you can ignore the snobs around here. Most of us try to be helpful, but there's only so much a few users can do.
Also, it's not exactly prime time for American users, which encompasses the majority of ROBLOX's playerbase. The only reason I'm awake is because I never sleep. :> |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 03 Aug 2013 04:33 AM |
| What I suggest you trying is using Welds to animate everything. You'll only have to animate relative to a 'fixed' object, like the Character's Torso, and edit the C1 property of the weld, and it'll work everywhere. |
|
|
| Report Abuse |
|
|
Vector2D
|
  |
| Joined: 11 May 2013 |
| Total Posts: 195 |
|
|
| 03 Aug 2013 04:35 AM |
@adark Perhaps that was just my misinterpretation, but did that sentence superiorise American users over others? I wouldn't be surprised if I did misinterpret it; it is pretty late over here. |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 03 Aug 2013 04:36 AM |
And because I'm tired and am posting before I think, here are some helpful links:
http://wiki.roblox.com/index.php/CFrame http://wiki.roblox.com/index.php/Welds http://wiki.roblox.com/index.php/User:XLEGOx/quaternioninterpolate |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 03 Aug 2013 04:39 AM |
| @Vector; I mean no insult when I say you need to take a chill pill man. All I stated was that it is pretty late/early in America, where the majority of ROBLOX's players reside. It's 4 AM central time, so most people in the US are asleep right now. |
|
|
| Report Abuse |
|
|
Vrakner
|
  |
| Joined: 19 Feb 2013 |
| Total Posts: 323 |
|
|
| 03 Aug 2013 04:39 AM |
Well, technically that is what I'm doing. I have a separate script that uses Welds to weld the arms to point where the mouse is pointing, and I can adjust the CFrame of the welds using RAP, RAR, LAP, LAR (the position and rotation of the welds).
I was thinking the problem may be that the secondary script I'm making to adjust RAP, RAR, etc. may take too long to load, but that idea doesn't make sense since the output from the secondary script is correct. (doin it, done, etc.) |
|
|
| Report Abuse |
|
|
Vrakner
|
  |
| Joined: 19 Feb 2013 |
| Total Posts: 323 |
|
|
| 03 Aug 2013 04:41 AM |
| (And I know what you guys feel. It's 2:40 AM where I am, and I'm on my fourth cup of ginger tea.) |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 03 Aug 2013 04:43 AM |
Describe for me in detail how your script is supposed to run. I don't want lines of code, just an explanation, I.e. Touch a lava brick -> kill player.
Go through your code as you explain its process, and see if you find anything that doesn't make sense. If this doesn't help ya, I'll point out any logic mistakes you may have made, or write out the method currently forming in my mind. |
|
|
| Report Abuse |
|
|