Scripting stuff
Scripting stuff
How do I give a random player a tag of 1?
OR
How can I make a random player activate a particular script....?
OR
How can I make a random player activate a particular script....?
Last edited by Krispy on Tue Oct 09, 2012 11:26 pm, edited 1 time in total.
RE: Scripting stuff
I don't know if it's the best way, but you can get all the players who are actually playing with PlayerInGame and Random to pick one of those.
RE: Scripting stuff
Specify? I'd like the answer to question #1 more, BTW.
Last edited by Krispy on Wed Oct 10, 2012 12:08 am, edited 1 time in total.
-
Catastrophe
- Retired Staff / Community Team Member
- Posts: 2569
- Joined: Sat Jun 02, 2012 2:44 am
RE: Scripting stuff
On an ENTER script, give everyone a new tid(eg playernumber + 1000)
Once done you can just do a random(1000, playercount+1000) for script activator.
Once done you can just do a random(1000, playercount+1000) for script activator.
RE: Scripting stuff
Obviously replace the "do my stuff" block with your stuff and call script 3 to activate this
Code: Select all
#include "zcommon.acs"
#define P_BASETID 1000
#define MAXPLAYERS 64
script 1 ENTER
{
Thing_ChaneTID(0, P_BASETID+PlayerNumber());
}
script 2 RESPAWN
{
Thing_ChangeTID(PBASETID+PlayerNumber(), 0);
Thing_ChaneTID(0, P_BASETID+PlayerNumber());
}
//Your Script
script 3 (void)
{
int r = random(0, MAXPLAYERS-1)
if (PlayerInGame(r))
{
//Do Your Stuff
Thing_Damage(1000+r, 1000, 0);
//End Your stuff
}
else
restart;
}RE: Scripting stuff
Sorry for being so vague here's my scripts.
And now I have one player out of however many with a tag of 1. He's special now, and he's gonna do other stuff. Everyone else I'm assuming has a tag over 1000.
Code: Select all
script 1 open
{
Clearinventory();
HudMessageBold(s:"Selecting Seeker..."; HUDMSG_FADEOUT, 2, 0, 0.1, 0.8, 3.7);
//script to assign random player a tag of 1
Delay(200);
//script to get said player to activate script 2
{
script 2 (void)
{
delay(50);
SetFont("BIGFONT");
printbold(n:"0", s:" \c[Green]has been chosen!");
Thing_ChangeTID (0, 1000+PlayerNumber());
TeleportOther(1001,4,1);
delay(10);
TeleportOther(1002,4,1);
delay(10);
TeleportOther(1003,4,1);
delay(10);
TeleportOther(1004,4,1);
delay(10);
TeleportOther(1005,4,1);
delay(10);
TeleportOther(1006,4,1);
delay(10);
TeleportOther(1007,4,1);
delay(10);
TeleportOther(1008,4,1);
delay(10);
TeleportOther(1009,4,1);
delay(10);
TeleportOther(1010,4,1);
delay(10);
TeleportOther(1011,4,1);
delay(10);
TeleportOther(1012,4,1);
delay(10);
TeleportOther(1013,4,1);
delay(10);
TeleportOther(1014,4,1);
delay(10);
TeleportOther(1015,4,1);
delay(10);
TeleportOther(1016,4,1);
delay(10);
TeleportOther(1017,4,1);//and so on...
}
Last edited by Krispy on Wed Oct 10, 2012 7:48 pm, edited 1 time in total.
RE: Scripting stuff
You should have just modified the script I gave you, I'm not really fond of holding your hand for scripts anymore, you need to learn how to actually script because the script you wrote makes so many novice mistakes that it would have never worked in the first place:
That code should work if your code is doing what I think it's doing.
Also, use this to make it so another seeker will be picked upon the Seeker's death (completely optional):
Here are some things I noticed about the code you wrote:
Code: Select all
#include "zcommon.acs"
#define P_BASETID 1000
#define MAXPLAYERS 64
script 1 ENTER
{
ClearInventory();
Thing_ChaneTID(0, P_BASETID+PlayerNumber());
}
script 2 RESPAWN
{
Thing_ChangeTID(PBASETID+PlayerNumber(), 0);
Thing_ChangeTID(0, P_BASETID+PlayerNumber());
Delay(1);
Thing_ChangeTID(1, 0);
}
script 3 OPEN
{
int r = random(0, MAXPLAYERS-1)
if (PlayerInGame(r))
{
HudMessageBold(s:"Selecting Seeker..."; HUDMSG_FADEOUT, 2, 0, 0.1, 0.8, 3.7);
Delay(250);
Thing_ChangeTID(P_BASETID+r, 1);
SetFont("BIGFONT");
printbold(n:r+1, s:" \c[Green]has been chosen!");
for (int x; x < MAXPLAYERS; ++X)
if (x != r && PlayerInGame(x))
{
TeleportOther(P_BASETID+x, 4, 1);
Delay(10); //Delay between teleports
}
}
else
restart;
}
Also, use this to make it so another seeker will be picked upon the Seeker's death (completely optional):
Code: Select all
script 4 DEATH
{
if (ActivatorTID() == 1)
ACS_Execute(3,0,0,0,0); //Choose New Seeker
}Spoiler: read this (Open)
Last edited by Llewellyn on Thu Oct 11, 2012 4:14 am, edited 1 time in total.
RE: Scripting stuff
I'm sorry, but
[spoiler]
[/spoiler]
But really I'm just kidding. you're very helpful, thank you. I hope I haven't used up all my help passes by now. And you're right, I should probably have gotten the hang of this by now... Playing is by far better than scripting!
[spoiler]
[/spoiler]But really I'm just kidding. you're very helpful, thank you. I hope I haven't used up all my help passes by now. And you're right, I should probably have gotten the hang of this by now... Playing is by far better than scripting!