static map spawn??

Author Topic: static map spawn??  (Read 4212 times)

is the top of your map covered?

is the top of your map covered?
yeah, im trying to spawn the player inside

idk †he code but its probable that the static map spawns you at the highest point wherever the spawn is. if thats the case then maybe cut out a tiny hole in the roof where you want the player to spawn inside

idk †he code but its probable that the static map spawns you at the highest point wherever the spawn is. if thats the case then maybe cut out a tiny hole in the roof where you want the player to spawn inside
I'll try that soon



u ok there
I don't know the drop point code. I never used static maps before

I don't know the drop point code. I never used static maps before
Torque uses drop points and i put the drop point inside the map, it just wont spawn in the map...

Why not just use spawn bricks or package an onspawn function and have it teleport the player where they want to go? I think drop points might be obsolete anyways

Why not just use spawn bricks or package an onspawn function and have it teleport the player where they want to go? I think drop points might be obsolete anyways
If I use spawn brick wont I have to load the save onspawn or something? and Im not sure how to use an onspawn function, I don't really know how to torquescript well

If I use spawn brick wont I have to load the save onspawn or something? and Im not sure how to use an onspawn function, I don't really know how to torquescript well

You'd probably want something like this:

Code: [Select]
$spawnVec = "x y z";

package YourPackage {
function GameConnection::spawnPlayer(%this) {
Parent::spawnPlayer(%this);
%this.player.setTransform($spawnVec);
}
}

activatePackage(YourPackage);

You would want to change $spawnVec to the location of the spawnpoint. To get this, load up the map, find a spawn point you like, and in the console type and execute this code snippet:

Code: [Select]
echo(findClientByName("you name").player.position);

Then replace $spawnVec with the coordinates/vector displayed in the console. There's probably a better way to do this, but this would work. To avoid having everyone spawn in the same place, you could find a couple spawn location, create an array of their coordinates, and have one of them randomly chosen each time a player spawns. I can write up code for this if you would like.

You'd probably want something like this:

Code: [Select]
$spawnVec = "x y z";

package YourPackage {
function GameConnection::spawnPlayer(%this) {
Parent::spawnPlayer(%this);
%this.player.setTransform($spawnVec);
}
}

activatePackage(YourPackage);

You would want to change $spawnVec to the location of the spawnpoint. To get this, load up the map, find a spawn point you like, and in the console type and execute this code snippet:

Code: [Select]
echo(findClientByName("you name").player.position);

Then replace $spawnVec with the coordinates/vector displayed in the console. There's probably a better way to do this, but this would work. To avoid having everyone spawn in the same place, you could find a couple spawn location, create an array of their coordinates, and have one of them randomly chosen each time a player spawns. I can write up code for this if you would like.
That works! But one problem, it works when im in a minigame. If I use slayer or default and set the spawn to another area (A) it will spawn at the regular location (Z).. I'm also not sure on how to make arrays in TS
« Last Edit: February 28, 2018, 09:29:42 PM by datiel12 »

%array[1] = 5;
%array[2] = 88;
announce(%array[getrandom(1,2)]);

Also you'll need to add an if that checks if the player is in a minigame. For this use %client.minigame (I think) or getminigamefromobject(%client);

%array[1] = 5;
%array[2] = 88;
announce(%array[getrandom(1,2)]);

Also you'll need to add an if that checks if the player is in a minigame. For this use %client.minigame (I think) or getminigamefromobject(%client);
Yeah, thats how I thought arrays worked.. But if I do if player is in mini, could i do if player is not in mini or something? because if the game knows the player isn't in mini then it will execute the code..

I'm also assuming the array code would look something like this?

Code: [Select]
%array[1] = "-29.6914 6.556 9.68498";
%array[2] = "-19.6014 7.51866 3.68498";
$spawnVec = %array[1],%array[2];

package YourPackage {
function GameConnection::spawnPlayer(%this) {
Parent::spawnPlayer(%this);
%this.player.setTransform($spawnVec);
}
}

activatePackage(YourPackage);
« Last Edit: February 28, 2018, 10:29:00 PM by datiel12 »

That'll give you an error. Try using getrandom like I did

Also ! Is the not operand in torquescript. So !a is not a.
If you wanted to do 'if player is not in minigame' you'd do if(!isobject(%client.minigame)) as opposed to if(isobject(%client.minigame))