1function runWeapon(playerId, position, velocity) 2 3 print(testvar1); 4 5 print(playerId); 6 print(position.x, position.y, position.z); 7 print(velocity.x, velocity.y, velocity.z); 8 9 -- Create an explosion at each tank 10 tanks = s3d.get_tanks(); 11 for k,v in pairs(tanks) do 12 if (v.alive) then 13 print(v.name); 14 print(v.id); 15 print(v.position.x, v.position.y, v.position.z); 16 17 -- Check get_tank gives the same as get_tanks 18 t = s3d.get_tank(v.id); 19 print(t.name); 20 21 s3dweapon.explosion(playerId, v.position, { 22 size = 10, 23 hurtamount = 0, 24 deform = 2, 25 animate = false 26 }); 27 28-- or instead of the above we could fire a weapon at this position 29-- s3d.fire_weapon("Nuke", playerId, v.position, {x=0, y=0, z=0}); 30 end 31 end 32 33 34 -- Create an explosion line from landscape corner to corner 35 landwidth = s3d.get_landscapewidth(); 36 landheight = s3d.get_landscapeheight(); 37 38 print("Landwidth", landwidth, "Landheight", landheight); 39 40 landstart = 0; 41 while (landstart < landwidth and landstart < landheight) do 42 height = s3d.get_height(landstart, landstart); 43 s3dweapon.explosion(playerId, { x=landstart, y=landstart, z=height }, { 44 size = 4, 45 hurtamount = 0, 46 deform = 2, 47 animate = false 48 }); 49 50 landstart = landstart + 15; 51 end 52 53 54 -- Create an explosion ring 100 units wide at the center of the landscape 55 landmidx = landwidth/2; 56 landmidy = landheight/2; 57 58 deg = 0; 59 while (deg < 3.14 * 2) do 60 61 x = landmidx + math.sin(deg) * 100; 62 y = landmidy + math.cos(deg) * 100; 63 64 height = s3d.get_height(x, y); 65 s3dweapon.explosion(playerId, { x=x, y=y, z=height }, { 66 size = 4, 67 hurtamount = 0, 68 deform = 2, 69 animate = false 70 }); 71 72 deg = deg + 3.14 / 20.0; 73 end 74end 75