Jump to content

fg109

Members
  • Posts

    1192
  • Joined

  • Last visited

Everything posted by fg109

  1. Even doing simple things can require a long/complex script. I wrote a tutorial for a lever controlling 3 doors, and another one trying to explain how weapon racks work. Of course, Bethesda's Hello World tutorial is about as simple as you can get. :biggrin:
  2. Well... you could create a start game enabled quest, add a quest script to it, add a spell property to the script, then script it to add the spell to the player in the OnInit() block.
  3. I doubt that the utility.wait is causing any problems, but I don't know what could be going wrong. How many do you mean when you say a lot of enemies? It's unlikely, but maybe you reached some kind of limit in script processing. A quick and dirty fix would be to give the shades a script: Event OnLoad() RegisterForSingleUpdate(40) EndEvent Event OnUpdate() DisableNoWait() Delete() EndEvent Of course, if that actually works, that means the problem wasn't from overloading the engine. As for the shades not attacking their own targets, it might have something to do with combat style or aggressiveness. You could try experimenting with that. The script command StopCombatAlarm would stop your shade and anyone attacking it to stop combat.
  4. I just used a magic effect because I prefer it. Lots of people use magic effects or reference aliases to attach scripts to the player. Of course, you can also attach a script to the player directly. I feel like it might lead to save game corruption or something if you later remove the mod though. But that's just a feeling, I don't know whether it will or not. Bottom line, I use magic effects because that's what everybody else does.
  5. This is a script for a magic effect of an ability on the player: Scriptname fg109TestME02 extends ActiveMagicEffect Event OnEffectStart(Actor akTarget, Actor akCaster) RegisterForTrackedStatsEvent() EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) UnregisterForTrackedStatsEvent() EndEvent Event OnTrackedStatsEvent(string asStat, int aiStatValue) if (asStat == "Skill Increases") Debug.MessageBox(asStat + ": " + aiStatValue) endif EndEvent
  6. I think you might want to take a look at image space modifiers for the lighting effects. I've never used them though so I don't really know how it works. I know you can set one for a spell, but not sure if that'll work the way you want it to. I think you should also be able to spawn one using PlaceAtMe. As for the bugs, did that happen before you did what I suggested or after? Anyway, I think I know the reason behind the second one. Magic effects work on dead actors. They get dispelled immediately, but they do work for a moment. So you might want to add a check for whether or not the target is dead. Something like: Event OnEffectStart(Actor akTarget, Actor akCaster) if (akTarget.IsDead()) Dispel() endif ;;; Endif
  7. Only the drag-and-dropped actors in the render window are actors. Everything under "Actor" in the Object Window (ie the base object for the actors) are technically actor bases.
  8. Don't try to use a Container property. They don't inherit from ObjectReference.
  9. You could try changing the entries for all actor bases to have a PC Level Mult greater than 1.
  10. Actually, I think my idea with using FindClosestReferenceOfTypeFromRef is pretty good. Your script wouldn't even change that much, just a couple added lines: Well, to address your suggestion, before you can access the properties from another script, you need to know which object that the other script is on. The way it accesses it looks something like this: object.property So you actually need to have a reference to the object the script is on in order for this to work. This is easy with something like a quest or the unique actors like the player, because you can assign them to a property in your script while in the Creation Kit. But accessing properties from a magic effect script that's on one of possibly many identical magic effects on multiple unknown actors? I don't know how to do it... Not to say that your idea is bad, just can't do it the exact way you suggested. It would actually be much easier to store the player's location in three global variables and access those from the magic effect's script. Otherwise, instead of setting the properties in the magic effect's script, just have the magic effect script read the properties from something else, like a quest script. So when the spell is first cast, you save the location of the player to a script on a quest. Then in your magic effect script, you read the location from the quest's script. Of course, you'll need a dummy quest for this to hold the values.
  11. Make the spell an ability, give yourself the ability.
  12. Try using FindClosestReferenceOfTypeFromRef.
  13. I think it might be because the 'marker' variable is actually empty. Try adding this to your OnEffectStart: if (marker) Debug.Notification("Marker variable is filled.") else Debug.Notification("Hazards are not actors.") endif
  14. I tried controlling flight with the movement directions before. I didn't like seeing my character run in midair though. I decided to make it so that I only fly in the direction my character is facing, and that toggling flight mode requires drawing/sheathing my weapon. The drawing/sheathing is because my character doesn't turn in 3rd person unless in combat mode. EDIT: I haven't figured out how to detect collision though. I tried an idea someone mentioned about casting spells, creating explosions, and spawning activators but for some reason it doesn't work.
  15. For first question, you can try making a trigger box slightly larger than the collision marker. For the second question, I don't know.
  16. DialogueFollower quest, Follower reference alias.
  17. Yes, you have it right at the end. I forgot to take out the game.getplayer() while I was copy-pasting. :wallbash:
  18. If you notice, the OnEffectStart and OnEffectFinish have actors as parameters. So logically that means only actors can run magic effect scripts. I have no idea why that the devs designed it that way. But I've tried casting spells at lots of different objects, and they don't run the magic effect scripts. Well I'm pretty sure I don't understand what you mean. You can't actually get a location off of a magic effect, because it doesn't exactly manifest itself in the game world. I'm sure there are many ways to create rune spells, I just thought this way worked best for what you were describing. For example, you could have instead used Hazards. You can think of them as trap spells. They cast a spell on you if you touch them. Just think, you could create a huge hazard and make it so that a skeleton pops out every time someone tries to walk through it. Well, yes if you wanted it to have no extras. It you want to add a magic effect to it, that's fine too. It just depends on whether or not you're satisfied with just summoning skeletons.
  19. OK, after reading your description, I realize that what I told you is not really going to work. I think I got caught up with those script fragments you posted and forgot what you wanted in the first place. So you want to be able to shoot a spell at an area, and have multiple skeletons show up. OK, that's good. I think what you need is actually an object reference script, not a spell script. Because I don't think spell scripts run on anything other than actors. You know how to link your spell to an explosion? Well Explosion objects have a field called "Placed Object", which means they spawn this object when they explode. Now this would be it if you wanted a single skeleton, but you wanted multiple. So you should choose to spawn an activator. This activator is going to be your rune. The activator's script is pretty simple: Scriptname MyRuneScript extends ObjectReference ACTORBASE PROPERTY skeletonType AUTO OBJECTREFERENCE skeleton1 OBJECTREFERENCE skeleton2 OBJECTREFERENCE skeleton3 EVENT OnLoad() skeleton1 = game.getPlayer().placeAtMe(skeletonType) skeleton2 = game.getPlayer().placeAtMe(skeletonType) skeleton3 = game.getPlayer().placeAtMe(skeletonType) RegisterForSingleUpdate(30) endEVENT EVENT OnUpdate() skeleton1.disableNoWait() skeleton2.disableNoWait() skeleton3.disableNoWait() skeleton1.Delete() skeleton2.Delete() skeleton3.Delete() Disable() Delete() endEVENT It's an adaption of the script you posted before. As soon as the your rune (the activator) shows up, it will spawn 3 skeletons. Then in 30 seconds, both the rune and the skeletons will be disabled and deleted. To change the duration, you just need to change the RegisterForSingleUpdate() to some other number. EDIT: And that script you posted up actually looks pretty good, except for some reason I thought it was going to be set off as a trap. So since rune1 is supposed to be dynamic and not at a fixed location, it's not going to work for what you want.
  20. You are the perfect test subject for my (WIP) article on scripting! Ahem! Anyway, you are correct in thinking that for a magic effect script, you need "extends ActiveMagicEffect" after the script name. ACTORBASE PROPERTY skeletonType AUTO ACTIVATOR PROPERTY summonPortal AUTO These are properties, I explain them in my article. To explain them takes a while, so please read the article instead if you really want to know. The names skeletonType and summonPortal are arbitrary. You can change them to anything you like (as long as you change the rest of the script to match). OBJECTREFERENCE skeleton1 OBJECTREFERENCE skeleton2 OBJECTREFERENCE skeleton3 OBJECTREFERENCE portal1 OBJECTREFERENCE portal2 OBJECTREFERENCE portal3 These are variables, also explained in my article. Again, the names are arbitrary. EVENT onEffectStart(ACTOR akTarget, ACTOR akCaster) skeleton1 = game.getPlayer().placeAtMe(skeletonType) portal1 = skeleton1.placeAtMe(summonPortal) skeleton2 = game.getPlayer().placeAtMe(skeletonType) portal2 = skeleton2.placeAtMe(summonPortal) skeleton3 = game.getPlayer().placeAtMe(skeletonType) portal3 = skeleton3.placeAtMe(summonPortal) I haven't gotten to events and functions yet. :sweat: Anyway, when the game sends your script an event, it also sends along some parameters relating to the event. In the case of OnEffectStart, it sends along the actor that gets hit by the effect, and the actor that cast the effect (which could both be the same actor). Again, the names akTarget and akCaster are arbitrary. When you use the PlaceAtMe() function, it returns a reference to the object that was just spawned. So it's assigning the references to the skeletons as skeleton1, skeleton2, and skeleton3. The skeletons are also spawning some portals after they get spawned, and assigning the references to portal1, portal2, and portal3. utility.wait(5) portal1.disableNoWait() portal2.disableNoWait() portal3.disableNoWait() endEVENT This part is telling the script to wait for 5 seconds (if you've experience in programming, you can think of 'utility' as a library) and then disable the portals so that they're no longer visible. EVENT onEffectFinish(ACTOR akTarget, ACTOR akCaster) skeleton1.disableNoWait() skeleton2.disableNoWait() skeleton3.disableNoWait() endEVENT This is the event that happens when the magic effect is finished, whether it's been dispelled or because the duration ran out. So, to do what you want, you need to create a property pointing to your rune (let's call it Rune01). Then you replace all mentions of 'Game.GetPlayer()' with 'Rune01' in the script. After that, you just need to put this in a spell that is 'fire and forget' and targets 'self'. When you put this effect into a spell, you can adjust the duration to whatever you want. After that, you just set the player to cast the spell at him/herself when she triggers your trap. Don't worry, using the Cast() function does not actually show any casting going on, so the player doesn't even notice if he/she cast the spell.
  21. OnEffectStart is an event for active magic effects, while your script extends ObjectReference. It won't work. Also, int UD = Game.GetPlayer().GetActorValue("UnarmedDamage") as int should be put inside an event or function.
  22. The global variable WIWaitDragon controls how many days you have to wait before another dragon attack can show up. If that's not good enough, you will need to read up on the story manager and how it triggers quests through SM event nodes. Then you will need to take a look at the Script Event node and look at the WEDragonQuests node. You'll have to figure out how to get it to trigger more often than the other random wilderness encounters.
  23. Debug.MessageBox("Level: " + Level.value + ", Level Progress: " + Use.value + ", Perk Points Available: " + PointsAvailable.value)
×
×
  • Create New...