Jump to content

Mod scripting help


Archanix29

Recommended Posts

Hello everyone.

 

For the past couple days I've been working on my first (public) mod that has a simple design, and it is almost complete; however there a couple features I want in it, but I have no idea how to implement them:

 

-A script to remove all caps from the player inventory (this is probably simple, but I'm pretty noob at more moderate scripting).

-A script to have the player blow up into an explosion that destroyed cars make.

-A script to have the player health and AP brought to 1.

-A script to take all player's items, and place them in a random container (I will specify these containers), along with a message that will say "Your items have been moved to <location>".

-A script to put the radiation value (not add to it) to 999.

-A script to turn the player into a vanilla toaster, whereas the HUD disappears, camera in centered on toaster, and all controls (except escape) disabled.

-Burning dogs fall from the sky (yes, an Oblivion reference). Time will probably be a minute before they stop. Also, if there is a way to despawn the bodies approx. 10 seconds after they hit the ground, that would help. I don't know how possible this could be.

-A script where all items the player has are dropped to the ground.

-Player is launched into the air.

-Player changes gender (I'm sure this is simply 'sexchange', but I want to make sure).

 

Do note that all of these will be going into another script (one that runs off 'getrandompercent').

 

I know this all sounds random, but it'll be for a (hopefully) fun mod. Once I have these, the mod will be up on the Nexus. And of course, anyone who helps will get their tag in the credits and be linked to it. I'd rather not use NVSE, but if needed I will.

 

Thanks in advance everyone. ^.^

Link to comment
Share on other sites

-A script to remove all caps from the player inventory (this is probably simple, but I'm pretty noob at more moderate scripting).

Use GetItemCount to find out how many caps the player has and RemoveItem to remove them.

 

-A script to have the player blow up into an explosion that destroyed cars make.

 

Use PlaceAtMe to place an explosion at the player's feet. The one used for cars is SmallNukeExplosion. Might want to temporarily give him a lot of HP, or make a custom explosion that doesn't do damage.

 

-A script to have the player health and AP brought to 1.

 

Use ModActorValue, but first use GetActorValue to determine the amount to change.

 

-A script to take all player's items, and place them in a random container (I will specify these containers), along with a message that will say "Your items have been moved to <location>".

 

Use RemoveAllItems and specify your container's reference as a parameter.

 

-A script to put the radiation value (not add to it) to 999.

 

If what you mean is setting the player's radiation level, then you can use ModActorValue for that as well.

 

-A script to turn the player into a vanilla toaster, whereas the HUD disappears, camera in centered on toaster, and all controls (except escape) disabled.

 

This I don't know about.

 

-Burning dogs fall from the sky (yes, an Oblivion reference). Time will probably be a minute before they stop. Also, if there is a way to despawn the bodies approx. 10 seconds after they hit the ground, that would help. I don't know how possible this could be.

 

This I also to think about, but I guess it should be easy enough.

 

-A script where all items the player has are dropped to the ground.

 

This I really don't recommend doing unless you want those items to clip through the ground and be lost forever. I think it's somewhat safe for interior cells, but I still wouldn't do it.

 

-Player is launched into the air.

 

Might be possible to send the player flying if he is knocked unconscious first. Will have to test.

 

-Player changes gender (I'm sure this is simply 'sexchange', but I want to make sure).

 

Yup, SexChange should do it.

Edited by Ladez
Link to comment
Share on other sites

Thank you.

 

 

I'm going to one-shot this, but I'm guessing at the beginning of the script, I'll have to put another variable, such as 'short LDCapCount'.

Followed by that 'Set LDCapCount to Player.GetItemCount Caps001', and then 'Player.RemoveItem Caps001 LDCapsCount 1'.

I don't know if the variable is necessary; would there be a way to work without it?

 

 

I do want the player to die, so 'Player.placeatme SmallNukeExplosion 1' and then 'Player.ModActorValue Health 0' since explosions by themselves aren't that effective. Third possibility would be the same except for AP value, which I am unsure of.

 

 

So just add the container ID at the end?

 

 

I assume that would be the same as the one to set Health and AP to 1, but again I'm unsure of what rads go by.

 

 

I really want the toaster thing to happen, so I'll experiment. I'm guessing use 'Player.placeatme ToasterPrewar 1', 'player.disable' plus go into the Endgame scripts and use what I find there. The only thing I don't know about is centering the camera.

 

 

I'll experiment with the dog apocalypse, and once I buy another Oblivion (which should be soon), I'll look at that script for a rough idea.

 

 

Skipping the dropping items thing then.

 

 

Maybe something along the lines of changing the Y coordinates similar to an interior vault door?

Link to comment
Share on other sites

I really want the toaster thing to happen, so I'll experiment. I'm guessing use 'Player.placeatme ToasterPrewar 1', 'player.disable' plus go into the Endgame scripts and use what I find there. The only thing I don't know about is centering the camera.

 

Easy concept, not so easy execution, it depends by what you exactly want to do.

If you do it in a specific location, you can make it 10 times easier because you already plan the "scene" on the GECK, your position, the position of the toaster and script it properly with few lines.

But if you want it in a generic place, handling a good camera could require some extra lines and has downsides: one of your scripts could move you/the camera or the toaster behind an obstacle, blocking the view.

 

Anyway, you can spawn the toaster and give it a specific ref:

Let MyToasterREF := Player.PlaceAtMe <MyID>

You can move the player to some relative position, to have a better "view", with something like this:

Let ZToaster := (MyToasterREF.GetAngle Z) + (eventual Z angle offset to place player behind / in front / on a side)

Let SinZToaster := Sin ZToaster
Let CosZToaster := Cos ZToaster

Let XOffset := (SomeDistance) * SinZToaster 
Let YOffset := (SomeDistance)* CosZToaster 

Let playerX := (MyToasterREF.Getpos X) + XOffset
Let playerY := (MyToasterREF.Getpos Y) + YOffset
Let playerZ := (MyToasterREF.Getpos Z) + (Some offset on Z position)

player.SetPos X playerX 
player.SetPos Y playerY
player.SetPos Z playerZ

Or, you can make the opposite, spawn the toaster and then move it to some relative position from the player, keeping the player (the camera) on its own position and only moving its Z angle with GetHeadingAngle.

Or you can simply spawn the toaster and use MoveTo to move it to some relative position behind you without caring too much to achieve some perfect value for what concerns the position.

 

After positioning toaster and player\camera, you can look at the toaster via GetHeadingAngle:

Let MyZangle := Player.GetAngle Z + Player.GetHeadingAngle MyToasterREF
Player.SetAngle Z MyZangle

In case of some offset on the Z position, achieving X angle is a bit more tricky. You can make few experiments ingame and make an approximation of a hipotetical value for the X, which is the easiest way.

If you want a real X angle, it requires some extra math.

Link to comment
Share on other sites

I'm going to one-shot this, but I'm guessing at the beginning of the script, I'll have to put another variable, such as 'short LDCapCount'.

Followed by that 'Set LDCapCount to Player.GetItemCount Caps001', and then 'Player.RemoveItem Caps001 LDCapsCount 1'.

I don't know if the variable is necessary; would there be a way to work without it?

 

Yes, you need the variable since you can't use a function call directly as a parameter in another function call. You also need it to be able to give the player his caps back when you're done.

 

I do want the player to die, so 'Player.placeatme SmallNukeExplosion 1' and then 'Player.ModActorValue Health 0' since explosions by themselves aren't that effective. Third possibility would be the same except for AP value, which I am unsure of.

 

Just use Player.Kill to kill the player without fiddling with health points. Not sure why you'd want that though?

 

Anyway, I also recommend you take a look at the list of Actor Value functions to get an overview. There's also a list of stats which can be modified by those functions here.

 

So just add the container ID at the end?

 

Yes, the reference ID of the container that you've placed in the world, that is, not the base ID you see in the object window. Just so we're clear.

 

I assume that would be the same as the one to set Health and AP to 1, but again I'm unsure of what rads go by.

 

Refer to the Stats list, I believe it's called RadiationRads.

 

I'll experiment with the dog apocalypse, and once I buy another Oblivion (which should be soon), I'll look at that script for a rough idea.

 

Experiment with PlaceAtMe to get the dogs in the world (remember to save the references in variables, also remember to read the notes about PlaceAtMe since there's some stuff you need to be aware of), SetPos to position them high in the air, Kill to kill them if you need them to be dead and GetSecondsPassed to set up a timer to make it stop.

 

For applying a burning effect you can use PMS. Under Effect Shaders in the GECK, you can use Flames01 and Smoke01 and provide them as parameters to PMS. You can call PMS with a duration for the effects, otherwise you can use SMS to stop them at any time.

Link to comment
Share on other sites

Everybody, thank you so much for your help; I'll see what I can get going. I do want the mod released by this Sunday, so if I can't get this coded properly it'll have to wait until an update while I familiarize myself again with the coding. I'll just use placeholders for whatever I can't get running.

Link to comment
Share on other sites

I'm having a bit more (noobish) trouble.

 

I want to teleport the player to a certain room, but all the tries failed. Poked around to find the scripts that teleport the player when a main quest is finished and when player is moved to Caesar's camp, but no luck.

 

I've tried:

player.moveto LDPitofDoomREFMarker

... and replaced the marker with other items, but no luck. Also tried replacing player with playerREF.

 

I also was sure to try both types of markers found in G.E.C.K.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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