| Blockland Forums > Modification Help |
| static map spawn?? |
| << < (6/10) > >> |
| Platypi:
--- Quote from: datiel12 on February 28, 2018, 06:15:30 PM ---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 --- End quote --- You'd probably want something like this: --- Code: ---$spawnVec = "x y z"; package YourPackage { function GameConnection::spawnPlayer(%this) { Parent::spawnPlayer(%this); %this.player.setTransform($spawnVec); } } activatePackage(YourPackage); --- End code --- 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: ---echo(findClientByName("you name").player.position); --- End code --- 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. |
| datiel12:
--- Quote from: Platypi on February 28, 2018, 08:04:48 PM ---You'd probably want something like this: --- Code: ---$spawnVec = "x y z"; package YourPackage { function GameConnection::spawnPlayer(%this) { Parent::spawnPlayer(%this); %this.player.setTransform($spawnVec); } } activatePackage(YourPackage); --- End code --- 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: ---echo(findClientByName("you name").player.position); --- End code --- 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. --- End quote --- 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 |
| PhantOS:
%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); |
| datiel12:
--- Quote from: PhantOS on February 28, 2018, 10:39:38 PM ---%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); --- End quote --- 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: ---%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); --- End code --- |
| PhantOS:
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)) |
| Navigation |
| Message Index |
| Next page |
| Previous page |