Forum

> > Stranded II > Scripts > food poisoning script (rather simple)
Forums overviewStranded II overview Scripts overviewLog in to reply

English food poisoning script (rather simple)

9 replies
To the start Previous 1 Next To the start

old food poisoning script (rather simple)

aimeewilbury
User Off Offline

Quote
I always thought it weird in Stranded II that if you ate raw meat there was no chance of getting sick. So I modified the large meat a bit. It'll give you a 1/4 (I think) chance of getting food poisoning, where you lose 60 health, vomit, and get the fuddle & dizzy states. I tested it and it works fine on my end. Enjoy.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//Eat
	on:eat {
		$event=random(0,3);
		if ($event==1) {
 		process "Vomiting",1000;
		eat -60,0,0,15;
		addstate "unit",1,"fuddle";
		statevalue "unit",1,"fuddle",10;
		addstate "unit",1,"dizzy";
		statevalue "unit",1,"dizzy",10;
		play "vomit.wav";
		vomit 1;
	}else{
		process "eating",1000;
		eat 5,20,10,0;}
	}

old Re: food poisoning script (rather simple)

Hurri04
Super User Off Offline

Quote
I thinks there is an error in this scripts which makes me doubt that it really works fine:

there has to be another line with a closing bracket (}) after the vomit command. also, for syntax purposes (better reading, easier seeing errors) the lines from "process "Vomiting",1000;" to "vomit 1;" have to be tabbed to the right one more time.

further, a little tip: you dont always need to use variables to save values which are returned by commands, you can instead put the command into the place of the variable directly in cases like these, where you need a certain value for just one time.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//Eat
	on:eat {
		if (random(0,3)==1) {
			process "Vomiting",1000;
			eat -60,0,0,15;
			addstate "unit",1,"fuddle";
			statevalue "unit",1,"fuddle",10;
			addstate "unit",1,"dizzy";
			statevalue "unit",1,"dizzy",10;
			play "vomit.wav";
			vomit 1;
		}else{
			process "eating",1000;
			eat 5,20,10,0;
		}
	}
Edit: corrected my script, see below.
edited 2×, last 31.07.11 01:51:47 pm

old Re: food poisoning script (rather simple)

aimeewilbury
User Off Offline

Quote
Actually, look closely and the bracket is before the "else". I dont know how it ended up there when I pasted it but it looks OK in the text editor.

But I did the tab thing and fixed the variable

old Re: food poisoning script (rather simple)

Hurri04
Super User Off Offline

Quote
oh, then I "corrected" it wrong, the bracket has to be at a different place then, but still, I was right when saying that it was missing.

look at your script, there are 3 opening brackets ({) but only 2 closing brackets (}).

I'm gonna correct my script above real quick

old Re: food poisoning script (rather simple)

HudaJan
Super User Off Offline

Quote
I'm sorry Hurry, but his script is correct. He has 3 opening and 3 closing brackets. Look closely. The "else" one is a bit confusing.
To aimee: this is good idea indeed, as I said, your script is correct. I would add only one thing, namely some timer which removes a dizziness after some time, otherwise it could ruin a gameplay a little.
But keep up the good work

old Re: food poisoning script (rather simple)

Hurri04
Super User Off Offline

Quote
argh, damn it.

didnt see the closing bracket at the end

well, I guess that's what you get when trying to do scripting late in the night lol.

More >

old Re: food poisoning script (rather simple)

aimeewilbury
User Off Offline

Quote
user HudaJan has written
To aimee: this is good idea indeed, as I said, your script is correct. I would add only one thing, namely some timer which removes a dizziness after some time, otherwise it could ruin a gameplay a little.


Well I noticed if you go to sleep the states will go away. So it makes sense to me

By the way, I'm a she! My name is a badly misspelled version of "Amy"
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview