Forum

> > Stranded II > Scripts > Scripting Questions
ForenübersichtStranded II-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Scripting Questions

2.429 Antworten
Seite
Zum Anfang Vorherige 1 230 31 32121 122 Nächste Zum Anfang

alt Re: Scripting Questions

Gregg
User Off Offline

Zitieren
^ Ah, ok.

New question.
I am finishing my Swiss Army Knife and I want it to be able to have different uses that are changed by either:

Right clicking to select Saw or Knife etc.
OR
By using it and it changes to item 666 and become a Swiss Army Saw then using it again to become Swiss Army Scissors.

So I want it to be like this in gameplay:
Collect SAK.
Wield SAK Message "I need to have a tool out!"
Use SAK. Process, "Withdrawing Saw"
Attack with Saw = high chance of getting a bracnh
Use SAK. Process "Withdrawing Knife"
Attack with Knife = high chance of getting leaves.
....
Eventaually you use it for the Xth time and you get back to step one- a closed SAK.

Either way I am stuck, and I really need help.
Thanks,
Gregg.

alt Re: Scripting Questions

Lexicon
User Off Offline

Zitieren
Once again, thank you both very much. Thank you MrCowThing especially for giving me all the text codes. They will come in handy!

I actually got the Areal triggers working before looking back to the replies here. But now I have another fun question, lol.

Is there a way to trigger marks on the map to happen sequentially?

i.e: As you go to the first X on the map, it then triggers a second X on the map to show up. Then you go to the second X and it triggers the third X, and so on.

I've got a map with all the X's on it where I want them, but I would prefer not to "give away" the location of each destination until a certain event (ie: finding the first crate) has been triggered. If that makes sense....

You guys rock!


Edit: I've figured out how to use a sign to trigger a diary entry now too - but how do I stop that script? I know "stoptrigger self" worked for the triggered script, but what is the command to stop an object-triggered script?

Sorry if I'm being annoying with too many questions. I really do appreciate the help!
1× editiert, zuletzt 12.06.08 01:32:50

alt Re: Scripting Questions

MrCowThing
User Off Offline

Zitieren
I'm pretty sure it should only execute once, or do you mean if you click the sign again it will put another note in your diary?
I'm not exactly sure how to stop it from writing twice. You could have a small trigger near the sign and do it the same way you have the other triggers.

alt Re: Scripting Questions

GreyMario
User Off Offline

Zitieren
Try checking against a variable, which at map start you set to 0, and when the event has run once add 1 to it. If the variable equals a specific number or is not 0, you can cease attempting to execute the event.

I'm too lazy to figure out the exact code for it, but that's the general idea.

alt Re: Scripting Questions

Gast

Zitieren
Hi guys,
I need a bit of help. I am new to the idea of scripting and don't quite understand what is going on. I am trying to put a cooking skill into the game, but I am having trouble with setting up a certain script. I am trying to set it up so you can only cook cookies with a certain cooking skill with little luck
This is the script I have below:

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
script=start
	//Bake!
	on:use {
		if (skillvalue("cooking")>=450){
		if ((count_inrange("state",5,50)+count_inrange("state",4,50))>0){
			fry;
			process "baking",1000;
			alteritem 1,66,10;
				event "iskill_cooking","global";
		}else{
			msg "I need fire to bake this!",3;
			speech "negative";
		}
	}
	}else{
	speech "negative";
	msg "I cannot do this yet!",3;
	msg "My cooking skill needs to be higher!",3;
	}
	//Eat
	on:eat {
		process "eating",1000;
		eat 7,50,5,0;	
	}
script=end

However it doesn't seem to work. In debug mode it says:

