Forum

> > Carnage Contest > [Resolved]need help to finish my weapon.
Forums overviewCarnage Contest overviewLog in to reply

English [Resolved]need help to finish my weapon.

14 replies
To the start Previous 1 Next To the start

old [Resolved]need help to finish my weapon.

thecode
User Off Offline

Quote
Hello!

My problem is that I can not turn to do the shots of my gun.
Here is what happens to the impact of water:

if (projectiles[id].y)>=getwatery()-46 then
          -- Move left/right, according to wind direction
          projectiles[id].x=projectiles[id].x+getwind()*25
projectiles[id].y=projectiles[id].y+getwind()*25
     end
if (projectiles[id].x)>=getwatery()-46 then
          -- Move left/right, according to wind direction
          projectiles[id].x=projectiles[id].x+getwind()*25
projectiles[id].y=projectiles[id].y+getwind()*25
     end



Someone could help me?

PS: I copy this piece of script in the script of another weapon.
And could someone explain to me what was the "-46" for?
edited 1×, last 17.09.10 08:48:46 pm

old Re: [Resolved]need help to finish my weapon.

DannyDeth
User Off Offline

Quote
This has to do with hitting water? I dont think so. I think it is for the projectile being able to be blown from side to side by the wind ( you know how u do in worms by using the wind to pwn an opponent with a basooka? ) the getwaterx/y thing is becasue ( maybe ) of an error DC made in the code that adds 46 to the real height of the water ( idk either to be honest, but its uite late here so dont feel like opening up folders now ) to detect whether or not the "projectile" is above the water, and if it is, then it can be blown by the wind, i suggest you take a look at carnage contest website maybe it has something that can help u.

~DannyDeth

old Re: [Resolved]need help to finish my weapon.

DC
Admin Off Offline

Quote
the 46 is just an offset for adjustment. this is necessary for images of different sizes or with different handles.

you can change this value to change the perceived water surface height in order to make your weapon look right with the used image.

old Re: [Resolved]need help to finish my weapon.

thecode
User Off Offline

Quote
As I made is that the projectile follow the wind direction when the water hit.
So it bounces ^ ^

i suggest you take a look at carnage contest website maybe it has something that can help u.

Okey
thank

the 46 is just an offset for adjustment. this is necessary for images of different sizes or with different handles.

you can change this value to change the perceived water surface height in order to make your weapon look right with the used image.

ok,thank



EDIT:

I do not find what I wanted but I find something that pleases me well: p
To return to the subject, is it really possible to turn the shots?
I come easily to do rebondire a player but not a projectile.
I use [b]playerpush[b]

There 's a command to do the same but with projectiles?
edited 1×, last 17.09.10 08:13:39 am

old Re: [Resolved]need help to finish my weapon.

Vectarrio
User Off Offline

Quote
There is update/move event, you can find there projectiles[id].sx, projectiles[id].sy, if you want to bounce out of the water, just write when it hits the water:
1
projectiles[id].sy=-projectiles[id].sy
and if you want to lose speed, write that:
1
projectiles[id].sy=-projectiles[id].sy*0.8
and change 0.8 to lower if you want to loose the speed more.

old Re: [Resolved]need help to finish my weapon.

thecode
User Off Offline

Quote
So you want to creat a weapon that is like flying sheep in worms or something? Coz then it gets a little more fancy



No! a projectil that bounce on water contact
It's like the gun "banana" in Worms Open Warfare 2.
It is a weapon that bounces when it hits something or someone.
This makes it more maniabilité.En, ilajoute a strategic side to the game

Write here update and move function pls (in spoiler and/or code)


I try and I edit

old Re: [Resolved]need help to finish my weapon.

thecode
User Off Offline

Quote
Ha x) sorry

