Freezing weapon?
2 replies



15.01.17 06:03:55 pm
I tried to make a weapon that freezes units.
This is my script:
but it doesn't work.
If anyone knows how to make it work, please post here.
This is my script:
Code:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
on:impact {
$tmp=impact_class();
$tmp2=impact_id();
//Freezing
if ($tmp==("unit")){
freeze $tmp2,1;
}
freevar $tmp;
freevar $tmp2;
}
$tmp=impact_class();
$tmp2=impact_id();
//Freezing
if ($tmp==("unit")){
freeze $tmp2,1;
}
freevar $tmp;
freevar $tmp2;
}
but it doesn't work.
If anyone knows how to make it work, please post here.
Getcha pull!
Hi Warbringer,
I think the problem is in the IF statement...it can not recognize if $tmp is a unit or not, so it never freezes anything. You might want to try this: ( remove brackets around (unit) )
or
or
This below works for certain cuz I just created/tested it;
Here you can see I am asking if the impacted thing is "flesh" or not, because I can compare the "material", and I only want to freeze UNITS. You should have in the DEFINITIONS of your UNITS declaring mat=flesh. This can also be used if you have a unit you want to be immune to freeze. You simply change it's material to something else like mat=dust. Or if you have this script attached to a axe and you are hitting a tree the script is not trying to "freeze the tree", because the tree mat=wood.
I added particles to give it an effect otherwise the unit is simply frozen. You can remove the addstate and statecolor if you do not want that.

Alternatively you can compare BEHAVIOR and only freeze aggressive units if you have the script choose RAPTOR behaviors. Also listed in the units definitions.
if(compare_behavior($tmp,$tmp2,"raptor")==1){
p.s. If you use a melee weapon attach the script to the weapon...if your using a ranged weapon (like a bow) make sure to attach the script to the ammo (arrow).
I think the problem is in the IF statement...it can not recognize if $tmp is a unit or not, so it never freezes anything. You might want to try this: ( remove brackets around (unit) )
Code:
1
2
3
4
5
6
7
2
3
4
5
6
7
on:impact {
$tmp=impact_class();
$tmp2=impact_id();
if ($tmp == "unit"){
freeze $tmp2,1;
}
}
$tmp=impact_class();
$tmp2=impact_id();
if ($tmp == "unit"){
freeze $tmp2,1;
}
}
or
Code:
1
2
3
4
5
6
2
3
4
5
6
on:impact {
$tmp=impact_id();
if (impact_class() == "unit"){
freeze $tmp,1;
}
}
$tmp=impact_id();
if (impact_class() == "unit"){
freeze $tmp,1;
}
}
or
Code:
1
2
3
4
5
6
2
3
4
5
6
on:impact {
$tmp=impact_id();
if (impact_class("unit")){
freeze $tmp,1;
}
}
$tmp=impact_id();
if (impact_class("unit")){
freeze $tmp,1;
}
}
This below works for certain cuz I just created/tested it;
Here you can see I am asking if the impacted thing is "flesh" or not, because I can compare the "material", and I only want to freeze UNITS. You should have in the DEFINITIONS of your UNITS declaring mat=flesh. This can also be used if you have a unit you want to be immune to freeze. You simply change it's material to something else like mat=dust. Or if you have this script attached to a axe and you are hitting a tree the script is not trying to "freeze the tree", because the tree mat=wood.
Code:
1
2
3
4
5
6
7
2
3
4
5
6
7
on:impact {
$tmp=impact_class();
$tmp2=impact_id();
if(compare_material($tmp,$tmp2,"flesh")==1){
freeze $tmp2,1;
}
}
$tmp=impact_class();
$tmp2=impact_id();
if(compare_material($tmp,$tmp2,"flesh")==1){
freeze $tmp2,1;
}
}
I added particles to give it an effect otherwise the unit is simply frozen. You can remove the addstate and statecolor if you do not want that.
Code:
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
on:impact {
$tmp=impact_class();
$tmp2=impact_id();
if(compare_material($tmp,$tmp2,"flesh")==1){
freeze $tmp2,1;
addstate $tmp,$tmp2,25;
statecolor "$tmp",$tmp2,25,0,255,255;
}
}
$tmp=impact_class();
$tmp2=impact_id();
if(compare_material($tmp,$tmp2,"flesh")==1){
freeze $tmp2,1;
addstate $tmp,$tmp2,25;
statecolor "$tmp",$tmp2,25,0,255,255;
}
}

Alternatively you can compare BEHAVIOR and only freeze aggressive units if you have the script choose RAPTOR behaviors. Also listed in the units definitions.
if(compare_behavior($tmp,$tmp2,"raptor")==1){
p.s. If you use a melee weapon attach the script to the weapon...if your using a ranged weapon (like a bow) make sure to attach the script to the ammo (arrow).
edited 5×, last 16.01.17 09:26:18 pm
The Survivalist_12-24-19 is now available. DOWNLOAD HERE
The Survivalist 12-24-19 | Performance-In options keep Water Detail off

Dude, you're the best!
I already figured it out though, it goes like this:
It's meant to freeze every living unit.
But, thanks for suggestion with adding particles.
I already figured it out though, it goes like this:
Code:
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
on:impact {
$tmp=impact_class();
$tmp2=impact_id();
if ($tmp==2){
if (lives($tmp,$tmp2)==1){
freeze $tmp2,1;
}
}
freevar $tmp;
freevar $tmp2;
}
$tmp=impact_class();
$tmp2=impact_id();
if ($tmp==2){
if (lives($tmp,$tmp2)==1){
freeze $tmp2,1;
}
}
freevar $tmp;
freevar $tmp2;
}
It's meant to freeze every living unit.
But, thanks for suggestion with adding particles.
Getcha pull!