1
2
3
4
5
6
7
SCRIPT ERROR:
"else" or "elseif" without matching "if"
Script: Item 4454 (Chocolate Dough type 115 )
Event: use
Row: 14
Col: 6
Script: }else{

Would someone be able to correct what I have done wrong and post the correct script for me. I would be grateful for all your help.

alt Re: Scripting Questions

MrCowThing
User Off Offline

Zitieren
I think you have too many "}"s you ended the on:use before the last else.

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
script=start
	//Bake!
	on:use {
		if (skillvalue("cooking")>=450){
			if ((count_inrange("state",5,50)+count_inrange("state",4,50))>0){
				fry;
				process "baking",1000;
				alteritem 1,66,10;
				event "iskill_cooking","global";
			}else{
				msg "I need fire to bake this!",3;
				speech "negative";
			}
		}else{
			speech "negative";
			msg "I cannot do this yet!",3;
			msg "My cooking skill needs to be higher!",3;
		}
	}
	//Eat
	on:eat {
		process "eating",1000;
		eat 7,50,5,0;     
	}
script=end
1× editiert, zuletzt 12.06.08 15:06:53

alt Re: Scripting Questions

Gast

Zitieren
I understand what you mean by too many brackets and ending it too soon. You have helped me a lot. It now works.
Thank you very much.

alt Re: Scripting Questions

Raven Shadow
User Off Offline

Zitieren
Babelfish is real slaughtering the translation for
the spawn=Item-Typ [,Wachsdauer in Tagen][,X-Radius][,Y-Radius][,Y-Offset][,Objekte][,Anzahl je Objekt] parameter.
could someone please explain the parameters it takes?

alt Re: Scripting Questions

GreyMario
User Off Offline

Zitieren
Where in the hell are you finding that?

Anyway, try running it through Google Translator instead of Babblefish.

alt Re: Scripting Questions

MrCowThing
User Off Offline

Zitieren
For Gregg, It works
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
on:attack2{
		$sakcur+=1;
		if($sakcur>=3){
			$sakcur=0;
		}
	}
	on:attack1{
		if($sakcur==0){
			msg "I'm closed!";
		}
		elseif($sakcur==1){
			msg "I'm a Knife!";
		}
		elseif($sakcur==2){
			msg "I'm a saw!";
		}
	}
1× editiert, zuletzt 13.06.08 07:05:54

alt Re: Scripting Questions

ohaz
User Off Offline

Zitieren
Zitat
Babelfish is real slaughtering the translation for
the spawn=Item-Typ [,Wachsdauer in Tagen][,X-Radius][,Y-Radius][,Y-Offset][,Objekte][,Anzahl je Objekt] parameter.
could someone please explain the parameters it takes?

spawn=item-type [, time to grow in days][,X-radius][,y-radius][,y-offset][,objects][,number per object]

alt Re: Scripting Questions

Gregg
User Off Offline

Zitieren
Thank you MrCowThing, you truely are a geniuos XD. I'm gunna give it a quick test before I get ready for school (it's 7.55am, and I need to be ready by 8.15 :P) It'll be a quick test.

alt Re: Scripting Questions

Raven Shadow
User Off Offline

Zitieren
TheKilledDeath hat geschrieben
spawn=item-type [, time to grow in days][,X-radius][,y-radius][,y-offset][,objects][,number per object]


Thank you.
could someone explain a little further?
Looking at the CaCao Palm:

X-radius(15) referes to how far out from the object
center the fruit will always grow or does it mean the fruit ca grow 0 to 15 units from the center?

Y-radius(30) some question as above.
Also, the Y-axis is altitude (from bottom to top) does
this actually refere to the Z-axis(depth, front to back
or near to far)?

Y-offset(75) is this the minimum height off the ground the friut will grow at?

Objects(3) what does this refere to?

Number Per Object(1) what does this refere to?

Thank you for your help.
1× editiert, zuletzt 14.06.08 12:18:48

alt Re: Scripting Questions

ESKARN
User Off Offline

Zitieren
is there anyway to not bring up a diary entry when you load up a map if you already have the diary entry

alt Re: Scripting Questions

Gregg
User Off Offline

Zitieren
Thanks to MrCowThing I now have my Swiss Army Knife. Now all I need is a code that makes hitting an item produce one type of item more often that others. (E.G. On attack 1 the msg comes up "I'm a knife!" and when I hit bushes I should get leaves more often than other things.) I hope you can help :P, as I can't find any examples in the othe files so far.

-Gregg.

P.S. Would just like to add that everyone whom helped me recieves a big thank you your all really helpful.

alt Re: Scripting Questions

dragoana
User Off Offline

Zitieren
maybe you could use something like this:
1
2
3
4
5
6
7
on:hit {
if(playergotitem(SwissarmyKnife) {
if(random(1,3)==1) {
find *itemIdLeaf, random(1,2);
}
}
}
then there's the chance to find extra leaves^^
Zum Anfang Vorherige 1 230 31 32121 122 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtStranded II-ÜbersichtForenübersicht