Forum

> > Stranded II > Scripts > Scripting Questions
Forums overviewStranded II overview Scripts overviewLog in to reply

English Scripting Questions

2,429 replies
Page
To the start Previous 1 213 14 15121 122 Next To the start

old Re: Scripting Questions

Guest

Quote
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%...

old Re: Scripting Questions

Gradir
User Off Offline

Quote
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.


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?

old Re: Scripting Questions

bizzl
User Off Offline

Quote
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.

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

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 s2 cmd unstore

old Re: Scripting Questions

Gradir
User Off Offline

Quote
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?

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...

old Re: Scripting Questions

Guest

Quote
I tried doing mods\strandedII\gfx\Arrow_cure, and it said file cannot be found, while my orringanel just said memory accsess violation. Is my file corrupted? I started out by copying the fire arrow icon and changed it a little...
also, if somthing has a cure effect, how do u make it stop after sometime?

old Re: Scripting Questions

DC
Admin Off Offline

Quote
mods\strandedII\gfx\Arrow_cure is wrong. is it so difficult to have a look at the existing paths?
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.

old Re: Scripting Questions

bizzl
User Off Offline

Quote
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 s2 cmd terrainy to get te Y-Position of the terrain at a certin point, save it in a variable and use it in s2 cmd setpos to move it there

old Re: Scripting Questions

Guest

Quote
Figured it out. Was using mod and i didn't put it in there, only in the Stranded II folder. New question, I want it to cure poison of the object it hits. When it hits and object, it cures me. I want it so when it hits the object, it will relive it from the poison effect, and cure it for 30 secs. Here's the script...

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

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
Your problem is that you haven't changed the object that should be cured, at the moment it still cures the player because you left "unit",1 as it was.

You tell S2 to cure the object that was hit with those s2 cmd impact_class s2 cmd 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.

old Re: Scripting Questions

Guest

Quote
I don't speak german so i don't know excactly how it works. If you can tell me what those mean i could probobly figure it out. Thanks for listining anyway.

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
try using babelfish, for normal conversation it's crap but sometimes you can understand translations from the references.

old Re: Scripting Questions

Guest

Quote
where is the script that makes an animal tamable. I tried to copy the raptor taming script to my new creature but it wont work. I tried to add the id of my creature to the meat script but i fed it like 50 meat and it just ate it all. What's wrong?
Help would be much appreciated.

old Re: Scripting Questions

Guest

Quote
well i copied this script to my creature:

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

old Re: Scripting Questions

Gradir
User Off Offline

Quote
Hey there.
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
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
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;
	}
With this scripts, it tells me that the item with ID '-307' does not exist, and points at this line:
1
$x=getx("item",$id);

??

Edit: It's really strange... with this script:
1
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";
	}
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 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
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
(the behaviour=throw)
edited 7×, last 11.02.08 11:13:36 am

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
jup, that's a know bug that you have to have 2 items to exucte an imapcat script.

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

old Re: Scripting Questions

bizzl
User Off Offline

Quote
Gradir has written
1
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
$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:
1
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";
	}
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

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
To the start Previous 1 213 14 15121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview