| Blockland Forums > Modification Help |
| static map spawn?? |
| << < (8/10) > >> |
| PhantOS:
Put the if statement Inside the function. If statements need { } open close brackets too. Everything inside the brackets will be called if the condition is true |
| PhantOS:
Here I'll just --- Code: ---%array[1] = "-29.6914 6.556 9.68498"; %array[2] = "-19.6014 7.51866 3.68498"; $spawnVec = %array[getrandom(1,2)]; package YourPackage { function GameConnection::spawnPlayer(%this) { Parent::spawnPlayer(%this); If(!isobject(%this.minigame)) %this.player.setTransform($spawnVec); } }; activatePackage(YourPackage); --- End code --- |
| datiel12:
--- Quote from: PhantOS on March 01, 2018, 12:01:36 AM ---Here I'll just --- Code: ---%array[1] = "-29.6914 6.556 9.68498"; %array[2] = "-19.6014 7.51866 3.68498"; $spawnVec = %array[getrandom(1,2)]; package YourPackage { function GameConnection::spawnPlayer(%this) { Parent::spawnPlayer(%this); If(!isobject(%this.minigame)) %this.player.setTransform($spawnVec); } }; activatePackage(YourPackage); --- End code --- --- End quote --- thats how mine looks like lol, gonna testeeeeee |
| PhantOS:
--- Quote from: datiel12 on March 01, 2018, 12:02:32 AM ---thats how mine looks like lol, gonna testeeeeee --- End quote --- it's a bit different. In the future you should read up a bit on torquescript syntax if you plan on doing stuff like this You learn a lot when you learn |
| datiel12:
--- Quote from: PhantOS on March 01, 2018, 12:03:38 AM ---it's a bit different. In the future you should read up a bit on torquescript syntax if you plan on doing stuff like this You learn a lot when you learn --- End quote --- Just like when my dad was teaching me javascript, thanks PhantOS! |
| Navigation |
| Message Index |
| Next page |
| Previous page |