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 2107 108 109121 122 Nächste Zum Anfang

alt Re: Scripting Questions

Hurri04
Super User Off Offline

Zitieren
try this:
1
2
3
4
5
6
on:hit {
	$health=health("self");
	if($health<=25) {
		ai_mode currentid(), "flee", "unit", 1;
	}
}

alt Re: Scripting Questions

Psytechnic
User Off Offline

Zitieren
Hurri04 hat geschrieben
try this:
1
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]
	}
}


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:

1
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;
		}
	}
}

This way, as it becomes more damaged, it becomes more inclined to flee...

(Thanks for the cover bloodshot)
1× editiert, zuletzt 01.10.10 12:34:09

alt Re: Scripting Questions

Psytechnic
User Off Offline

Zitieren
Bloodshot hat geschrieben
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.
1× editiert, zuletzt 01.10.10 12:34:31

alt Re: Scripting Questions

Spicy Night Owl
User Off Offline

Zitieren
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.
1
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
2× editiert, zuletzt 03.10.10 19:23:12

alt Re: Scripting Questions

UnIdEnTiFiEd
User Off Offline

Zitieren
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

alt Re: Scripting Questions

Psytechnic
User Off Offline

Zitieren
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.

alt Re: Scripting Questions

UnIdEnTiFiEd
User Off Offline

Zitieren
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.
1× editiert, zuletzt 04.10.10 09:28:25

alt Re: Scripting Questions

Psytechnic
User Off Offline

Zitieren
UnIdEnTiFiEd hat geschrieben
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.

alt Re: Scripting Questions

Spicy Night Owl
User Off Offline

Zitieren
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.

alt Re: Scripting Questions

UnIdEnTiFiEd
User Off Offline

Zitieren
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?
1× editiert, zuletzt 06.10.10 07:56:02

alt Grenade Script

Smurf
User Off Offline

Zitieren
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

-----------------------------------------------------------------------------------------------------
1× editiert, zuletzt 11.10.10 06:54:44

alt Re: Scripting Questions

UnIdEnTiFiEd
User Off Offline

Zitieren
SLY3152 hat geschrieben
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.....

.....

I dont understand, any of that! but if you explain more carefully i might be able to help you..
Zum Anfang Vorherige 1 2107 108 109121 122 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtStranded II-ÜbersichtForenübersicht