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 267 68 69121 122 Next To the start

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
mabey you could use setat and make it look real, by using a timer. on a timer thats mabey 100 miliseconds, the object moves +1 from it's current position, and it adds one to a variable. when the variable reaches a certain number, it will stop. i don't think this will work but it should look somthing like
1
2
3
4
5
6
7
8
9
10
11
12
on:start{timer "self",100;
$x=getx "self";
$y=gety "self";
$z=getz "self";
}
on:timer{
setat $x,$y,$z;
$x++;
$a++;
}if ($a==10){
freetimers "self";
}

old Re: Scripting Questions

Vibhor
User Off Offline

Quote
I want help at this 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
### Meat
id=9
name=Meat
group=food
icon=gfx\meat.bmp
model=gfx\meat.b3d
scale=0.15
mat=flesh
weight=500
info=a juicy piece of raw meat. I can fry it, eat it as it is or take it in my hand and throw it at wild animals...
behaviour=throw
damage=0
speed=15
drag=1.8
rate=3000
script=start
	//Fry!
	on:use {
		if ((count_inrange("state",5,50)+count_inrange("state",4,50))>0){
			process "frying",500;
			fry;
			alteritem 1,10;
		}else{
			msg "I need fire to fry this!",3;
			speech "negative";
		}
	}
	//Eat
	on:eat {
		process "eating",1000;
		eat 5,20,10,0;
		
		store $id,"unit",1;
	}
	//Taming
	on:drop {
		ai_behavioursignal "eat","raptor",300;
	}
	on:ai_eat {
		local $eater,$var;
		$eater=ai_eater();
		if (type("unit",$eater)==2){
			$var=getlocal("unit",$eater,"tameness");
			$var+=2;
			setlocal "unit",$eater,"tameness",$var;
			if (($var>9)&& (gotstate("unit",$eater,"tame")==0)){
				addstate "unit",$eater,"tame";
				corona getx("unit",$eater),getz("unit",$eater),20,255,70,100;
				msg "I tamed it!",4;
			}
		}
	}
//Taming
	on:drop {
		ai_behavioursignal "eat","loin",300;
	}
	on:ai_eat {
		local $eater,$var;
		$eater=ai_eater();
		if (type("unit",$eater)==9){
			$var=getlocal("unit",$eater,"tameness");
			$var+=2;
			setlocal "unit",$eater,"tameness",$var;
			if (($var>9)&& (gotstate("unit",$eater,"tame")==0)){
				addstate "unit",$eater,"tame";
				corona getx("unit",$eater),getz("unit",$eater),20,255,70,100;
				msg "I tamed it!",4;
			}
		}
	}
script=end


i want this script to be made that the unit stays there for 30 seconds but doesnt get tamed even if it is given 1000 of it

and i also want to know how to edit the unit that will be in effect of it


I also want to know how do i make my own state like a state which increases your thirst constantly

old Re: Scripting Questions

The Second
User Off Offline

Quote
@Vibhor: I do my own states like this: (go in the infos.inf)
1
2
3
4
5
6
7
8
9
10
id=90
name=your info's name
group=stuff
frame=38 ##(I don't know what there should be...)
script=start
##your script here##
script=end
description=start
##info about this info here##(not needed)
description=end
I think this will work.
edited 5×, last 07.07.09 07:58:54 am

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
I just remember reading somewhere where you cannot make your own states, although I may be wrong (as always)

old Re: Scripting Questions

The Second
User Off Offline

Quote
Ok. Here it is:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
id=52
name=Thirst
group=stuff
frame=82
script=start
       on:load {
                event "increase_thirst",global;
       }
       on:increase_thirst {
                timer "self",1000,0;
       }
       on:timer {
                consume 0,0,-1,0;
       }
script=end
Too, if you want to get more hunger, just change it to this (or make other info)
1
consume 0,-1,0,0;
Change timer/consume values if you want to change speed.
More information about this script: s2 cmd consume
edited 2×, last 07.07.09 08:43:51 pm

old Re: Scripting Questions

Vibhor
User Off Offline

Quote
thx but i also need that taming script


I also need a script that that u cant sleep anywhere except
for beds and when slept the player gets a state

@The second
I have renamed the stats thirst as hygiene so i need help again i want it to stay infinitely and it will be removed when an action is used

old Re: Scripting Questions

The Second
User Off Offline

Quote
I have again guestion: What should i write after s2 cmd behaviour? In editor I see there is that:
1
behaviour "klass", Typ-ID;
What should I put on klass and Typ-ID?

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
Vibhor- add this line to the game.inf under on:sleep{
1
if (count_inrange( "object", The ID of the bed){
and at the end before //Plague?
1
}else{msg "I need a bed to sleep on!",3;}

old Re: Scripting Questions

Tau
User Off Offline

Quote
@ The Second: "Behaviour" returns the behaviour of a unit/an object. It's similar to s2 cmd type, which returns the type id of "class",id. But "behaviour" returns the behaviour, e.g. "buildingsite", "tree" or "watersource" etc..

old Re: Scripting Questions

The Second
User Off Offline

Quote
Ok... I thinked I can change with it an unit/object's behaviour, but no
I'm still wanting to get that script which moves object from info to other because I want to make a flying U.F.O in S2Ext. (because it's object)
Bloodshot's script worked, but how to set where it goes?

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
2nd, use s2 cmd def_override to change the definition, and rewrite the definition but change the behavior. for example,
1
2
3
on:timer{
	def_overide "self","sys\scripts\ufooverride.txt";
}
and ufooverride would have the UFO's regular definition besides the changed behavior

old Re: Scripting Questions

aimeewilbury
User Off Offline

Quote
Question: Has anybody tried making a new "behavior=bird" unit using the airplane model and put it on a custom map?

I did it and it just flew in small circles, lol.
edited 1×, last 10.07.09 04:57:17 am

old Re: Scripting Questions

Vectarrio
User Off Offline

Quote
I made a unit, who shoots at anemy, like defence tower.
How I can set his pitch and yaw to projectile's pitch and yaw?

old Re: Scripting Questions

Silent_Control
User Off Offline

Quote
Vibhor has written
Will my question never be answered?


You need the script for the hygiene to remain infinite or for "players cannot sleep except for beds"?
To the start Previous 1 267 68 69121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview