etherealblade Posted October 27, 2011 Share Posted October 27, 2011 OK, I've seen mods where people made their companions be able to blink or sort of disappear where they were and reappear where the player is. So I've been trying to figure out how to script the opposite, that is, disappearing where you are (a short - moderate distance away) and appearing in front of the enemy right into melee range. My limited understanding of scripting allows me to know a little more specifically what i need help with.1) How to gain set a reference based on a target you have either targeted, or otherwise locked on (there is a melee lockon mod that locks on to enemies perfectly). 2) After a reference Id is set, I would have to set a script that moves your player to that target id. I some how thought that this could be achieved through the getdistance command. 3) Set a fx for the melee flash step, which I already know how to do. What I'm saying is not crazy...look at this lost modders video: Here's a method I've seen done. Yet the author is nowhere to be found and the work was lost when he disappeared a year ago. So I've decided to reverse engineer for vegas what he was able to do. Yes all those moves are flashy but ignore the flashy special visual effects and custom animations for a moment if you will (since most of it is custom animations, which are a whole nut in itself to crack (it really is too bad hes not still around)): Notice when he demonstrates the flash step.... his character makes and idle animation, as if throwing an invisible object, then his character appears wherever it hit. So this is where I think Lies the secret: Take a weapon like a throwing knife, and when you throw it, have the script move you based on the distance it traveled or where it hit. Of course it's also possible like above to use a script to get the distance between the player and targeted creature or object. So the FX are amazing but there has to be one core script code he used to get his character to move to in front of the targets like that. So heres whats I got: -----------------------------------------scn TeleportThrowingKnifeScript Begin ScriptEffectStartIf GetPlayerTeammate == 0set Actor to GetActionRef if Getdistance Actor > 50player.setdistance actor 50endifendif End *getting this right would mean a breakthrough, I'd then have to tie this effect to when the actor throws the knife, and then I could add some special effects to go along with it and we'd have a flash step action where a person playing a melee character could teleport in front of his target if he isn't in range. It'd save him from all that lead he'd eat to get from point A to B. Any help would be appreciated and your names will be listed as those who contributed to my own Hokuto No Ken Mod I'm making for NV. Seriously though, A mod that lets you do a shunpo/flashstep/blink/short range teleport, would be valued in the community. Please, =) at your convenience. Thank you kindly. Link to comment Share on other sites More sharing options...
Skevitj Posted October 27, 2011 Share Posted October 27, 2011 Using MoveTo, and calculating the offsets needed using basic arithmetic and the GetAngle, Sin, Cos and possibly Tan functions is AFAIK the easiest/neatest way to do it. Could get a bit interesting when trying to take terrain height variations into account though. At any rate, you shouldn't have to use a throwing knife to get the animation, just call the throwing animation playgroup... something possibly, haven't played with animations much. If the autoaim setting is high enough, GetCombatTarget could do the trick of determining your target. In pseudo code (Using NVSE):GameMode: If GetKeyPress is 'Y' If (target=GetCombatTarget) ;Target exists tarangle=target.GetAngle Calculate 3S destination offset from tarangle and desired distance Call visuals ;Call other mics sounds, animations etc player.moveto target 3Doffset endif endifYou could hotkey it easily using NVSE and an ability on the player, the obvious benefit of doing that being that you don't have to mess around with switching weapons and usefulness of being able to start/stop it by adding/removing the ability. It relies on the no-autoaim style modification being included though, otherwise GetCombatTarget on the player is useless. Link to comment Share on other sites More sharing options...
etherealblade Posted October 27, 2011 Author Share Posted October 27, 2011 (edited) That was an amazing tip...only thing though. I'm not very good at arithmetic, and I haven't any experience in using NVSE commands yet. I graduated in college in sociology XD. So I'll end up looking this stuff up since I don't know which text you posted was code, or just telling me what code i should find to do the things I need. =) I truly appreciate the help and I won't give up. =)\ Kudos for your assistance ;) scn TeleportCommandScript Begin GameMode;If GetKeyPress is 'Y'If target == GetCombatTarget ;Target existsref angle == target.GetAngle ;Calculate 3S destination offset from ;tarangle and desired distance ;Call visuals ;Call other mics sounds, animations etc ;player.moveto target 3Doffsetendif;endifend These are the things I've gotten to work so far, I have to figure out how to do the others and what the right format for them is. I feel like there is something I'm missing. Y can't be processed yet because I haven't set a quest script up to have a button assigned. as fare as the rest I'm uncirtain what commands suffice. I'm still looking. :wallbash:=) Edited October 27, 2011 by etherealblade Link to comment Share on other sites More sharing options...
Skevitj Posted October 28, 2011 Share Posted October 28, 2011 Psuedo code is like writing code, but focus more on providing something which reads more like a natural language, instead of a programming language. All of the functions you'd need are in there, just not in the form you'd use them in. GetAngle, GetCombatTarget and IsKeyPressed (NVSE) are the main three which it should need. (GetKeyPress was the wrong one. DX Scancodes for reference. SCN TeleportCommandScript ref TargetVar ;float ZAngle ;float XOffset ;float YOffset Begin ScriptEffectUpdate If (IsKeyPressed!=21) ; 21 = 'Y' return endif set TargetVar to GetCombatTarget if TargetVar!=0 ;set ZAngle to TargetVar.GetAngle Z ;set XOffset to cos ZAngle 1 ;set XOffset to XOffset * 50 ;set YOffset to sin ZAngle 1 ;set YOffset to YOffset * 50 MoveTo TargetVar ; XOffset YOffset endif endThat should move you instantly, with no visuals right on top of them. Note I used ScriptEffectUpdate since you should have this a part of an Ability and add the ability to the Player. If that works as intended, you can add the rest later. It should only work if the crosshair turns red when you mouse over a target. This will only happen outside melee range if you're using one of the no-auto-aim or similar mods which increases the "lock-on" distance. If that works, the commented out line should add the calculations to the offsets on the X-Y plane, assuming that's the ground plane, it may be X-Z. Going to be a fair amount of trial and error involved unless you can find a page referencing what the coordinates correspond to. Things like animation, sound etc can be added later if this is all working. Link to comment Share on other sites More sharing options...
etherealblade Posted October 28, 2011 Author Share Posted October 28, 2011 (edited) That sounds great! This is such a great help! Ps: So the things you have ";" by cancels them from being read in script? or is it because they need different values? Edited October 28, 2011 by etherealblade Link to comment Share on other sites More sharing options...
Skevitj Posted October 28, 2011 Share Posted October 28, 2011 ':' just indicates a comment till the end of the line. I'm just using it to get the compiler to ignore lines. If the script seems to work, then you can un-comment them and see if it still works. Link to comment Share on other sites More sharing options...
etherealblade Posted October 28, 2011 Author Share Posted October 28, 2011 SCN TeleportCommandScript ref TargetVar float ZAngle float XOffset float YOffset Begin ScriptEffectUpdate ;If (IsKeyPressed!=21) ; 21 = 'Y' ; return ;endif set TargetVar to GetCombatTarget if TargetVar != 0 set ZAngle to TargetVar.GetAngle Z set XOffset to cos ZAngle 1 set XOffset to XOffset * 50 set YOffset to sin ZAngle 1 set YOffset to YOffset * 50 MoveTo TargetVar ; XOffset YOffset endif end GREAT NEWS! all of it compiles fine except for the IsKeyPressed snippet. I won't be able to test it until I can attach it to a button. Is it because I need to have a quest set up for it already? or is there fault in the code itself?I've tried putting spaces between the "!=" and took away the parenthesis, but I'm starting to think i need to make another script that defines that the key 21 (Y) is a toggle-able key. I'm not sure but when I looked at other fose work, such as the sprint mod for NV, There are several phases of code that go into just making keys usable or hotkeyable. What do you think? Link to comment Share on other sites More sharing options...
Skevitj Posted October 29, 2011 Share Posted October 29, 2011 You need to install NVSE and load up the GECK and FO:NV using NVSE. Without it the only way you could really activate it is to attach it to an armor piece or something like that and rely on the in-game hotkeys. You don't set up quests or dedicated scripts to define hotkeys, it's done in the game when you use the wheel menu thingy, or in a script using a function which intercepts a key press (IsKeyPressed). There are probably other ways of doing it, but I doubt they're worth the effort. Link to comment Share on other sites More sharing options...
etherealblade Posted October 29, 2011 Author Share Posted October 29, 2011 (edited) Sorry accidental Double Post. Edited October 29, 2011 by etherealblade Link to comment Share on other sites More sharing options...
etherealblade Posted October 29, 2011 Author Share Posted October 29, 2011 (edited) scn TeleportCommandHotkey int bIsYPressed Begin GameMode if bIsYPressed != IsKeyPressed 41 ; Y set bIsYPressed to IsKeyPressed 41 ;Y endif End Still cant get it to work even though I set 41 (Y) as a global. I've tried replacing 41 with "TeleportHotkey" which is the name of the global with the corresponding integer 41 and yet still nothing. Ok, I just ran it as admin and things are fine, just now im sure theres something wrong with how the code is being presented. Edited October 30, 2011 by etherealblade Link to comment Share on other sites More sharing options...
Recommended Posts