Hi, everyone. I'm preparing to a develop a game that simulates my day job for mine and my colleagues's training purposes (nothing exciting, believe me
). I needed a function that would let me and my peers to change their name in-engine, typing it character by character, to let them use their own name without paxploding and coding anything. So I tried making my own
1) First, you need to have "letterA", "letterB", etc. enemies (make sure to give them "nomove 1 1" and big health value) with following scripts in their pain anims.
or
and so on
You can make their idle and pain anims images of the corresponding letters, or give each of them the following ondrawscript naming.c like this
Then, you should give the player character, who you want to be able to change their name and keep this name througout the set, this spawn anim script
Next, create a special "naming.txt" level and set it as the first level (after the first select screen where the character can be chosen, assuming you use select screens of course), spawn all the letters on your starting level screen in different places in the level and also an endlevel item
Next,
Then start the game, choose the renameable character, go to that starting level and start hitting the letters in order of your character's name ( For example, hit "M", "I", "K", "E" to get my real name, Mike
).
Touch the endlevel to go to the next level
That's it! Now your character's name is displayed the way you intended it to on all levels
Side note: You may wish to set up a drawstring command displaying p1name's current value to make sure you don't mess up the input or even put a script in the letters' pain anim to change the player's name with every hit for the same effect. Also, it's recommended to add an "erase" "button" that clears the globalvar's value to start again if you do mess up
Ok, It's my first attempt to bring something new to OpenBOR. Please don't be too harsh on me if you think my idea is stupid. I'm just a noob with good intentions
. Also, kimono has tested it already, so he can vouch for it working.
Play as Moonwalker in the "Streets of Nigtmare" set https://drive.google.com/file/d/1QKQAYpfw82rbo9dKe8i4qssRGhY6VO55/view?usp=sharing
Hit the letters in the order of the name you wish to set, then touch the barrel. It will assign the name and get you to the actual first level

1) First, you need to have "letterA", "letterB", etc. enemies (make sure to give them "nomove 1 1" and big health value) with following scripts in their pain anims.
Code:
@script
void p1name = getglobalvar("p1name");
if (p1name == NULL()) {
setglobalvar ("p1name","A");
}
else
{
setglobalvar ("p1name", p1name + "A");
}
@end_script
Code:
@script
void p1name = getglobalvar("p1name");
if (p1name == NULL()) {
setglobalvar ("p1name","B");
}
else
{
setglobalvar ("p1name", p1name + "B");
}
@end_script
You can make their idle and pain anims images of the corresponding letters, or give each of them the following ondrawscript naming.c like this
Code:
void main()
{
void self = getlocalvar("self"); //Get calling entity.
void p1name = getglobalvar("p1name");
char name = getentityproperty(self, "name"); //get entity name.
float z = getentityproperty(self, "z"); //get entity z value.
float x = getentityproperty(self, "x"); //get entity x value.
if (name == "letterA"){
drawstring (x-1, z-50, 3, "A");}
else if (name == "letterB"){
drawstring (x-1, z-50, 3, "B");}
else if (name == "letterC"){
drawstring (x-1, z-50, 3, "C");}
else if (name == "letterD"){
drawstring (x-1, z-50, 3, "D");}
else if (name == "letterE"){
drawstring (x-1, z-50, 3, "E");}
else if (name == "letterF"){
drawstring (x-1, z-50, 3, "F");}
else if (name == "letterG"){
drawstring (x-1, z-50, 3, "G");}
else if (name == "letterH"){
drawstring (x-1, z-50, 3, "H");}
else if (name == "letterI"){
drawstring (x-1, z-50, 3, "I");}
else if (name == "letterJ"){
drawstring (x-1, z-50, 3, "J");}
else if (name == "letterK"){
drawstring (x-1, z-50, 3, "K");}
else if (name == "letterL"){
drawstring (x-1, z-50, 3, "L");}
else if (name == "letterM"){
drawstring (x-1, z-50, 3, "M");}
else if (name == "letterN"){
drawstring (x-1, z-50, 3, "N");}
else if (name == "letterO"){
drawstring (x-1, z-50, 3, "O");}
else if (name == "letterP"){
drawstring (x-1, z-50, 3, "P");}
else if (name == "letterQ"){
drawstring (x-1, z-50, 3, "Q");}
else if (name == "letterR"){
drawstring (x-1, z-50, 3, "R");}
else if (name == "letterS"){
drawstring (x-1, z-50, 3, "S");}
else if (name == "letterT"){
drawstring (x-1, z-50, 3, "T");}
else if (name == "letterU"){
drawstring (x-1, z-50, 3, "U");}
else if (name == "letterV"){
drawstring (x-1, z-50, 3, "V");}
else if (name == "letterW"){
drawstring (x-1, z-50, 3, "W");}
else if (name == "letterX"){
drawstring (x-1, z-50, 3, "X");}
else if (name == "letterY"){
drawstring (x-1, z-50, 3, "Y");}
else if (name == "letterZ"){
drawstring (x-1, z-50, 3, "Z");}
}
Then, you should give the player character, who you want to be able to change their name and keep this name througout the set, this spawn anim script
Code:
@script
void self = getlocalvar("self");
void p1name = getglobalvar("p1name");
if (p1name != NULL())
{
changeentityproperty (self, "name", p1name);
}
@end_script
Next, create a special "naming.txt" level and set it as the first level (after the first select screen where the character can be chosen, assuming you use select screens of course), spawn all the letters on your starting level screen in different places in the level and also an endlevel item
Next,
Then start the game, choose the renameable character, go to that starting level and start hitting the letters in order of your character's name ( For example, hit "M", "I", "K", "E" to get my real name, Mike

Touch the endlevel to go to the next level
That's it! Now your character's name is displayed the way you intended it to on all levels
Side note: You may wish to set up a drawstring command displaying p1name's current value to make sure you don't mess up the input or even put a script in the letters' pain anim to change the player's name with every hit for the same effect. Also, it's recommended to add an "erase" "button" that clears the globalvar's value to start again if you do mess up
Ok, It's my first attempt to bring something new to OpenBOR. Please don't be too harsh on me if you think my idea is stupid. I'm just a noob with good intentions

Play as Moonwalker in the "Streets of Nigtmare" set https://drive.google.com/file/d/1QKQAYpfw82rbo9dKe8i4qssRGhY6VO55/view?usp=sharing
Hit the letters in the order of the name you wish to set, then touch the barrel. It will assign the name and get you to the actual first level