Forum
Stranded II Scripts Scripting Questions Vectar666 has written
I have idea for spear, if throw it on rightclick with projectile command, and change behaviour to blade, so you can do melee attack with less dmg.
I think this has already been done in massive mod, but i'm not 100% sure
I have a question about scripting (which is rare for me), but what I want to acheive is easy to explain... I'm thinking of modelling an amulet, which in itself is easy, but not everyone will be sure what it's for, but I want it to act as a behavioural ward.
Basically, if you are in possession of the amulet then any agressive unit (raptors/lions etc) flee instead of attacking.
The hard part is I want this behaviour to be scripted purely in the item script space, making it an addition rather than a modification of the game system.
Anyone got any ideas?
It ain't going to show up on the random map, or even on any of the adventure modes unless you add it to the random map file...
Check the editor... scroll down to the bottom of the list when you reach the units, and there, (if your ID is the biggest number) is your units...
Jesterhead37 has written
But even in the editor it doesn't show up.
Then delete the "editor=0" line!
@Psytechnic
Make loop.
loop ("units"){
local $lid=loop_id()
ai_mode $lid, "flee", "unit", 1;
}
I think there are some poblems in your script.
for example the loop command has to be repeated by usign a timer but this could cause laggs if there are many units on the map.
also there cant be a local variable because the amulet is in the players inventory.
last problem is, that the line with the ai_mode you wrote would make the player flee instead of the aggressive unit.
I would suggest using a scipt like this:
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
on:load { 	timer 0, 500, 0, "amulet"; } on:amulet { 	if(playerspotted==1) { 		ai_behavioursignal "distract", "raptor", 50, "unit", 1; 	} }
to also chase away aggressive water or air units you have to repeat the ai_behavioursignal command and replace "raptor" with "predatorfish" or "killerbird".
put 2 of the pearls as eyes on an excrement and use a leaf for a hat for Mr.Hankey and using as ammunition for the blowgun
1
2
3
2
3
on:load { 	ai_stay "self"; }
Hmm... I dont know if this is a 'scripting question', but how do I add a texture to an object that is in a .3ds format without having 3DStudio?
edited 1×, last 20.10.10 03:02:02 pm
1
2
3
2
3
on:load { 	texture "[PATH]/[NAME].[FORMAT]"; }
this should replace the unit's original skin with the chosen texture.
EDIT= also how can i make it that when i die, it loads a map and i'm on full health again?
edited 2×, last 21.10.10 08:24:14 am
UnIdEnTiFiEd has written
How can I make it if I eat something i have a chance of geting the poison state, and 1-3 days later i'm cured of it?
you have to write this into de definition script of the item in its items_*.inf file:
1
2
3
4
5
6
2
3
4
5
6
on:eat { 	if(random(0,2)==0) { 		addstate "unit", 1, 2; 		$poison=3; 	} }
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
on:changeday { 	if(gotstate("unit", 1, 2)==1) { 		$poison--; 		if($poison==0) { 			freestate "unit", 1, 2; 		} 	} }
UnIdEnTiFiEd has written
EDIT= also how can i make it that when i die, it loads a map and i'm on full health again?
write this into the units.inf file into the script of the player (Unit #1):
1
2
3
4
2
3
4
on:kill { 	revive 1; 	loadmap "[MAPNAME].[FORMAT]", 1, 1, 1, 1, 1, 1; }
I think a script like this in the definition script of the sword should work fine:
1
2
3
2
3
on:attack1 { 	areal_event "wildblow", getx("unit", 1), gety("unit", 1), getz("unit", 1), 45, 0; }
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
on:wildblow { 	loop("units") { 		if(inrange("unit", loop_id(), 45)==1) { 			damage "unit", loop_id(), [DAMAGE DONE BY SWORD]; 		} 	} 	loop("objects") { 		if(inrange("object", loop_id(), 45)==1) { 			damage "object", loop_id(), [DAMAGE DONE BY SWORD]; 		} 	} }
if you wish to also damage items by this sword-strike just repeat the block of 4 script lines, beginning with the loop command and replace the class with "items" in the loop command line and "item" in the other two lines.