Jump to content

Trying to wrap my head around papyrus scripting


gigantibyte

Recommended Posts

So for now, I'm just trying to make a spell that generates an actor, and I was looking at examples on the forum.

 

On this page, I found this:

Scriptname ocyondeath extends Actor  

ActorBase Property E3Soldier  Auto  

ObjectReference Property XSP1  Auto  

Event OnDeath(Actor akKiller)
    XSP1.PlaceAtMe(E3Soldier  ,1)
endEvent

 

I'm lost on the 2nd and 3rd lines. What are these lines for and what does 'Auto' mean? My end goal is to create a spell that generates a random actor from a formlist, but right now I'd be happy to generate any creature.

 

If I try something like

Scriptname RandomMonsterScript extends activemagiceffect  

Event OnEffectStart(Actor caster, actor target)

       player.PlaceAtMe EncFalmer02Melee 1
       
EndEvent

 

... I get the compile error "no viable alternative at input 'PlaceAtMe". Must be missing some basics.

 

(Add head banging icon here)

Edited by gigantibyte
Link to comment
Share on other sites

Actually it should be

 

Scriptname RandomMonsterScript extends activemagiceffect  

ActoBase poperty EncFalmer02Melee auto

Event OnEffectStart(Actor caster, actor target)
    Game.Player().PlaceAtMe(EncFalmer02Melee, 1)
EndEvent

 

Praaven's script is missing the actor property, and "player" can't be called directly. You must call Game.GetPlayer().

 

Why don't you simply set up a magic effect using the "summon" archetype?

Link to comment
Share on other sites

Actually it should be

 

Scriptname RandomMonsterScript extends activemagiceffect  

ActoBase poperty EncFalmer02Melee auto

Event OnEffectStart(Actor caster, actor target)
    Game.Player().PlaceAtMe(EncFalmer02Melee, 1)
EndEvent

 

Praaven's script is missing the actor property, and "player" can't be called directly. You must call Game.GetPlayer().

 

Why don't you simply set up a magic effect using the "summon" archetype?

 

Right now I'm just trying to grasp the concepts. I was stuck on 'properties' for a bit. I did not realize that they needed to be set by highlighting the script in the Magic Effect window and clicking properties. 'Property' to me, meant a particular quality of an object, not the object itself. Like if speed was a property of a wolf, one might get the value with something like

int x = wolf.speed

I would have picked a different name for property like element, object, or form, but I'm sure there's some reason for why the CK designers went with what they did. At least now I know.

 

Perhaps the summon archetype could be used to achieve my end goal, which is to fulfil my own mod request to add a spell that creates/summons a random enemy to fight. Right now I'm thinking of creating a formlist of enemies to randomly pick from, and using the placeatme or placeactoratme functions. I also need to learn how to add vanilla monsters along with those from the Monster Pack mod, and how to spawn enemies at the appropriate level for the player. Happy to hear any advice on this. Thank you!

Link to comment
Share on other sites

I think to reach this you just have to create a leveled list.

 

Go to "LeveledCharacter" and you will see actors that are just "containers" of other actors.

 

Create a new leveled list and put whatever actor you want, specifying some parameters like conditions, levels (not player level, it means different levels of encounters), chances of spawn etc.

 

Once you are done, make your summon archetype magic effect summon your leveled list.

Link to comment
Share on other sites

I think to reach this you just have to create a leveled list.

 

Go to "LeveledCharacter" and you will see actors that are just "containers" of other actors.

 

Just thinking out loud as it will be a few hours before I can sit in front of the CK again. Can I make a leveled list of other leveled characters, or do I need to list each non-leveled version of the actor?

 

Create a new leveled list and put whatever actor you want, specifying some parameters like conditions, levels (not player level, it means different levels of encounters), chances of spawn etc.

 

More pondering here - different levels of encounters? This seems like something I can omit as I want them to appear when I cast the spell.

 

Once you are done, make your summon archetype magic effect summon your leveled list.

 

I did look over the summon archetype quickly last night, but thought I would be limited to one actor base. Will the summoned creature be friendly towards the player or can I set it to be hostile? Can they be unlimited by time?

 

Would it be prudent to include some kind of 'clean up' routine, so the using the mod doesn't create an overburden of dead bodies lying around for the game to track?

Link to comment
Share on other sites

I think there could be a clean up routine if you want the mod to be aimed at people with lower-end PC's. Otherwise, I think it depends - if you're summoning humans with the spells being cast, it would break immersion to have them vanish/get cleaned up (short of the usual despawn cycles that happen regularly ingame).

 

Otherwise if it's summoning spirits or something like that I think there is a death animation routine that causes people to disintegrate to nothing, right?

Link to comment
Share on other sites

I think there could be a clean up routine if you want the mod to be aimed at people with lower-end PC's. Otherwise, I think it depends - if you're summoning humans with the spells being cast, it would break immersion to have them vanish/get cleaned up (short of the usual despawn cycles that happen regularly ingame).

 

Well, I thinking more along the lines of marking the dead bodies for deletion, so they would disappear when the player left the area.

Link to comment
Share on other sites

That works too! I'm quite new to scripting and most of my territory hasn't touched things like leaving/being in areas or zones (still not sure how those work) in worldspace/interiors.

 

I think I do remember some script commands and functions that do that. I mean, if the mod will end up causing a lot of people to be summoned and that leads to a ton of corpses, then deletion seems best - and even if it doesn't I think it'd be easier on peoples' PC's to not have to load an extra corpse. It makes things cleaner, I suppose.

Link to comment
Share on other sites

That works too! I'm quite new to scripting and most of my territory hasn't touched things like leaving/being in areas or zones (still not sure how those work) in worldspace/interiors.

 

Cool. I did a little Fallout 3 scripting, but if I can get this mod working, it will be my first for Skyrim. Learning the mechanics is also bringing to mind other ideas.

 

Edit:

 

I have a working concept mod. I can conjure up numerous random hunters.

Edited by gigantibyte
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...