Author Topic: [Scripts] Massive Script Directory With Tutorials  (Read 229 times)

0 Members and 1 Guest are viewing this topic.

Kawika

  • Jr. Member
  • **
  • Posts: 41
  • Hawaii Life
    • View Profile
    • 8bit build team forum
    • Awards
  • Xbox: TM Kawika
  • Steam: poltergeist10
[Scripts] Massive Script Directory With Tutorials
« on: November 28, 2016, 04:24:35 AM »
I'm going to be making a huge list of scripts and how to do them. Also, any requests for scripts will be done. Reply with an idea, concept, or just a script that you know how to do, and it can be added to the list. This will hopefully get the non-scripters of Total Miner into scripting just a bit.

Auto Chest Bank (without variables)
Spoiler for Hidden Content:
An auto chest bank is used when you want players to have a physical location to store their personal belongings in your map! Whether it be an RPG, Deathmatch, Challenge Map, this script is a good addition to any world! It will make your map more advanced and appealing to people who want to play and admire your work! It involves checking if there is a locked chest in a certain area, if so, then moving on to the closest clear area, placing a chest and having that chest belong to the person. The script will go as follows:

///Set your coordinates to whatever you're working with in your map.
if
IsBlock [486,201,512] [lockedchest] [false]
Then
SetBlock [486,201,512] [lockedchest]
Elseif
IsBlock [487,201,512] [lockedchest] [false]
Then
SetBlock [487,201,512] [lockedchest]
Elseif
IsBlock [488,201,512] [lockedchest] [false]
Then
SetBlock [488,201,512] [lockedchest]
///You can do this until you reach the end of an aisle/row and reset the X to it's original position, increase the Y, then repeat the process
Elseif
IsBlock [486,202,512] [lockedchest] [false]
Then
SetBlock [486,202,512] [lockedchest]
Elseif
IsBlock [487,202,512] [lockedchest] [false]
Then
SetBlock [487,202,512] [lockedchest]

Gun Scripts (Easy)
Spoiler for Hidden Content:
Gun Scripts, (or really intersect scripts) are a way of making the guns in-game actually work. However, any item can be used as a "gun." I.E. staffs, potions, etc.
Usually the best way to go about this is to have 2 scripts. One sets the event and is usually put in the Player Join section, and the other is the actual gun script.
For this example, I will be using the Revolver.

How to do the event script:
Spoiler for Hidden Content:
Go into a blank script and put the following code in.

SetEventScript [ItemSwing] [Revolver] [Revolver Script]

So what this does is, when activated, makes it so that every time the revolver (an in-game gun) is used, it activates a seperate script called "Revolver Script" This is all we need to do for this script.

How to do the Gun Script
Spoiler for Hidden Content:
Now that you have the event script setup, it's time to make the gun do what it's supposed to do. There are more advanced versions of the gun script, but I will cover that in another script lesson.
Creating a gun script is all about customization. That is, you kind of have to use logic to see what makes sense for the item you're scripting. Since we're using a revolver, it makes sense for the range of the weapon to be short, and the damage to be moderately high, and this is how to write it:

If
   Intersect [ray] [vrel:0,0,0] [vrel:10,0,0] [players|mobs]
Then
   Context [Player] [Target]
   Health [-45]


What this does, is when the script is activated, any players or mobs within 10 blocks of the direction you're looking will take 45 damage. This is the most basic form of the gun script, and does not have particles, ammo, a HUD, etc. Don't forget to have your event script set, and you can learn about that in the easy gun script.

Gun Scripts (Medium)
Spoiler for Hidden Content:
We've gone over how to do the basic gun script, now we're going to tweak that same script and make it a bit more advanced by adding ammo, and a particle that shoots out of the gun. Let's start by using the same code as the easy gun script.

If
   Intersect [ray] [vrel:0,0,0] [vrel:10,0,0] [players|mobs]
Then
   Context [Player] [Target]
   Health [-45]


Now, we're going to take that script and add a few extra commands, so we get something like this. Note: The particle can be altered in countless different ways. Play around with it until you get the perfect particle for you. I'm using a pretty basic one.

If
   HasInventory [player] [bullet] [>=] [1]
Then
   Inventory [player] [take] [bullet] [1]
   Particle [vrel:0,0,0] [0.8] [vrel:70,0,0] [0.25,0.25.0.25,1] [220,220,0,255]
