1. Upon throwing it will fly out.
2. If it hits an object it will deal damage and return. By return I mean an honest return, not just some "add to inventory" bullshit, but a true flight path.
3. If it does not hit anything than after five seconds it will fly back to the player.
4. If the player moves away from his spot while the boomerang is returning it will embed itself in the ground (to be picked up later.
5. If the player is hit by the returning boomerang, it will be returned to his hand automatically.
So far I've completed 1, 2, 4, and 5. I'm having slight trouble with 3 do to the fact that apparently projectiles are not counted as... anything?
Which means you cannot have a timer or variable on a projectile, nor can you have events on a projectile, nor can you get the coordinates of a projectile, nor can you delete a projectile. This is a problem, because the only way you could possibly make a boomerang is:
1. Upon "attack" (throwing), an event is started.
2. Every second a variable on the projectile is decremented by 1.
3. When the variable (which starts at 5) reaches 0, a second event is started.
4. This second event gets the coordinates of the projectiles, creates a new projectile at those coordinates (pointed towards the player), and then deletes the first projectile.
The problem here is obvious. *hopes DC reads this thread*
Why are projectiles not counted as the item itself? IE: If I throw a spear, why is that "projectile spear" not counted as a spear? It makes it impossible to do actions on a projectile, such as the requirements I listed above (variables, events, timers, deletion, and commands).
Oh well. For anyone interested in the boomerang code as it is, put this in items_tools.inf:
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
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
### Boomerang id=4878 name=Boomerang group=weapon icon=gfx\slingshot.bmp model=gfx\slingshot.b3d scale=0.5 mat=wood weight=200 info=a boomerang that can be thrown and will return to me behaviour=spear damage=2 speed=13 drag=0 rate=1500 var=return,Return,4,1 healthchange=0 script=start 	on:impact { 		$tmp=impact_class(); 		$tmp2=impact_id(); 		//+20 Bonus Damage on Flesh 		if (compare_material($tmp,$tmp2,"flesh")==1){ 			damage $tmp,$tmp2,20; 		} 		freevar $tmp; 		freevar $tmp2; 		projectile 4877,impact_x(),impact_y(),impact_z(),4, 20, 0, 13, 0, 0; 	} script=end ### Boomerang (Return) id=4877 name=Boomerang (Return) group=weapon icon=gfx\slingshot.bmp model=gfx\slingshot.b3d scale=0.5 mat=wood weight=200 info=a returning boomerang script=start 	on:impact { 	$tmp=impact_class(); 	$tmp2=impact_id(); 	$tmp3=type($tmp,$tmp2); 	if ($tmp3 == 1){ 		find 4878; 		msg "You've caught the boomerang!",4; 		equip 4878; 	}else{ 		create "item",4878,impact_x(),impact_z(); 	} 	freevar $tmp; 	freevar $tmp2; 	freevar $tmp3; } script=end
Obviously you can change around the IDs, just keep them the same (ie; change all 4878s to the same thing). Btw, you might want to change drag to something else. I was using 0 so I could test.
-Builder
edited 1×, last 20.07.08 11:40:07 am