Skevitj Posted November 3, 2011 Share Posted November 3, 2011 You're calling IsKeyPressed wrong. The way I first mentioned it was incorrect too, post #13 has the correct call. It will need a lot of addition parts to the script, such as a delay to stop the game from recognizing a key press for a few seconds after activating etc. The basic script I posted before was pretty much just a skeleton to work from. SCN ... ref TargetVar Begin ScriptEffectUpdate if IsKeyPressed 21 PrintC "Y pressed" set TargetVar to GetCombatTarget if TargetVar!=0 PrintC "Target found" else PrintC "Target not found" endif endif endTry sticking that in there. It should produce a flood of console messages indicating if the functions are operating as expected. Link to comment Share on other sites More sharing options...
etherealblade Posted November 3, 2011 Author Share Posted November 3, 2011 (edited) It does work. That script does find the target, and throws the other message when there isn't one. I think though that theres just some math equation involved that I have no clue how to calculate in geck. So the hotkey does work in game. Just when I press the button while putting the cursor on the attacker it doesn't move my character. Sort of how I tried to put a play animation on a hotkey. The animation wouldn't play when i pressed the button but the button does work because it caused a limb to get crippled. The only problem was....a random limb gets crippled, not the one i designated in base effects. I'll dedicate a different thread to this issue though. This I know someone knows how to do easily. Edited November 3, 2011 by etherealblade Link to comment Share on other sites More sharing options...
rickerhk Posted November 3, 2011 Share Posted November 3, 2011 Just to throw trig to the side for a minute and examine the basic structure of the script - Most of the time GetCombatTarget will return 0, so you want to allow for that when you have the key pressed and are moving the crosshair around. A lot of times a script will just halt if you try to perform a function on a null reference. SCN TeleportCommandScript int YisPressed ref TargetVar float Distance float ZAngle float XOffset float YOffset int iFaceEachOther float fTempAngle Begin ScriptEffectUpdate if (iFaceEachOther > 0) if (iFaceEachOther == 5) ;skip a few frames to allow the moveto to complete. Adjust as required more or less set fTempAngle to Player.GetAngle Z + Player.GetHeadingAngle TargetVar ;these should make the player and target face each other. I think. Player.SetAngle Z fTempAngle set fTempAngle to TargetVar.GetAngle Z + TargetVar.GetHeadingAngle Player TargetVar.SetAngle Z fTempAngle set iFaceEachOther to 0 else set iFaceEachOther to iFaceEachOther + 1 return endif endif ;code here to do other stuff (that also makes sure 'Y' is ignored while it's going on) set YisPressed to IsKeyPressed 21 if YisPressed == 0 return endif set TargetVar to GetCombatTarget if (TargetVar == 0) ;nothing to do return endif printc "Player Target is %i %n", TargetVar, TargetVar if player.getdistance TargetVar > 32 player.moveto targetvar 32 32 0 ;bumping heads distance set iFaceEachOther to 1 endif end If you need to do trig functions, you have to convert the game angles to trig angles - bottom of this page: http://geck.bethsoft...ex.php/GetAngle Link to comment Share on other sites More sharing options...
etherealblade Posted November 4, 2011 Author Share Posted November 4, 2011 Kudos given. I shall come back with a report. ;) Link to comment Share on other sites More sharing options...
etherealblade Posted November 4, 2011 Author Share Posted November 4, 2011 (edited) Kudos given. I shall come back with a report. ;).....O....M.........G!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! It worked...http://media.comicvine.com/uploads/4/41648/849743-yes_man01_super.jpgUm, there are extra things to throw in like special effects, and other random testing. But By Golly WE'VE DONE IT! If your interested in following up on some other things I'm trying to tackle, head over here. http://www.thenexusforums.com/index.php?/topic/453242-disarming-the-enemys-weapon/ Just so you know, All those who helped, will be considered co-producers of this mod. I truly do appreciate the encouragement and assistance. Edited November 5, 2011 by etherealblade Link to comment Share on other sites More sharing options...
etherealblade Posted November 7, 2011 Author Share Posted November 7, 2011 (edited) Just so you know, All those who helped, will be considered co-producers of this mod. I truly do appreciate the encouragement and assistance. I've actually decided to just use this thread as the lab. Anyways, I'm still looking for ways to make my character play an attack animation. But the biggest target right now is, taking the above working script and adding on to it to allow for teleporting to multiple targets in succession after playing an attack animation. After all with the teleport script core complete. Now we can work on doing that omni punch, (the attack at the very end of the video). If your interested please, I could use any suggestions or advice, so all is welcome.I shall be posting a video of our success as soon as I figure out how to...XDThanks again and if you are brimming with ideas or thoughts please don't hold back on my account. Edited November 7, 2011 by etherealblade Link to comment Share on other sites More sharing options...
Skevitj Posted November 8, 2011 Share Posted November 8, 2011 PlayGroup is the function I refered to earlier, and should take care of any animation you want to play. Just place it in the script in the appropriate place. AFAIK calling MoveTo on the player acts as a script return, so it may be a tad more involved to get them to play an animation after the teleport, if you can't just start the animation first then call move to. When you've got the location it's just a matter of going through the animation groups and finding one that looks right. Link to comment Share on other sites More sharing options...
etherealblade Posted November 8, 2011 Author Share Posted November 8, 2011 PlayGroup AttackRight 0 If player.GetAnimAction == 1 PlayGroup AttackLeft 0 endif If player.GetAnimAction == 1 PlayGroup AttackRightPower 0 endif If player.GetAnimAction == 1 PlayGroup AttackLeftPower 0 endif If Player.GetAnimAction == 1 PlayGroup AttackForwardPower 0 endif set timer to 0 sgtm 1.0 I'm trying to get this where, After he performs one attack, he plays another animation, and then another animation. Of course I have to be able to set him back to normal cause it will freeze the player in one spot once it's done. Link to comment Share on other sites More sharing options...
Skevitj Posted November 8, 2011 Share Posted November 8, 2011 In that case you'll need to set up what is effectively a state machine, with a variable corresponding to the animation you want to play (or no anim) and then using IF statements to select the correct animation based on the value of the variable. If you just want to loop an animation though, it can be simplified a fair bit. Link to comment Share on other sites More sharing options...
etherealblade Posted November 8, 2011 Author Share Posted November 8, 2011 (edited) http://www.youtube.com/watch?v=z2q60o-FKoM Btw Here's a vid of that teleport we have currently. ;) Not too shabby if you ask me. The Code for trying to do consecutive animations: scn ConsecutiveAttacksScript Int NisPressed ref TargetVar Begin ScriptEffectStart set NisPressed to IsKeyPressed 29 if NisPressed == 0 return endif set TargetVar to GetCombatTarget if (TargetVar == 0) ;nothing to do return endif player.PlayGroup attackright 0 If player.isAnimPlaying attackright == 1 ;keep playing else player.PlayGroup attackleft 0 If player.isAnimPlaying attackleft == 1 ;keep playing else player.PlayGroup attackrightpower 0 If player.IsAnimPlaying attackrightpower == 1 ;keep playing else Player.PlayGroup attackleftpower 0 If player.IsAnimPlaying AttackLeftPower == 1 ;keep playing else Player.Playgroup Idle 1 endif endif endif endif endif endif endif end Let's see, not to be too A.D.D. here. So, basically I need to make a variable such as an int and float? The int will be sued as an if statement used to define when the action has passed and the float will determine what action it was? I know what you mean I'm having trouble visualizing it in syntax terms though. Basically I need to store values that allows the game to determine when an action has made it's full completion before it moves to the next otherwise I get the script going too fast and it skips to the last action, or does the first and ignores the rest. This is what i got so far, I'm still testing with no success yet. On Topic: I can get my character to do the animation, but I've been unsuccessful with making him do several animations in a row. I'm not sure how I'd handle that in script, but I've successfully been able to make him do an attack animation after a teleport and return him to user status. If script allows us to play animations consecutively, it might make for a sweet workaround for not having custom animations yet. Otherwise that's not important and can only be solved by making a custom animation. The major issue is this, how do I make it to where the script:(It currently can Auto Detect your Current Target)1) Auto scans for people in the area for eligible "warp" to targets, (I'm sure I saw a script that lets reports those who have targeted you)2) Warps you to them, (I'd make a play animation attack, It's hit them with a deadly script) 3) Since it doesn't warp to targets that are dead, It'd seek the next available target.3) Then returns you where you were. Edited November 9, 2011 by etherealblade Link to comment Share on other sites More sharing options...
Recommended Posts