Else
   Exit
Endif
If
   Intersect [ray] [vrel:0,0,0] [vrel:10,0,0] [players|mobs]
Then
   Context [Player] [Target]
   Health [-45]


Now what this does, is the gun script will check for bullets in your inventory. If you have a bullet, it will take the bullet from your inventory, then will shoot out a particle coming from the rough area of your gun. It will last for 0.8 seconds, and have a velocity of 70 blocks per second from where it was shot. The particle will be 0.25 blocks long, wide, and tall, and will be colored yellow

Public Mines (deathmatch) (beginner)
Spoiler for Hidden Content:
Say you want to make a mine that's 8 blocks wide, 8 blocks long, and 20 blocks deep that is completely iron. An extremely simple script can make it refillable, and will notify everyone that the mine is about to refill, and to get their behinds out of there. The script will be written as follows,

Notify [[gamertag] is refilling the iron mine. Refilling in 10 seconds!] [global] [255,0,0]
wait [10000]
SetRegion [446,202,506] [454,182,514] [iron] [100]


The coordinates would be changed based on your coordinates of your mine, and you can also change the color of the notification by changing the 255,0,0 to some other combination to make different colors.

Public Mines (deathmatch) (easy)
Spoiler for Hidden Content:
To make our mines a little more diverse, we're going to change it just a little bit. We'll start by grabbing our old script.

Notify [[gamertag] is refilling the iron mine. Refilling in 10 seconds!] [global] [255,0,0]
wait [10000]
SetRegion [446,202,506] [454,182,514] [iron] [100]


We're going to change it, so that there is a random combination of iron and opal (or whichever blocks you prefer)
We're going to add another fill region with the same coordinates and altar the percentages of the filling.

Notify [[gamertag] is refilling the iron and opal mine. Refilling in 10 seconds!] [global] [255,0,0]
wait [10000]
SetRegion [446,202,506] [454,182,514] [iron] [100]
SetRegion [446,202,506] [454,182,514] [opal] [35]


By adding the SetRegion Opal, and changing the percentage (the last number) to 35%, we make it so that every time the mine is refilled, there is a random set of Opal inside the iron at a percentage of 35, and the other 65% is iron.

Instanced Rooms
Spoiler for Hidden Content:
This script is used to make it so that only people with a certain reason can be in a room. Whether that be a specific quest, a job site, a certain room, this script can be used in a large variety of ways. It's used most commonly with deathmatches, and RPGs. Some people use it in Challenge maps for progression as well. The script will go as follows.

First, you need to set up a zone for the door, entrance, whole room, whatever the area you want to be off limits to non-authorized people. Create that zone with the entry script as the name of your instance script.

If
   HasHistory [player] [Throne Room Quest] [false]
Then
   Teleport [player] [523,212,365]
Else
   Notify [Proceed to talk with the King about the incoming attack] [local] [255,0,0]
//Replace the coordinates and the Throne Room to mach your needs.
//The Notify is optional, and can be replaced with "Exit" and your script will be finished.


Very simple, this script will check if you have the required history, if not it will teleport you back to the entrance of the room.
« Last Edit: December 02, 2016, 01:25:18 PM by Kawika »
Leader and Founder of 8bit

Kawika

  • Jr. Member
  • **
  • Posts: 41
  • Hawaii Life
    • View Profile
    • 8bit build team forum
    • Awards
  • Xbox: TM Kawika
  • Steam: poltergeist10
Re: Massive Script Directory With Tutorials
« Reply #1 on: November 28, 2016, 08:24:12 PM »
Current to do list:

Code: [Select]
Hoverboard Script
Banking Script
Particle Trails
Private Mine
Automatic Item Bank
Shop Script
Fishing
Automatic Item Storage (history)
Halo Shield Script
Advanced teleporting

« Last Edit: December 02, 2016, 01:32:05 PM by Kawika »
Leader and Founder of 8bit

Kawika

  • Jr. Member
  • **
  • Posts: 41
  • Hawaii Life
    • View Profile
    • 8bit build team forum
    • Awards
  • Xbox: TM Kawika
  • Steam: poltergeist10
Re: Massive Script Directory With Tutorials
« Reply #2 on: December 02, 2016, 01:33:56 PM »
If there are any questions, or if a script is not working, or you would simply like to request a script, please do not hesitate to ask.
Leader and Founder of 8bit