MOVE FUNCTION:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
function thecode.bublegun.ray.move(id,fx)

	rot=math.deg(math.atan2(projectiles[id].sx,-projectiles[id].sy))
	-- Particle Tail
	if (fx==1) then
		particle(p_smoke,projectiles[id].x-math.sin(math.rad(rot))*7,projectiles[id].y+math.cos(math.rad(rot))*7)
		particlespeed(math.random(-2,2)*0.1,math.random(-2,2)*0.1)
		particlefadealpha(0.01)
		particlecolor(1+math.random(0,255),1+math.random(0,255),1+math.random(0,255))
		particle(p_lightpuff,projectiles[id].x-math.sin(math.rad(rot))*6,projectiles[id].y+math.cos(math.rad(rot))*6)
		particlefadealpha(0.04)
		particlecolor(1+math.random(0,255),1+math.random(0,255),1+math.random(0,255))
		
	end
	
	-- Wind + Gravity influence on speed
	projectiles[id].sx=projectiles[id].sx+getwind()
	projectiles[id].sy=projectiles[id].sy+getgravity()
	-- Move (in substep loop for optimal collision precision)
	msubt=math.ceil(math.max(math.abs(projectiles[id].sx),math.abs(projectiles[id].sy))/3)
	msubx=projectiles[id].sx/msubt
	msuby=projectiles[id].sy/msubt
	for i=1,msubt,1 do
		projectiles[id].x=projectiles[id].x+msubx
		projectiles[id].y=projectiles[id].y+msuby
		-- Collision
		if collision(col3x3,projectiles[id].x+math.sin(math.rad(rot))*20,projectiles[id].y-math.cos(math.rad(rot))*20,1,1)==1 then
		angledelta(15,158)
			if terraincollision()==1 or playercollision()~=projectiles[id].ignore then
			
				if playercollision()~=0 then
		
				-- Cause damage
				playerdamage(playercollision(),0+math.random(0,10))
					end
					--Effect
					playsound(cc.gammagun.sfx_impact)
				particle(p_smoke,projectiles[id].x+math.sin(math.rad(rot))*5,projectiles[id].y-math.cos(math.rad(rot))*5)
				particlefadealpha(0.006)
				particle(p_muzzle,projectiles[id].x+math.sin(math.rad(rot))*5,projectiles[id].y-math.cos(math.rad(rot))*5)
				particlesize(1.5,1.5)
				particlecolor(1+math.random(0,255),1+math.random(0,255),1+math.random(0,255))
				particlefadealpha(0.01)
				for j=1,20,1 do
					particle(p_lightpuff,projectiles[id].x+math.sin(math.rad(rot))*5,projectiles[id].y-math.cos(math.rad(rot))*5)
					particlespeed(math.random(-20,20)*0.1,math.random(-20,20)*0.1)
					particlefadealpha(0.04)
					particlesize(math.random(40,70)*0.1,math.random(40,70)*0.1)
					particlecolor(1+math.random(0,255),1+math.random(0,255),1+math.random(0,255))
				end
				-- Crater
				grey=math.random(0,40)
				if math.random(0,1)==1 then
					terrainalphaimage(gfx_crater100,projectiles[id].x,projectiles[id].y,math.random(6,9)*0.1,grey,grey,grey)
				else
					terrainalphaimage(gfx_crater125,projectiles[id].x,projectiles[id].y,math.random(6,9)*0.1,grey,grey,grey)
				end
				-- Free projectile
				freeprojectile(id)
				return 1
			end
		else
			projectiles[id].ignore=0
		end
		-- Water
		if (projectiles[id].y)>getwatery()+5 then
		projectiles[id].sy=-projectiles[id].sy
		
			-- Effects
			particle(p_waterhit,projectiles[id].x,projectiles[id].y)
			playsound(sfx_hitwater1)
			-- Free projectile
			freeprojectile(id)
			return 1
		end
	end
	-- Scroll to projectile
	scroll(projectiles[id].x,projectiles[id].y)
end




UPDATE FUNCTION:

1
2
3
4
5
6
function thecode.bublegun.ray.update(id)						-- Update
	-- Move
	thecode.bublegun.ray.move(id,1)
	
	
end

old Re: [Resolved]need help to finish my weapon.

Vectarrio
User Off Offline

Quote
@lecode:
So, you dont need to remove/free projectile! Just delete that
1
2
3
4
5
6
-- Effects
               particle(p_waterhit,projectiles[id].x,projectiles[id].y)
               playsound(sfx_hitwater1)
               -- Free projectile
               freeprojectile(id)
               return 1
which is after my line
1
projectiles[id].sy=-projectiles[id].sy
AND
if it is stuck then change that line to:
1
projectiles[id].sy=-math.abs(projectiles[id].sy)
To the start Previous 1 Next To the start
Log in to replyCarnage Contest overviewForums overview