Forum
Stranded II Scripts Scripting QuestionsThe big letter in 'Arrow_cure.bmp' might be the problem - I would advise to use small letters in file names.
About my problems, 3 things:
1) Where can I find the process of 'reloading a gun' because it doesn't display the process bar after shooting (but you must still wait 'till it reloads) and I forgot where to find it
2) How can I make a script for clearing sharks near player work?
3) Is there a way to make an event that drops objects on the ground?
Gradir has written
Bloodshot, the path isn't case sensitive, it reads the folder 'gfx\' as 'mods\strandedII\gfx' in your Stranded directory.
The big letter in 'Arrow_cure.bmp' might be the problem - I would advise to use small letters in file names.
The big letter in 'Arrow_cure.bmp' might be the problem - I would advise to use small letters in file names.
your sentences contradict each other
Your right, the path is case insensitive, but that means that ou can use a captial letter in a filename while using a lower letter in the definition,
Storm has written
Well, it you typed out the path exactly as you defined it, it could be because the code for a space is %20, not 20%...
the %20 parts should appear in the definition, anyway ;P
Gradir has written
About my problems, 3 things:
1) Where can I find the process of 'reloading a gun' because it doesn't display the process bar after shooting (but you must still wait 'till it reloads) and I forgot where to find it
1) Where can I find the process of 'reloading a gun' because it doesn't display the process bar after shooting (but you must still wait 'till it reloads) and I forgot where to find it
there isn't any, it's actually hardcodet (the "progress bar" is actually the frame of the weapon icon )
Gradir has written
2) How can I make a script for clearing sharks near player work?
dunno, I can't find any errors, since you didn't showed us the problematic script :3
Gradir has written
3) Is there a way to make an event that drops objects on the ground?
use unstore
About the sharks and stuff... I think I messed something up with the script, also I will try raising the distance for the sharks to be cleared...
also, if somthing has a cure effect, how do u make it stop after sometime?
gfx\Arrow_cure.bmp would be right.
And yes: maybe your file IS corrupted. Open it with paint and save it there again to make sure that it is okay.
Gradir has written
I ment something like moving the objects towards the surface, not dropping it from the inventory. I mean, when an object is 'levitating', to move it's global Y direction to reach the surface, or something like that. Is that possible?
Ah, okay
Use terrainy to get te Y-Position of the terrain at a certin point, save it in a variable and use it in setpos to move it there
one more problem is that you mustn't put mods/strandedII at the beginning
on:hit {
freetimers "unit",1,"cease_healthpotion";
timer"unit",1,30000,1,"cease_healthpotion";
freestate "unit",1,"intoxication";
freestate "unit",1,"dizzy";
freestate "unit",1,"fuddle";
My best guess to fix this is to store the object it its into a variable, then cure the variable of these states, but 1( no idea how to do this and 2( if that happens if you shoot it twice at two different objects, the first one would be cured forever. S O S
You tell S2 to cure the object that was hit with those impact_class impact_id
pluss you need to use the impact event.
The thing with the timer is dificult to solve, better revive the energy at once in this case.
Help would be much appreciated.
script=start
on:use {
//Ride when tame!
if (gotstate("self","tame")) {
ride;
freetimers "self";
if ($tameness<15){
timer "self",random(5000,10000),1,"shakeoff";
}elseif ($tameness<20){
timer "self",random(20000,30000),1,"shakeoff";
}
}
}
on:shakeoff {
if (riding()==current_id()){
getoff;
damage "unit", 1,random(5,10);
msg "Ouch ...",3;
msg "He dropped me!",3;
}
}
on:ai_attack {
if (random(8)==1){
if (gotstate("unit",1,17)==0){
if (random(5)<2){
addstate "unit",1,1;
}else{
addstate "unit",1,7;
}
}
}
}
on:kill {
event "iskill_hunt","global";
}
script=end
Uranium235 has written
what is state 18???
It's tameness
I want to make a coconut spawn two coconut parts, when it is destroyed by throwing it on the object with material 'stone'. Also, I want to make them spawn not exactly at the same place, but near.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
on:impact 	{ 	$id=current_id(); 	$tmp=impact_class(); 	$tmp2=impact_id(); 	if (compare_material($tmp,$tmp2,"stone")==1) 		{ 		event "kill","item",$id; 		} 	else 		{ 		echo "coconut hit, but nothing happens"; 		} 	freevar $tmp; 	freevar $tmp2; 	freevar $id; 	}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
on:kill 	{ 	$id=(create "item",290,getx("self"),getz("self")); 	$id1=(create "item",290,getx("self"),getz("self")); 	$x=getx("item",$id); 	$x1=getx("item",$id1); 	setpos "item",$id,$x,"self","self"; 	setrot "item",$id,0,40,0; 	setpos "item",$id1,$x1,"self","self"; 	setrot "item",$id1,0,-40,0; 	freevar $id,$id1; 	}
1
$x=getx("item",$id);
??
Edit: It's really strange... with this script:
1
2
3
4
5
6
2
3
4
5
6
on:kill 	{ 	create "item",290,(getx("self")+2),getz("self"); 	create "item",290,(getx("self")-2),getz("self"); 	free "item","self"; 	}
Moreover, it doesn't free the coconut item, so I end up with destroying coconuts without destroying them PLUS, it creates those coconut-parts ONLY when I have more than 1 coconut in backpack. And this is really strange for me.
This isn't enough, it seems that sometimes when you throw an item on an object, it doesn't react at all. No 'impact', 'hit' or something like that in console, nothing happens, but it plays the sound, and releases the 'sprites'.
nevermind.
It seems I must forget the idea of killing items by throwing them I mean, there is an 'behaviour=killthrow' , but what when I want an item to just get damage on impact? I've spent some time on trying to script that, but I think it's messed
Another edit:
I think I just have to know how to get the POSITION of an item from the moment of impact. Is it possible to get it? Like getting the coordinates of the sprites that are created on impact.
Yet another edit!:
Yay, I've found it! impact_x etc! But there still is a problem with that you must hold at least 2 coconuts for the creation to begin. I still don't understand it. Help!
It's really complicated... I think it's a big bug... its about ammunition - I think that he uses wrong item's ID in my case - when I want him to 'kill' a coconut, which was thrown and hit the rock, he 'kills' a second coconut, which was in my ammunition, creating two coconut-parts somewhere near (I don't know why exactly there, might be the middle of the map, but I'm not sure) And thats why he needs 2 coconuts to even start tracing the collision event. I don't get it...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
on:kill 	{ 	create "item",290,(getx("self")+2),getz("self"); 	create "item",290,(getx("self")-2),getz("self"); 	} on:impact 	{ 	$class=impact_class(); 	$id=impact_id(); 	if (compare_material($class,$id,"stone")==1) 		{ 		timer "self",2000,1,"kill1"; 		} 	else {echo "not stone";} 	freevar $class; 	freevar $tmp; 	freevar $id; 	} on:kill1 	{ 	damage "self",40; 	} script=end
edited 7×, last 11.02.08 11:13:36 am
I'm not sure if you by now have figured out the first problem you posted, but the failure probably occures because you have so many commands put together in one line.
The script-parser has problems with that (sometimes)
And how about using the behaviour selfthrow? The items get's removed as soon as it hits something. You just have to set damage to 0
Gradir has written
1
2
2
$id=(create "item",290,getx("self"),getz("self")); $id1=(create "item",290,getx("self"),getz("self"));
I too think this would be the problematic lines, both because you used multiple functions in one statement (like Lizard said), plus this weird Lisp style you use here
Teh following should do the job.
1
2
3
4
2
3
4
$selfx=getx("self"); $selfz=getz("self"); $id=create("item",290,$selfx,$selfz); $id2=create("item",290,$selfx,$selfz);
Gradir has written
Edit: It's really strange... with this script:
it creates two items at the player (because it's the last saved position for the coconut)
Moreover, it doesn't free the coconut item, so I end up with destroying coconuts without destroying them
1
2
3
4
5
6
2
3
4
5
6
on:kill 	{ 	create "item",290,(getx("self")+2),getz("self"); 	create "item",290,(getx("self")-2),getz("self"); 	free "item","self"; 	}
Moreover, it doesn't free the coconut item, so I end up with destroying coconuts without destroying them
That doesn't really surprise me. "self" is a synonym for "class",id, not just for the id, so you actually tried to use free "class","class",id, which simply doesn't work.
Use free currentclass(),currentid(); or simply free "self"; instead