nyaalich Posted July 3, 2014 Posted July 3, 2014 User Defined Functions They are awesome, as is DoctaSax. EDIT: And upon thinking on it, it was remiss of me not to say that everyone who works on NVSE is awesome. They probably don't get a lot of/enough love.
ArgusSCCT Posted July 3, 2014 Posted July 3, 2014 Well that could've been useful a while ago, can't believe I missed that. I just thought that didn't exist. Maybe I can use that to establish communication between scripts.
nyaalich Posted July 3, 2014 Posted July 3, 2014 He's got at least 3 other tutorials on NVSE 4+ stuff. Same forum as that one.
ArgusSCCT Posted July 3, 2014 Posted July 3, 2014 Thanks, I'll check them out. That'll get rid of all those redundancies in that sound script, which has repeat code just about everywhere.
prideslayer Posted July 3, 2014 Posted July 3, 2014 Seems like this is the most active FO scripting thread in the world, so I will live here =D And I need some help =\ Trying to rotate player's X angle. Extremely simple code that will run only for one frame if IsKeyPressed 208 != DownArrow set DownArrow to IsKeyPressed 208 if DownArrow player.rotate x 1 else endif endifIf player's X angle is > 0 - script will work just fine. But if X angle is < 0... player's X will immediately go to 360 degrees, visually everything will be fine though, until I move the mouse. If i will move it - X angle will drop to 90. I recommend you use GetAngle/SetAngle instead. Rotate is.. sketchy.
Xilandro Posted July 3, 2014 Posted July 3, 2014 I recommend you use GetAngle/SetAngle instead. Rotate is.. sketchy. It will be a little bit heavy (sin+cos arctan script =\ )... but yeah, seems like I have no choice. At least it's not my fault that rotate won't work. Thank you!
prideslayer Posted July 3, 2014 Posted July 3, 2014 Rotate works, just probably not the way you think/expect.
prideslayer Posted July 3, 2014 Posted July 3, 2014 If you're trying to just duplicate what rotate does, then you don't need any trig functions, either. Rotate sets a reference rotating at a specific rate in degrees/sec. You can do that with just a timer.
Xilandro Posted July 3, 2014 Posted July 3, 2014 Rotate works, just probably not the way you think/expect. Yeah, it works just fine with objects, but not with character's X angle (-90 to 90 degrees). Works fine with Z axis though. Yep, working on timer right now. Trig functions are used to find X angle. set iUnits to player.GetDistance ffTarget set posZ to ffTarget.GetPos Z set playerZ to player.GetPos Z set offsetZ to posZ - playerZ set gg to 0 - (offsetZ/iUnits) set arctan to tan gg 1 player.setangle x arctan
Guest tomm434 Posted July 3, 2014 Posted July 3, 2014 XIlandro, why do you use GetPos Z? This returns height And no arctg are needed! float playerAngle float NeededAngle set PlayerAngle to Player.getAngle Z set NeededAngle to PlayerANgle +- any figure you want (playerAngle +180 will make player turn) player.setAngle Z NeededAngle
Xilandro Posted July 3, 2014 Posted July 3, 2014 XIlandro, why do you use GetPos Z? This returns height And no arctg are needed! float playerAngle float NeededAngle set PlayerAngle to Player.getAngle Z set NeededAngle to PlayerANgle +- any figure you want (playerAngle +180 will make player turn) player.setAngle Z NeededAngle I'm afraid it's not what I need =) I need angle X with height offset. But thanks anyway)
Guest tomm434 Posted July 3, 2014 Posted July 3, 2014 Meanwhile jaam. I'v got GetHairColor working! (R,G,B ) player.gethaircolor 1 wlll return R player.gethaircolor 2 wlll return G player.gethaircolor 3 wlll return B But I'm still having trouble with sethair color. Can you please transform any RGB color to the color engine understands? I mean - what do you do exactly?
prideslayer Posted July 3, 2014 Posted July 3, 2014 Tomm, it doesn't work exactly the same way in reverse? Is it just splitting up the int that you don't understand?
Xilandro Posted July 3, 2014 Posted July 3, 2014 Meanwhile jaam. I'v got GetHairColor working! (R,G,B ) player.gethaircolor 1 wlll return R player.gethaircolor 2 wlll return G player.gethaircolor 3 wlll return B But I'm still having trouble with sethair color. Can you please transform any RGB color to the color engine understands? I mean - what do you do exactly? How about creating an npc with hair color you need (hide it somewhere in the test cell or make new cell for NPCs), then do something like " set xxColor to NPC.GethairColor player.sethaircolor xxColor ? It worked fine for me.
Guest tomm434 Posted July 3, 2014 Posted July 3, 2014 How about creating an npc with hair color you need (hide it somewhere in the test cell or make new cell for NPCs), then do something like " set xxColor to NPC.GethairColor player.sethaircolor xxColor ? It worked fine for me. Wow. What is a xxColor? int, float, ref? Tomm, it doesn't work exactly the same way in reverse? Is it just splitting up the int that you don't understand? One second please.
Xilandro Posted July 3, 2014 Posted July 3, 2014 How about creating an npc with hair color you need (hide it somewhere in the test cell or make new cell for NPCs), then do something like " set xxColor to NPC.GethairColor player.sethaircolor xxColor ? It worked fine for me. Wow. What is a xxColor? int, float, ref? Int, if I remember correctly.
Guest tomm434 Posted July 3, 2014 Posted July 3, 2014 doesn't work set HairColor to Lunette1Ref.getHairColor doesn't comply/ I need a number after getHairColor pridelsayer, sethaircolor and gethaircolor don't work vice versa I can't do this sethaircolor 1 0000011 1 goes for Red I need a particular color # sethaircolor 0000011 will comply
nyaalich Posted July 3, 2014 Posted July 3, 2014 Comply Compile sethaircolor 1 00000111 goes for Red Totally guessing here... If 1, 2, and 3 go for R G B, I would think that you'd have a number from 0-255 after that, and that you'd probably have to have 3 sethaircolor statements. sethaircolor 1 0 sethaircolor 2 136 sethaircolor 3 77 (don't ask me what color that is )
Guest tomm434 Posted July 3, 2014 Posted July 3, 2014 Comply Compile sethaircolor 1 0000011 1 goes for Red Totally guessing here... If 1, 2, and 3 go for R G B, I would think that you'd have a number from 0-255 after that, and that you'd probably have to have 3 sethaircolor statements. sethaircolor 1 0 sethaircolor 2 136 sethaircolor 3 77 (don't ask me what color that is ) That's green The thing is : sethaircolor X Y won't compile SethairColor X will compile Would have been too easy ;(
nyaalich Posted July 3, 2014 Posted July 3, 2014 Goddamnit. I can't read today. X P And you've already tried a hexidecimal number for SethairColor X, right?
DoctaSax Posted July 3, 2014 Posted July 3, 2014 The thing is : sethaircolor X Y won't compile SethairColor X will compile Would have been too easy ;( This probably needs bitwise manipulation, storing the 3 ints for the 3 main components (R,G & B ) you got from GetHairColor into one int you need for SetHairColor. Jaam & pride might help you out there; all of that is pretty alien to me.
Guest tomm434 Posted July 3, 2014 Posted July 3, 2014 And you've already tried a hexidecimal number for SethairColor X, right? yes and the color is grey. She looks kinda creepy. This probably needs bitwise manipulation, storing the 3 ints for the 3 main components (R,G & B ) you got from GetHairColor into one int you need for SetHairColor. Jaam & pride might help you out there; all of that is pretty alien to me. thanks, I'll wait for them. Google doesn't get me much info on this topic.
jaam Posted July 3, 2014 Posted July 3, 2014 GetHairColor 0 is supposed to return the full RGB code as an integer. SetHairColor takes an RGB color and an optional NPC, but there might an error. Try the code. let cc := ((15 * 256) + 240) * 256 + 255 ;;; (if I am good cc will be 1044735) SetHairColor cc let rr := GetHairColor 1 let gg := GetHairColor 2 let bb := GetHairColor 3 rr should be 15 gg should be 240 bb should be 255 if that's not the case then it would seem there a bug EDITed my very bad formula...
Halstrom Posted July 4, 2014 Author Posted July 4, 2014 Well the only options to communicate with other plugins are globals and token countingAhem. Well, I probably should have stuck the word "other" in there as if you read up a few posts you would have read that he didn't want to use NX I was under the impression UDF's were part of NX but seems they are NVSE, not sure if he wanted to use that either.
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