Forum

> > Stranded II > Scripts > Riding script bugs
Forums overviewStranded II overview Scripts overviewLog in to reply

English Riding script bugs

3 replies
To the start Previous 1 Next To the start

old Riding script bugs

ModJuicer
Super User Off Offline

Quote
I am trying to make a script that makes tanks shoot. Unfortunately, whenever I try to ride one, it goes to the first one created (if there are multiple on the map)
Hopefully someone knows what is wrong

script is here:

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
80
81
82
83
84
85
86
87
88
89
90
script=start
	on:getoff{
		if($notfighter==0){
			if($narg==0){
				skipevent;
				msgbox "What do you want to do with this quad tank?";
				button 0,"Shoot",27,"shoot";
				if($shooting==0){
					$foo=currentid();
					setlocal "unit",$foo,"last",1;
					button 1,"Rapidfire",28,"rapiddd";
					timer "unit",$foo,150,1,"unlast";
				}
				elseif($shooting==1){
					button 1,"Turn off rapidfire",3,"trnof";
				}
				button 2,"get off",3,"close";
			}
		}
	}
	on:unlast{
		$last=0;
	}
	on:trnof{
		$shooting=0;
		closemenu;
	}
	on:rapiddd{
		if($last==1){
			$shooting=1;
			closemenu;
			timer "self",50,1,"rgun";
		}
	}
	on:rgun{
		if($shooting==1){
			if(count_stored("self",79)>0){
				$randomm=random(25,60);
				projectile 79,getx("self"),(gety("self")+20),getz("self"),3,getpitch("self"),getyaw("self"),150,0,$randomm,100,0;
				freestored "self",79,1;
				timer "self",200,1,"rgun";
			}
			else{
				msg "No ammo stored",3;
				$shooting=0;
			}
		}
		else{
			msg "Rapidfire off";
		}
	}
	on:close{
		closemenu;
		$narg=1;
		getoff;
		timer "self",100;
	}
	on:timer{
		$narg=0;
	}
	on:shoot{
		closemenu;
		if(count_stored("self",79)>0){
				projectile 79,getx("self"),(gety("self")+20),getz("self"),3,getpitch("self"),getyaw("self"),150,0,45,100,0;
				freestored "self",79,1;
		}
		else{
			msg "No ammo stored",3;
		}
	}
	on:use{
		if ($notfighter==0){
			msgbox "What do you want to do with this quad tank?";
			button 0,"Ride",77,"ry";
			button 1,"Reload",66,"rload";
		}
		else{
			$ccid=currentid();
			ride $ccid;
		}
	}
	on:ry{
		closemenu;
		$ccid=currentid();
		ride $ccid;
	}
	on:rload{
		exchange "self",1,79;
	}
script=end

note: I added the currentid script for this purpose, but it didn't work. that is why $ccid exists.



this code is intended for this quad tank, along with others:

IMG:https://www.mediafire.com/convkey/eb86/eggka8cpw6xkfq96g.jpg
edited 2×, last 23.06.20 01:06:13 am

old Re: Riding script bugs

ModJuicer
Super User Off Offline

Quote
user Assassin moder : Thanks. Your advice simplified the code. It didn't fix the problem though.

user The Dark Shadow : It's in S2 script

updated script:

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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
script=start
	on:getoff{
		if($notfighter==0){
			if($narg==0){
				skipevent;
				msgbox "What do you want to do with this quad tank?";
				button 0,"Shoot",27,"shoot";
				if($shooting==0){
					$foo=currentid();
					setlocal "unit",$foo,"last",1;
					button 1,"Rapidfire",28,"rapiddd";
					timer "unit",$foo,150,1,"unlast";
				}
				elseif($shooting==1){
					$foo=currentid();
					setlocal "unit",$foo,"lastt",1;
					button 1,"Turn off rapidfire",3,"trnof";
					timer "unit",$foo,150,1,"unlastt";
				}
				button 2,"get off",3,"close";
			}
		}
	}
	on:unlast{
		$last=0;
	}
	on:unlastt{
		$lastt=0;
	}
	on:trnof{
		if($lastt==1){
			$shooting=0;
			closemenu;
		}
	}
	on:rapiddd{
		if($last==1){
			$shooting=1;
			closemenu;
			timer "self",50,1,"rgun";
		}
	}
	on:rgun{
		if($shooting==1){
			if(count_stored("self",79)>0){
				$randomm=random(25,60);
				projectile 79,getx("self"),(gety("self")+20),getz("self"),3,getpitch("self"),getyaw("self"),150,0,$randomm,100,0;
				freestored "self",79,1;
				timer "self",200,1,"rgun";
			}
			else{
				msg "No ammo stored",3;
				$shooting=0;
			}
		}
		else{
			msg "Rapidfire off";
		}
	}
	on:close{
		closemenu;
		$narg=1;
		getoff;
		timer "self",100;
	}
	on:timer{
		$narg=0;
	}
	on:shoot{
		closemenu;
		if(count_stored("self",79)>0){
				projectile 79,getx("self"),(gety("self")+20),getz("self"),3,getpitch("self"),getyaw("self"),150,0,45,100,0;
				freestored "self",79,1;
		}
		else{
			msg "No ammo stored",3;
		}
	}
	on:use{
		if ($notfighter==0){
			msgbox "What do you want to do with this quad tank?";
			button 0,"Ride",77,"ry";
			button 1,"Reload",66,"rload";
		}
		else{
			ride currentid();
		}
	}
	on:ry{
		closemenu;
		ride currentid();
	}
	on:rload{
		exchange "self",1,79;
	}
