Lokenta Posted December 9, 2007 Share Posted December 9, 2007 I was simply wondering if a script like this could work. I was hoping this would be available to put onto a static, but perhaps it would have to be put on an activator, I'm not entirely certain. Also, I was wondering if there was any script/series there of that allowed you to check when a run once animation was finished playing. Oh, another thing: does SetActorAlpha work on statics/activators. If not, is there something that does affect their opacity? [make a global variable called 'Climb'] ScriptName Climbing;this is for the first activator called 'object,' used to test the place for climbing Short Number Short Angle Float Timer Begin Gamemode If (IsInInterior != 1 && Number == 0 && Climb == 0); make sure they're outside Player.PlaceAtMe [object reference number], 1 SetActorAlpha 0.0 Set Number to 1 ; do it only once EndIf If (IsInInterior == 1 && Number == 1) Set Number to 2 EndIf If (IsInInterior != 1 && Number == 2) Set Number to 1 EndIf If (Number == 1) Set Angle to Player.GetAngle z If (Assure == 0) MoveTo player, 100*sin(Angle), 100*cos(Angle), 50 ElseIf (Assure == 1) MoveTo player, 100*sin(Angle), 100*cos(Angle), 200 ElseIf (Assure == 2) MoveTo player, (100*sin(Angle)+150*cos(Angle)), (100*cos(Angle)+150*sin(Angle)), 50 ElseIf (Assure == 3) MoveTo player, (100*sin(Angle)-150*cos(Angle)), (100*cos(Angle)-150*sin(Angle)), 50 EndIf EndIf If (Assure > 0) If (timer > 0) Set timer to timer - GetSecondsPassed If (timer == 0) Set Assure to 0 EndIf EndIf End Begin OnTrigger If (Assure == 0) Set Assure to 1 Set timer to 1 ElseIf (Assure == 1) Set Assure to 2 ElseIf (Assure == 2) Set Assure to 3 ElseIf (Assure == 3) Set Climb to 1 PlaceAtMe [activator reference number], 1 [activator reference number].MoveTo player, 100*sin(Angle), 100*cos(Angle), 50 Disable EndIf End Another aside: I was trying to utilize the 'number' short as a way to make sure there was one at the player whenever he went outdoors, and that it got deleted when he went inside. I'm not sure if that was how I should have done it. The main point of this script is to see if there is a large surface in front of the player. The assures are designed to check above, as well as to the left and right. Mainly it's to check for a wall, and, if there is one there, to put another object there and disappear. Would this script work, or, if not, could I make it? Lokenta Link to comment Share on other sites More sharing options...
Vagrant0 Posted December 9, 2007 Share Posted December 9, 2007 Lokenta said: Offhand, I'd be tempted to say no. I'm not entirely sure what you're trying to do, but don't think a ontrigger block will trigger when it comes in contact with a static. If it does, it woud still probably require a non-scripted movement (like gravity) to get that trigger to register. Ontrigger blocks are usually only valid for traps, and require special nifs with a triggerzone to function. As these zones often cross other static elements, the game may be set to only detect when an actor or other referencable object has crossed. Since you are moving these activators with scripting, it may not even detect those properly. But as this is not something I have really played with in great detail, I may be wrong. I'm also tempted to think that you might have a logic problem here. An object cannot run scripts if it is not currently loaded in the game, a script which creates the object it's attached to will only cause an endless string of replication. Instead you might want to considder using an ability or quest script to control the initial spawning and hiding of the object using another global (number) so that the two scripts share the needed information. You may even have to use pre-named references that are moved to the player's location (rather than placeatme) to prevent multiple duplications from happening, and to allow for control of specific references. If you feel you ave to use placeatme to work, it might get a bit complicated since things created with placeatme can only be referenced in the scripts on the object (getself) or by the script that created that reference (set refname to player.PlaceAtMe [object reference number], 1). As for setactoralpha, I believe it only works on actors. But this is a minor issue since you could just make your activator invisible within the .nif. Beyond that, you'll probably need to define "short assure" at the top. You may also want to add some messages or other cues to let you know what parts of your script are running when. It may be hard to do since you have a number of things already going on, but might alert you where a problem in the script might be. Just remember, the player will trigger an Ontrigger block if he crosses through one of the planes before the script moving the object updates the location... So you may have a significant issue on that end. It's a decent approach to a climbing mod, but I don't think it'll end up working like this. Unfortunately, there may never be a good way to achieve this. Detecting where statics are wasn't one of the things Bethsoft's devs had any reason to work into scripting functions. It may be the only way you can detect if a player is against a wall is to check if they have a running animation playing and they aren't moving. Link to comment Share on other sites More sharing options...
Lokenta Posted December 9, 2007 Author Share Posted December 9, 2007 Your last statement intrigues me. I am well aware on how to check whether a running animation is playing, but I'm not certain how you would check if the player was moving. Is there a function that allows you to check the speed of the player, or would you have to record the player's position, then check it a moment or two later to see the difference? If the latter is the case, I'd have to be aware of the changes with the speed attribute, but that wouldn't be too difficult in itself. Also, if something like this does get working, is there a way to lock certain player controls (while they are on the wall, let's say) to do a different command (a scripted one) rather than the normal function? Or is this something that the GetKeyPress function does on its own? Thank you again. Lokenta Link to comment Share on other sites More sharing options...
Vagrant0 Posted December 9, 2007 Share Posted December 9, 2007 You would have to use getpos to check for any change in position between frames (or cycles) Within a gamemode or scripteffect update, this can be done using some sort of counter. begin scripteffectupdate if player.isanimplaying <walking animation> == 1 if counter == 0 set heading to player.getheadingangle set x1 to player.getpos x set y1 to player.getpos y set z1 to player.getpos z set counter to 1 elseif counter == 1 set counter to 2 elseif counter == 2 set counter to 3 elseif counter == 3 if heading == player.getheadingangle set counter to 4 else set counter to 10 elseif counter == 4 set heading to player.getheadingangle set x2 to player.getpos x set y2 to player.getpos y set z2 to player.getpos z set counter to 5 elseif counter == 5 if x1 == x2 && y1 == y2 && z1 == z2 if step == 0 step1ref.moveto player. set step to 1 set counter to 0 elseif step == 1 step2ref.moveto player. set step to 2 set counter to 0 elseif step == 1 step3ref.moveto player. set step to 0 set counter to 0 endif else set counter to 10 endif elseif counter == 10 set counter to 11 elseif counter == 11 set x2 to 0 set y2 to 0 set z2 to 0 set counter to 0 endif endor something along those lines. This will make it so that the script waits a few frames before comparing positions and heading. The problem with restrainign or locking the player controls is that it would stop the animation from playing. Since the animation playing is kinda key to detecting if the player is trying to move, this probably wouldn't work too well. Getheadingangle can provide a similar purpose though since any change to angle (the player looking around) would make it so that if you want to keep climbing, you need to keep moving into the wall. You may still have to make adjustments for speed, but if you use a long, instead of a float for the positions, it should make the script only detect whole number changes. Since the player is walking, even if they have fast speed, or are not perpendicular to a wall, the change in position probably won't get registered. You're still welcome to try making the detection more forgiving though. The point of moving references, rather than creating new ones is two fold. Creating new references can bog down the world and make saved games become larger and larger, and since this is something which would require dozens of activators to make the climb, that're really asking for trouble. It would also block the player from being able to retrace their path along the same wall later since there would be references in the way. When moving activators, you only have 3 steps in the world at any one time. If you should fall off, you can retrace the same path up without ever running into your old steps. The additional cycles at the end are to allow for the change in height from the step being moved to be completed before recording the new positions. Using something like this in a duration based spell would probably work better than as a quest script since it can be enabled/disabled by the player... Just so that you don't have the script running when the player doesn't want to climb. Ths of course could be handled in a quest script as well, making the whole thing conditional to the player wearing an item or something, but that's up to you. Best of all, this doesn't use any OBSE functions, so anyone can use the mod. I've never liked OBSE, it just tends to complicate mods, distact from more practical methods of achieving a task, and gives uninformed parties false hope of a mod working. Just make sure you give me credit if my scripting works. Link to comment Share on other sites More sharing options...
Lokenta Posted December 9, 2007 Author Share Posted December 9, 2007 Thank you. However, to explain the locking of player controls, it was not for seeing when the player attached to the wall, it was more for once the player attached to the wall. What kind of object would I put this script on, or is there some sort of 'Global Script' thing that I've been missing? I'd prefer not to put it on an item or a spell, as it would be more of a skill based thing than an object based one. If it's possible I'd like to have it as something you have to actively activate, but the problem with activators would be that going up to a door would be difficult, as I haven't found anything to do with priority levels. Lastly, for now, how do I discriminate between actors or something else with this? It would be rather odd to watch your character start climbing up someone. Perhaps if there is a way to set it as an activator (is there an 'is targetting' function that checks if pressing space would do anything?) it would alleviate this problem. I agree with you about OBSE, but it does have a few nice functions, all in all. Lokenta Link to comment Share on other sites More sharing options...
Vagrant0 Posted December 9, 2007 Share Posted December 9, 2007 Lokenta said: Thank you. However, to explain the locking of player controls, it was not for seeing when the player attached to the wall, it was more for once the player attached to the wall. What kind of object would I put this script on, or is there some sort of 'Global Script' thing that I've been missing? I'd prefer not to put it on an item or a spell, as it would be more of a skill based thing than an object based one. If it's possible I'd like to have it as something you have to actively activate, but the problem with activators would be that going up to a door would be difficult, as I haven't found anything to do with priority levels. Lastly, for now, how do I discriminate between actors or something else with this? It would be rather odd to watch your character start climbing up someone. Perhaps if there is a way to set it as an activator (is there an 'is targetting' function that checks if pressing space would do anything?) it would alleviate this problem. I agree with you about OBSE, but it does have a few nice functions, all in all. LokentaYou can't really lock the player controls and still have any action get performed. Locking the player controls just makes them stand there. I suppose you could do something along this line where you have OBSE link a keypress to that action, instead of having it determined by scripting, but the problem is trying to get out of that action, or adjusting for a non 90 degree vertical climb. By having the player not locked, they can drop off the wall at any time, and the scripting will allow for a wider degree of ascent angles. If you had a specific animation you wanted to link with climbing, you could still link that animation, and just use it as an alternative to the walking condition. That animation should break when the player starts falling. Scripting it to work with new animations is however an entierly different ball of wax, so shouldn't really be looked into until you have the base mechanics working right. This kinda goes with the quest script idea. You would control everything within that quest script, and have something act as an on/off switch for when it should check if the player is trying to climb. The examples provided are things which wouldn't need OBSE to work, so might be a good idea initially. You could also use some sort of text prompt asking if the player wants to try climbing (somewhere around counter 4), but that could be a bit annoying. With OBSE, a keypress could certainly satiisfy this condition and function as the toggle. There is no real way to discriminate between actors and statics. Climing on actors whould be minimized within the scripting logic since most people would attempt to either turn, stop, or not be walking. By limiting it to only work while the walking animation is playing (as opposed to running), you pretty much rule out most of the standard collisions that happen on the street, and limit the action only when the player wants to scale a wall. Not many players actually walk anywhere. As for objects to use, you might want to look in the CS for a mesh that is fairly small, has collision, (probably one that exists as a static currently (like a doorstone)) and has a height of between 8 and 12 above the insertion point. Link the nif to a new activator, place 3 of those activators in world somwhere, name them as described, and test. You can later make a duplicate of that .nif, and assign a 100 transparent texture to it once you know it's being moved properly. The size and shape of the object will be used to determine where the player can stand. The height above insertion will determine how much the player moves once it's placed. You may need to add additional cycles between the last and the first to allow for larger vertical movement. If you know the height, you might even be able to use "setpos z Z2+ 4" or something to make it move faster after the object is placed. Link to comment Share on other sites More sharing options...
Lokenta Posted December 10, 2007 Author Share Posted December 10, 2007 I was, actually, planning on using the key-press function (that's OBSE? oh well). I have modded a few other programs that have specific movement functions simply by locking the player's basic control, then setting the same keys to do something else. That's how I was going to have it set up. That way people could still drop down or jump off. The reason I wanted objects to do collision detection with was so that I could tell if a player was approaching a corner (either inward or outward) and have the script react accordingly. Is there a different way to do that? If there is a way it would also allow the 'climb up' onto the top to work. I'm not sure if there is a way to 'shoot' an object out of the player at a certain direction to see if there is a close collision there (and if there isn't, the corner/top has been reached) or one perpendicular to the player's movement (to check for inward corners). I somehow doubt that bethesda has something that can shoot out of the player, but perhaps there is an invisible (or something that can be made invisible) particle that can be considered a target spell? Although I may be becoming a nuissance, thank you for helping me Lokenta Link to comment Share on other sites More sharing options...
Vagrant0 Posted December 10, 2007 Share Posted December 10, 2007 Lokenta said: I was, actually, planning on using the key-press function (that's OBSE? oh well). I have modded a few other programs that have specific movement functions simply by locking the player's basic control, then setting the same keys to do something else. That's how I was going to have it set up. That way people could still drop down or jump off. The reason I wanted objects to do collision detection with was so that I could tell if a player was approaching a corner (either inward or outward) and have the script react accordingly. Is there a different way to do that? If there is a way it would also allow the 'climb up' onto the top to work. I'm not sure if there is a way to 'shoot' an object out of the player at a certain direction to see if there is a close collision there (and if there isn't, the corner/top has been reached) or one perpendicular to the player's movement (to check for inward corners). I somehow doubt that bethesda has something that can shoot out of the player, but perhaps there is an invisible (or something that can be made invisible) particle that can be considered a target spell? Although I may be becoming a nuissance, thank you for helping me LokentaNo, the reason why there isn't a climbing mod already is because there isn't any means of detecting where a static is through scripting, and no effective means of moving the player along the face of the object. Any sort of detection method would only register when it comes in contact with and activator, container, door, or actor. This is where mods that attempt a grappling hook are limited. Although something can be shot from the player along a vector, it cannot detect if it actually comes in contact with a collision plane. A spell will stop when it hits a plane, but no effect within that spell will run at the point of contact. There is also no way to get a good indication of where exactly the player is looking. Anything shot would travel at a fixed vertical angle away from the point the player is standing on. You can give a projectile physics, but you cannot give it an actual velocity, any movement between points would be dictated through scripting, and have the object just moved to points along that line each frame, and in doing so, the object will pass through anything solid along the way. As far as I know, and for the effect you are trying to achieve, what I have mentioned is the only way of accomplishing it. You could still use locked controls to some extent, after the first step has been placed, and use OBSE to detect keypresses to control vertical movment, but it may end up being a bit too clumsy. If you want to use OBSE, you're probably best off limiting the key detection as a sort of toggle to determine if the player wants to try climbing or not. Depending on the steps used, they should allow for negotiation around small overhangs. since as the player contacts the bottom of the overhang, they'll be pushed outward, away from the wall. If the step is sticking out far enough, they should still have somthing to stand on, and be able to get over that corner. If you aren't using a squareish step, you might have to orient the step when it gets moved. Best advice would be to just attach the script I have to a duration based spell, regardless of how you plan to actually do it, fix some of the minor errors in the scripting, setup the other stuff, and test it. This way you can see first hand how all the logic and mechanics work, and can get a good understanding on how you want to control it. Link to comment Share on other sites More sharing options...
Lokenta Posted December 10, 2007 Author Share Posted December 10, 2007 But if we used a spell, we can give it a velocity, as well as a sound to play as it collides with something. Is there a way to detect when a specific sound is playing? If that's the case we can have an object that sits at the position of the player and shoots the spells off in different directions to test the position/direction he is to the wall. We could even have it have a small area burst that would hit the player if he was against a corner, and if the shot took to long to his something, we could deduce that the player is at an exterior corner. Would it not be possible to do it this way? Lokenta PS I see how your script works, but I'd like something that you could move side to side with, as well as perhaps jumping off of the wall (though that would be afterwards, if at all). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.