Post by Spottedpath on Aug 13, 2017 6:57:51 GMT
So you've gone and done it. Read all of Kamuna's guides. Read all the features. And you still have no clue what any of this Mystery Script stuff is. Alright. Well. This is a very basic guide that will go into more detail about the most basic functions MS has to offer. If you don't understand this? Nothing will help you.
First off, we have to create our basic mode set up, which should look something like this:
This sets up a mode with a killing role, a role that sometimes spawns, and a role that sometimes spawns and can spawn ontop of other roles. Now we need to prep our mode using a function, before we get to coding it, as our roles use MULTI and FORCEROLE.
For reference: setcustomroleX("name",multi,forcerole); Multi means the role can be given to people who already have a role. Forcerole means the role is. 0 Off. 1 On. 2 Let the mode decide (prepmode).
Prepmode:
This function checks the mode's name and makes sure the game ISN'T in progress, turns the roles off and then, if the number of players is greater than 3, turns the roles ON. Then waits based on the lag. Spawn is then used to call the function, thus activating it's code.
Note: ALL WHILE LOOPS SHOULD HAVE A WAIT BEFORE THEIR CLOSING BRACKET.
Now we need to write our modes START code. Our mode's start code is what the mode does during the mode; while it's in progress. It's also what the mode launches when it starts.
As I have this set to call ModeEnd() in the setcustommode, it will also be a function. However, if you're using a File (ModeStart.ms), you will instead write your code in a separate file.
ModeStart:
Here's a basic modestart file. It printtos the killer their role message, if the customroles spawn, as they're not forced, and only spawn based on how many players there are, they too get printted too. It also has a basic wprint (WORLD PRINT) which prints to the world the starting announcement. Oh. It also sets the role of the second customrole, which gives them the shinigami eyes.
wprint("TEXT");
showkiller("TEXT"); or showcustomroleX("TEXT");
printto(player, object, mob, "TEXT");
set_role(player, object, mob,"MODE NAME: ROLE NAME");
For advanced text strings, use strcats and variables:
This tells the "accomplice" the killer's alias, and wprints customrole2's hair color is suspect.
If you're trying to target someone who isn't a role, there aren't any direct ways. But there are indirect ways!
The first thing, a list cycle, uses a special thing called 'my'. My is used inside list cycles and special functions and things that can use my. It requires there be already a predefined target, and in list cycles, it's everyone inside the list 'GetAlive()'. The list cycle here checks for everyone who has amber hair (the boy with sunglasses), and then makes them kill themself.
The second thing, a pick(list) is a function that just picks anything inside a list. In this case it's picking from the Alive list, and will pick one single player, declare them as 'randomguy' as randomguy=pick(GetAlive()); and then forcesuicide will target whoever 'randomguy' is, a random student who is alive.
You can also printto variables (printto(randomguy,"words"). Or printto 'my', inside the list cycle. Inside list cycles, however, unless using a function inside a list cycle, dont forget to use your backslashes before every " that calls a text string.
Creating weapons and custom items are pretty much the same, so here's a quickie on those:
And finally, the last thing about basic modes is a loop. Of course, since I'm doing a function based mode, I will do this inside a function! Minifunction tutorial kinda!
func suspect() creates a function; game=gameinprogress(); defines gameinprogress as game; then while(gameinprogress), define game as another check for gameinprogress, so the loop doesnt continue after the game has ended; time=checktime(); will define time as the current checked time, and if time == "12AM", wprint the earlier mentioned string. break; then ends the loop. wait(time); is of course, then put there to make it reloop every 5 seconds (50/10 = 5) so it doesnt immediately and instantly loop and cause an infinite loop or recursion.
Now we start on the end function.
ModeEnd()
This is the simplest file, and you shouldn't need much help with it, and I have no need to explain it to you, as I explained strings earlier.
Anyways, this is literally everything you need to make a basic mode. OST. So if you cant even use THIS, stop asking me for help.
First off, we have to create our basic mode set up, which should look something like this:
setkiller("Role Name");
setcustomrole1("Role Name",0,2);
setcustomrole2("Role Name",1,2);
setcustommode("Basic Mode",1,"","Music","Picture","ModeStart();","ModeEnd();",1);
This sets up a mode with a killing role, a role that sometimes spawns, and a role that sometimes spawns and can spawn ontop of other roles. Now we need to prep our mode using a function, before we get to coding it, as our roles use MULTI and FORCEROLE.
For reference: setcustomroleX("name",multi,forcerole); Multi means the role can be given to people who already have a role. Forcerole means the role is. 0 Off. 1 On. 2 Let the mode decide (prepmode).
Prepmode:
func prepmode()
{
checkmode = checkmode();
gameinprogress = gameinprogress();
while(!gameinprogress && checkmode == "Basic Mode")
{
gameinprogress = gameinprogress();
checkmode = checkmode();
numofplayers = numofplayers();
setcustomrole1("Role Name",0,0);
setcustomrole2("Role Name",1,0);
if(numofplayers > 3)
{
setcustomrole1("Role Name",0,1);
setcustomrole2("Role Name",1,1);
}
wait(tick_lag());
}
}
spawn(0,"prepmode();");
This function checks the mode's name and makes sure the game ISN'T in progress, turns the roles off and then, if the number of players is greater than 3, turns the roles ON. Then waits based on the lag. Spawn is then used to call the function, thus activating it's code.
Note: ALL WHILE LOOPS SHOULD HAVE A WAIT BEFORE THEIR CLOSING BRACKET.
Now we need to write our modes START code. Our mode's start code is what the mode does during the mode; while it's in progress. It's also what the mode launches when it starts.
As I have this set to call ModeEnd() in the setcustommode, it will also be a function. However, if you're using a File (ModeStart.ms), you will instead write your code in a separate file.
ModeStart:
func Modestart()
{
wprint("<big><font color=red>Warning:</font> Dead body located on premises. Lockdown in progress.</big>");
showkiller("You're the killer");
printto(killer,"<b>You're the killer</b>");
printto(killer,"<i>You killed someone, yo.</i>");
if(customrole1)
{
showcustomrole1("You're the accomplice");
printto(customrole1,"<b>You're the accomplice</b>");
printto(customrole1,"<i>You killed someone, yo.</i>");
}
if(customrole2)
{
set_role(customrole2,"Death Note: Shinigami Eyes");
}
}
Here's a basic modestart file. It printtos the killer their role message, if the customroles spawn, as they're not forced, and only spawn based on how many players there are, they too get printted too. It also has a basic wprint (WORLD PRINT) which prints to the world the starting announcement. Oh. It also sets the role of the second customrole, which gives them the shinigami eyes.
wprint("TEXT");
showkiller("TEXT"); or showcustomroleX("TEXT");
printto(player, object, mob, "TEXT");
set_role(player, object, mob,"MODE NAME: ROLE NAME");
For advanced text strings, use strcats and variables:
this=strcat(get_alias(killer), "helped you kill them yo.");
printto(customrole1,this);
this=strcat("A suspect has been identified. Suspect has ",get_haircolor(customrole2)," colored hair.");
wprint(this);
This tells the "accomplice" the killer's alias, and wprints customrole2's hair color is suspect.
If you're trying to target someone who isn't a role, there aren't any direct ways. But there are indirect ways!
player_list_cycle(GetAlive(),"color=get_haircolor(my);if(color==\"Amber\"){forcesuicide(my);}");
randomguy=pick(GetAlive());
forcesuicide(randomguy);
The first thing, a list cycle, uses a special thing called 'my'. My is used inside list cycles and special functions and things that can use my. It requires there be already a predefined target, and in list cycles, it's everyone inside the list 'GetAlive()'. The list cycle here checks for everyone who has amber hair (the boy with sunglasses), and then makes them kill themself.
The second thing, a pick(list) is a function that just picks anything inside a list. In this case it's picking from the Alive list, and will pick one single player, declare them as 'randomguy' as randomguy=pick(GetAlive()); and then forcesuicide will target whoever 'randomguy' is, a random student who is alive.
You can also printto variables (printto(randomguy,"words"). Or printto 'my', inside the list cycle. Inside list cycles, however, unless using a function inside a list cycle, dont forget to use your backslashes before every " that calls a text string.
Creating weapons and custom items are pretty much the same, so here's a quickie on those:
create_weapon(name,icon,overlayicon,boverlayicon,x,y,z,sx=0,sy=0,type="",weight=0,takeable=1,droppable=1,throwable=1,throwrange=3,throwspeed=6,rotationspeed=6,damage=0,lethal=0,drain=1,ver="hits",soundeffect='punch.wav',range=18,delay=12,stun=12,usecount=null,paintcolor=null,bloody=0,specificdelaytime=0,specialver="a",emessage="",code="",usecode="",unsearchable=0,onpickup="",ondrop="",onthrow="",onsteal="",onequip="",onunequip="",effecticon='weffects.dmi',anitime=null,randomeffect=0,effectoffset_x=0,effectoffset_y=0,weapontype=list(),dualwieldable=0,doverlayicon=null,dboverlayicon=null,knocksdown = 0,attackstunreduction = 50,hitstunreduction = 100, knockback = 8);
First off, remove all the useless junk.
create_weapon("name","icon.dmi","overlay.dmi","bloodyoverlay.dmi",0,0,0,0,0,"",0,1,1,1,3,6,6,0,0,1,"hits","sound",18,12,12,null,null,0,0,"a","","","",0,"","","","","","",null,null,0,0,=0,list(),0,null,null,0,50,100,8);
Much better. Now, a lot of this you wont be using, you'll mostly be using code or usecode, lethal, range, delay, stun, damage, and maybe a few of the other ones. The timers (delay and stun) are in 1/10s seconds. So 10=1 second. Range is in pixels.
But, I'm just going to tell you how to properly spawn a weapon. I'm just giving you the basics.
First off, you need to define the weapon as a variable.
weapon=create_weapon("name","icon.dmi","overlay.dmi","bloodyoverlay.dmi",0,0,0,0,0,"",0,1,1,1,3,6,6,0,0,1,"hits","sound",18,12,12,null,null,0,0,"a","","","",0,"","","","","","",null,null,0,0,=0,list(),0,null,null,0,50,100,8);
Then set it's position to the object or location you want it to be at.
set_pos(weapon,"all",killer);
Using 'killer' instead of "get_pos(killer,"all");" will put it in the killer's inventory, instead of under the killer.
And congratulations, you've put a weapon in the killer's inventory.
And finally, the last thing about basic modes is a loop. Of course, since I'm doing a function based mode, I will do this inside a function! Minifunction tutorial kinda!
func suspect()
{
game=gameinprogress();
while(game)
{
game=gameinprogress();
time=checktime();
if(time=="12AM")
{
this=strcat("A suspect has been identified. Suspect has ",get_haircolor(customrole2)," colored hair.");
wprint(this);
break;
}
wait(50);
}
}
if(customrole2)
{
spawn(0,"suspect();");
}
func suspect() creates a function; game=gameinprogress(); defines gameinprogress as game; then while(gameinprogress), define game as another check for gameinprogress, so the loop doesnt continue after the game has ended; time=checktime(); will define time as the current checked time, and if time == "12AM", wprint the earlier mentioned string. break; then ends the loop. wait(time); is of course, then put there to make it reloop every 5 seconds (50/10 = 5) so it doesnt immediately and instantly loop and cause an infinite loop or recursion.
Now we start on the end function.
ModeEnd()
Almost all mode ends are like this:
a = strcat("The killer was ",get_realname(killer));
b = strcat(" / ",get_alias(killer));
c = strcat(", played by ",get_key(killer));
d = strcat(a,b);
e = strcat(d,c);
wprint(e);
wait(3);
if(customrole1)
{
f = strcat("The accomplice was ",get_realname(customrole1));
g = strcat(" / ",get_alias(customrole1));
h = strcat(", played by ",get_key(customrole1));
i = strcat(f,g);
j = strcat(i,h);
wprint(j);
wait(3);
}
if(customrole2)
{
k = strcat("The shinigami eyes was ",get_realname(customrole2));
l = strcat(" / ",get_alias(customrole2));
m = strcat(", played by ",get_key(customrole2));
n = strcat(k,l);
o = strcat(n,m);
wprint(o);
wait(3);
}
numdead = length(GetDead());
numalive = length(GetAlive());
if(numdead > 0)
{
if(numalive < 1)
{
wprint("Everyone died, somehow.");
}
if(numalive == 1)
{
if(!findinlist(killer,GetAlive()))
{
wprint("Some people lived and some people died, the killer among them.");
}
else
{
wprint("Everyone died but the killer. The killer wins!");
}
}
if(numalive > 1)
{
if(!findinlist(killer,GetAlive()))
{
wprint("Some people lived and some people died, the killer among them");
}
else
{
wprint("Some people lived and some people died. The killer however, survived.");
}
}
}
else
{
wprint("It seems nobody died. The killer loses!");
}
}
This is the simplest file, and you shouldn't need much help with it, and I have no need to explain it to you, as I explained strings earlier.
Anyways, this is literally everything you need to make a basic mode. OST. So if you cant even use THIS, stop asking me for help.