| Blockland Forums > Modification Help |
| static map spawn?? |
| << < (7/10) > >> |
| datiel12:
--- Quote from: PhantOS on February 28, 2018, 11:47:45 PM ---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)) --- End quote --- Ohh, okay. So if I do --- Code: ---%array[1] = "-29.6914 6.556 9.68498"; %array[2] = "-19.6014 7.51866 3.68498"; $spawnVec = %array[getrandom(1,2)]; package YourPackage if(!isobject(%client.minigame)) then { function GameConnection::spawnPlayer(%this) { Parent::spawnPlayer(%this); %this.player.setTransform($spawnVec); } } activatePackage(YourPackage); --- End code --- Would that be it? |
| PhantOS:
Yes on the array. The if statement must be within the function. Also there's no then statement in torquescript |
| datiel12:
--- Quote from: PhantOS on February 28, 2018, 11:54:15 PM ---Yes on the array. The if statement must be within the function. Also there's no then statement in torquescript --- End quote --- Ahh, okay.. Let me adjust give me a sec |
| PhantOS:
Also make sure the parent part stays outside of the if statement. Parent ensures that all game code attached to the function is called. If you put it inside an if statement, you'll never spawn if the condition is false |
| datiel12:
--- Quote from: PhantOS on February 28, 2018, 11:56:12 PM ---Also make sure the parent part stays outside of the if statement. Parent ensures that all game code attached to the function is called. If you put it inside an if statement, you'll never spawn if the condition is false --- End quote --- Maybe like this? --- Code: ---%array[1] = "-29.6914 6.556 9.68498"; %array[2] = "-19.6014 7.51866 3.68498"; $spawnVec = %array[getrandom(1,2)]; package YourPackage { if(!isobject(%client.minigame)); function GameConnection::spawnPlayer(%this) { Parent::spawnPlayer(%this); %this.player.setTransform($spawnVec); } } activatePackage(YourPackage); --- End code --- |
| Navigation |
| Message Index |
| Next page |
| Previous page |