| Blockland Forums > Modification Help |
| Help with spawning projectile via function? |
| (1/2) > >> |
| xS K I D z:
I'm trying to spawn a projectile by using a function but I can't seem to get it to work properly. I know about: --- Code: ---%proj = new Projectile() { dataBlock = 'name'; initialPosition = %position; initialVelocity = 3; client = %player; }; --- End code --- I just have it set up so that when the function is called, the current item is removed from the inventory, and then I want a projectile to spawn like it is being thrown from the player (projectile spawns where player is looking) but I don't think I set it up right so I deleted everything and starting over lol. |
| FelipeO_O_:
--- Code: ---%proj = new Projectile() { dataBlock = 'name'; initialPosition = %position; initialVelocity = 3; client = %player; }; //Everytime you are going to "add" something to the world manually //you have to call this missioncleanup.add(%proj); --- End code --- |
| Kyuande:
^ while that is good practice, that is not the problem, but you are missing sourceObject too What are you exactly using to make the projectile? |
| xS K I D z:
It did solve my spawning-in-the-world issue. I have more issues though :P The projectile spawns sideways, and I think in the "middle" of the world, not the player. I know it's probably my variables(not set up right/carrying over?), and not being able to get/set the position on/from the player because I'm [still learning] dumb. |
| Kyuande:
Initial velocity is a 3 field vector (Vector3F) (X Y Z), your field is only an integer. Always remember that velocity is a direction of speed, stating the speed in an integer will not make sense. What direction to do you want the projectile to go to? |
| Navigation |
| Message Index |
| Next page |