script=end

This code will also be for a tank car i'm working on, making it an even higher priority:

IMG:https://www.mediafire.com/convkey/200c/f3p695br82rg0pw6g.jpg





aand.. textured

IMG:https://www.mediafire.com/convkey/5754/z3qz5qh9mawaeuc6g.jpg



note:

the original ideas for both of these 3d models is the concept of taking a car or quad and making them remotely controlled and adding turrets.

It would be cool if I could make it possible to ride these as if they were remotely controlled in stranded II (maybe by saving the coordinates and returning the player there when the player gets off and saving the health value and returning it and reviving the player if the player dies on the tank)



EDIT: I fixed the script. It turned out that the command 'ry' was triggered in every instance on the map, so the game would try to make the player ride every single tank, with the last one being the one it mounts.
Updated script here:

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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
script=start
	on:getoff{
		if($notfighter==0){
			if($narg==0){
				skipevent;
				msgbox "What do you want to do with this quad tank?";
				button 0,"Shoot",27,"shoot";
				if($shooting==0){
					setlocal "unit",currentid(),"last",1;
					button 1,"Rapidfire",28,"rapiddd";
					timer "unit",currentid(),150,1,"unlast";
				}
				elseif($shooting==1){
					setlocal "unit",currentid(),"lastt",1;
					button 1,"Turn off rapidfire",3,"trnof";
					timer "unit",currentid(),150,1,"unlastt";
				}
				button 2,"get off",3,"close";
			}
		}
	}
	on:unlast{
		$last=0;
	}
	on:unlastt{
		$lastt=0;
	}
	on:trnof{
		if($lastt==1){
			$shooting=0;
			closemenu;
		}
	}
	on:rapiddd{
		if($last==1){
			setlocal "unit",currentid(),"shooting",1;
			closemenu;
			timer "self",50,1,"rgun";
		}
	}
	on:rgun{
		if($shooting==1){
			if(count_stored("self",79)>0){
				$randomm=random(25,60);
				projectile 79,getx("self"),(gety("self")+20),getz("self"),3,getpitch("self"),getyaw("self"),150,0,$randomm,100,0;
				freestored "self",79,1;
				timer "self",200,1,"rgun";
			}
			else{
				msg "No ammo stored",3;
				$shooting=0;
			}
		}
		else{
			msg "Rapidfire off";
		}
	}
	on:close{
		closemenu;
		$narg=1;
		getoff;
		timer "self",100;
	}
	on:timer{
		$narg=0;
	}
	on:shoot{
		closemenu;
		if(count_stored("self",79)>0){
				projectile 79,getx("self"),(gety("self")+20),getz("self"),3,getpitch("self"),getyaw("self"),150,0,45,100,0;
				freestored "self",79,1;
		}
		else{
			msg "No ammo stored",3;
		}
	}
	on:use{
		if ($notfighter==0){
			msgbox "What do you want to do with this quad tank?";
			button 0,"Ride",77,"ry";
			button 1,"Reload",66,"rload";
			setlocal "unit",currentid(),"scn",1;
			timer "self",50,1,"scn";
		}
		else{
			ride;
		}
	}
	on:scn{
		$scn=0;
	}
	on:ry{
		if($scn==1){
			closemenu;
			ride;
		}
	}
	on:rload{
		if($scn==1){
			exchange "self",1,79;
		}
	}
script=end
edited 4×, last 24.06.20 03:28:42 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview