Scripting Questions
2,429 replies try this:
Code:
1
2
3
4
5
6
2
3
4
5
6
on:hit {
$health=health("self");
if($health<=25) {
ai_mode currentid(), "flee", "unit", 1;
}
}
$health=health("self");
if($health<=25) {
ai_mode currentid(), "flee", "unit", 1;
}
}
thanks but i want it that it would randomly flee when health low and hitting it. is it possible?
owner of "Eagle mod" and "Survival Stories mod" and Halo Mod for stranded 2. Also make games, http://www.unrealsoftware.de/forum_posts.php?post=249591#jn
Hurri04 has written:
try this:
Code:
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
on:hit {
$health=health("self");
if($health<=25) {
[b]$tmp=random(1,4);
if($tmp > 2) {[/b]
ai_mode currentid(), "flee", "unit", 1;
[b]}[/b]
}
}
$health=health("self");
if($health<=25) {
[b]$tmp=random(1,4);
if($tmp > 2) {[/b]
ai_mode currentid(), "flee", "unit", 1;
[b]}[/b]
}
}
This would give you a 50/50 chance of fleeing.
if($tmp > 3) would give a 25% chance of fleeing
if($tmp > 1) would give a 75% chance of fleeing
alter the $tmp=random(<min>,<max>) values to fine tune if necessary.
If you wanted to make it more realistic, you could use the $health value as an decreasing indicator, like this:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
on:hit {
$health=health("self");
$tmp=random(1,4);
if($health<=15) {
if($tmp > 1) {
ai_mode currentid(), "flee", "unit", 1;
}
}
elseif($health<=20) {
if($tmp > 2) {
ai_mode currentid(), "flee", "unit", 1;
}
}
elseif($health<=25) {
if($tmp > 3) {
ai_mode currentid(), "flee", "unit", 1;
}
}
}
$health=health("self");
$tmp=random(1,4);
if($health<=15) {
if($tmp > 1) {
ai_mode currentid(), "flee", "unit", 1;
}
}
elseif($health<=20) {
if($tmp > 2) {
ai_mode currentid(), "flee", "unit", 1;
}
}
elseif($health<=25) {
if($tmp > 3) {
ai_mode currentid(), "flee", "unit", 1;
}
}
}
This way, as it becomes more damaged, it becomes more inclined to flee...
(Thanks for the cover bloodshot)
edited 1×, last 01.10.10 12:34:09 pm
elseif($health<=15) { should be if($health<=15) {
It is better to fail and then succeed than to succeed in the first place

Bloodshot has written:
]elseif($health<=15) { should be if($health<=15) {
Yeah, the first 'elseif' should just be 'if', I was copy-pasting-creating. But apart from that, that script should be copy and pastable.
Edited the post.
edited 1×, last 01.10.10 12:34:31 pm
thanks! now my boar runs from me!

owner of "Eagle mod" and "Survival Stories mod" and Halo Mod for stranded 2. Also make games, http://www.unrealsoftware.de/forum_posts.php?post=249591#jn
Hey can anyone tell me how to make a grenade script. Here's the code. I want to make it so that when you throw it, he timer starts. Then after the timer ends itll explode. Please copy it and fix it.
Code:
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
### Grenade
id=127
name=Grenade
group=weapon
icon=gfx\grenade.bmp
model=gfx\clod.b3d
color=0,1000,0
behavior=killthrow
mat=metal
weight=50
info=an explosive grenade
healthchange=0
damage=120
script=start
on:attack1 { 5 second timer script goes here
on:timerend { explosion script goes here
script=end
id=127
name=Grenade
group=weapon
icon=gfx\grenade.bmp
model=gfx\clod.b3d
color=0,1000,0
behavior=killthrow
mat=metal
weight=50
info=an explosive grenade
healthchange=0
damage=120
script=start
on:attack1 { 5 second timer script goes here
on:timerend { explosion script goes here
script=end
edited 2×, last 03.10.10 07:23:12 pm
Original creator of Stranded 2 wiki, which I'm more proud of than graduating high school
i beleive massive mod has a grenade script.
anyway i was wondering if there is anyway i can do this..
on:start {
tired, bit thirsty and very peckish.
}
something like that would be great please
anyway i was wondering if there is anyway i can do this..
on:start {
tired, bit thirsty and very peckish.
}
something like that would be great please
owner of "Eagle mod" and "Survival Stories mod" and Halo Mod for stranded 2. Also make games, http://www.unrealsoftware.de/forum_posts.php?post=249591#jn
on:start {
consume 0, 70, 30, 75;
}
This script would not change health, would decrease hunger by 70 (to 30), decrease thirst by 30 (to 70) and decrease tiredness by 75 (to 25)...
Yep... Just one command.
consume 0, 70, 30, 75;
}
This script would not change health, would decrease hunger by 70 (to 30), decrease thirst by 30 (to 70) and decrease tiredness by 75 (to 25)...
Yep... Just one command.
thanks! and how can i make it units attack other units that have the predator behavior, but not me? like the soldior object thing in v666 mod but for units instead.
edited 1×, last 04.10.10 09:28:25 am
owner of "Eagle mod" and "Survival Stories mod" and Halo Mod for stranded 2. Also make games, http://www.unrealsoftware.de/forum_posts.php?post=249591#jn
UnIdEnTiFiEd has written:
thanks! and how can i make it units attack other units that have the predator behavior, but not me? like the soldior object thing in v666 mod but for units instead.
Can't be done. I've seen many mentions of this kind of behaviour and it seems that it can't be done by scripting. You'd need to change the source code.
damn! but does that mean extension mod has changed the source code?
owner of "Eagle mod" and "Survival Stories mod" and Halo Mod for stranded 2. Also make games, http://www.unrealsoftware.de/forum_posts.php?post=249591#jn
Even if MM does have a grenade script, I dont want to download MM, (no matter how good it is), I just need a grenade script please.
Original creator of Stranded 2 wiki, which I'm more proud of than graduating high school
well theres none i know of except that one.
btw is there a script that if i shoot something with a certain weapon it will die?
and how do i make the projectile with the script from defence tower be a bullet, not and arrow?
btw is there a script that if i shoot something with a certain weapon it will die?
and how do i make the projectile with the script from defence tower be a bullet, not and arrow?
edited 1×, last 06.10.10 07:56:02 am
owner of "Eagle mod" and "Survival Stories mod" and Halo Mod for stranded 2. Also make games, http://www.unrealsoftware.de/forum_posts.php?post=249591#jn
11.10.10 01:56:29 am
Heres a "Grenade" script.I am not sure if its the same as the Massive mod one.In the "Exploding Bomb" script were it says (timer "self",3000,0,"boom";), the "3000" is the delay time,just set any number here.3000=3 seconds delay.
Paste this in "Items_weapons.inf"
### Grenade
id=520
name=Grenade
group=weapon
icon=gfx\banana.bmp
model=gfx\banana.b3d
fx=16
scale=0.3
mat=stone
weight=100
info=Grenade
behaviour=throw
damage=0
speed=15
drag=1.8
rate=3000
script=start
on:impact {
$tmp=create ("object",530);
setpos " object",$tmp,impact_x(),impact_y(),impact_z();
setrot " object",$tmp,0,getyaw("unit",1),0;
}
}
}
script=end
--------------------------------------------------------------------
Paste this in "Objects_Stuff.inf"
### Exploding Bomb
id=530
name=explosive
model=gfx\banana.b3d
fx=16
scale=0.3
group=stuff
icon=gfx\banana.bmp
health=5
color=300,300,300
mat=stone
var=radius,Radius of Explosion,200,0
var=damage,Damage,150,0
script=start
on:create {
timer "self",3000,0,"boom";
}
on:boom {
explosion getx("self"),gety("self"),getz("self") ,$radius,$damage;
free "self";
}
script=end
-----------------------------------------------------------------------------------------------------
Paste this in "Items_weapons.inf"
### Grenade
id=520
name=Grenade
group=weapon
icon=gfx\banana.bmp
model=gfx\banana.b3d
fx=16
scale=0.3
mat=stone
weight=100
info=Grenade
behaviour=throw
damage=0
speed=15
drag=1.8
rate=3000
script=start
on:impact {
$tmp=create ("object",530);
setpos " object",$tmp,impact_x(),impact_y(),impact_z();
setrot " object",$tmp,0,getyaw("unit",1),0;
}
}
}
script=end
--------------------------------------------------------------------
Paste this in "Objects_Stuff.inf"
### Exploding Bomb
id=530
name=explosive
model=gfx\banana.b3d
fx=16
scale=0.3
group=stuff
icon=gfx\banana.bmp
health=5
color=300,300,300
mat=stone
var=radius,Radius of Explosion,200,0
var=damage,Damage,150,0
script=start
on:create {
timer "self",3000,0,"boom";
}
on:boom {
explosion getx("self"),gety("self"),getz("self") ,$radius,$damage;
free "self";
}
script=end
-----------------------------------------------------------------------------------------------------
edited 1×, last 11.10.10 06:54:44 am
11.10.10 08:57:30 am
I wanted to interact with the use or player and saw the inputwin command here : http://stranded.unrealsoftware.de/s2_commands.php?list=strings
This inputwincommand is defined in other language which i dont understand ...Please help he and tell how can i use it and store what the user says(types)
This inputwincommand is defined in other language which i dont understand ...Please help he and tell how can i use it and store what the user says(types)
edited 2×, last 11.10.10 09:10:54 am
hey my website
http://hdfree.weebly.com/
SLY3152 has written:
Sorry to disturb but i really need help .... I was making a mod which i left in between but now i want to restart and saw the inputwin command ....
Please help and tell me how to use it and how to store what the user enters.....
Please help and tell me how to use it and how to store what the user enters.....
.....
I dont understand, any of that! but if you explain more carefully i might be able to help you..
owner of "Eagle mod" and "Survival Stories mod" and Halo Mod for stranded 2. Also make games, http://www.unrealsoftware.de/forum_posts.php?post=249591#jn
11.10.10 09:14:26 am
I wanted to interact with the user or player and saw the inputwin command here : http://stranded.unrealsoftware.de/s2_commands.php?list=strings
This inputwincommand is defined in other language which i dont understand ...Please help he and tell how can i use it and store what the user says
This inputwincommand is defined in other language which i dont understand ...Please help he and tell how can i use it and store what the user says
hey my website
http://hdfree.weebly.com/
Try reading the pahe through google translate...
http://translate.google.com/translate?hl=en&ie=UTF-8&sl=auto&tl=en&u=http://stranded.unrealsoftware.de/s2_commands.php%3Flist%3Dstrings&prev=_t
Another win for google!
http://translate.google.com/translate?hl=en&ie=UTF-8&sl=auto&tl=en&u=http://stranded.unrealsoftware.de/s2_commands.php%3Flist%3Dstrings&prev=_t
Another win for google!