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 2116 117 118121 122 Next To the start

old Re: Scripting Questions

Dr Zhark
User Off Offline

Quote
What I mean is that when I talk to someone, and then press a button they mark a Indicator on the map.

Like in Adventure, the Pirate 'briskly' marks the map. A bit like that.

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
well, just make that button link to another site where the dialogue goes on for a bit and write this before the line "text=start":
1
2
3
script=start
showindicator [ID of indicator];
script=end
by this the place of the indicator appears on the map.
if you have multiple indicators that all shall appear at the same time just repeat the showindicator -command.
actually all of this is VERY easy.

old Re: Scripting Questions

Dr Zhark
User Off Offline

Quote
Hurri04 has written
well, just make that button link to another site where the dialogue goes on for a bit and write this before the line "text=start":
1
2
3
script=start
showindicator [ID of indicator];
script=end
by this the place of the indicator appears on the map.
if you have multiple indicators that all shall appear at the same time just repeat the showindicator -command.
actually all of this is VERY easy.


Dude, are you God?

old Goddamnit

Dr Zhark
User Off Offline

Quote
I really need to learn how to 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
page=start
title=Pirate Leader
text=start
Yar! I be the great pirate leader? What do ye want?
text=end
button=recall,Not so great for a ship crash leader!
button=action:close,As if!

page=recall
title=Ship Crash
text=start
Well.... Ye see, the mighty god of sea let a storm, and we accidently crash! What else do ye want?
text=end
button=info,Can we be friends?
button=action:close,Nothing! Bye!

page=info
title=Friends?
script=start
	showindicator 14;
	starttrigger 18;
	stoptrigger 16;
script=end
text=start
Weellll.... I s'pose so... Let me mark ye map for yar!
text=end
button=action:close,Thank you!
What's wrong with this?

Also, this is ID 18 for the Starttrigger below
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
page=start
title=Pirate Leader Jack
text=start
Arrr! It be you! What can I do for ye?
text=end
button=info,Let's talk
button=action:close,Sorry! I have to go!

page=info
title=Chat
text=start
Arr! Ye olde conversation! Let me start off. Do you want to hear a story or buy a map?
button=story,Story please!
button=trade,Buy a map.

page=trade
title=Buy a Map
## Gold bag -> Map
trade=start
sell=5,5
buy=73,1
trade=end
button=info,Let's talk again
button=action:close,I must go now!

page=story
title=Story
text=start
Arr! Well I was walkin' along an olde dusty path and then suddenly a Monkey came out to try and kill me! It had sharp claws... I was honestly scared ye know! As he came towards me I pulled out my flintock walkin' backwards until I slipped over, and it nearly devoured my foot! Instead, it devoured my leg.
text=end
button=information,Ouch! How are you now?
button=action:close,Ow! But I must get going now. Thanks!

page=information
title=Recovery
text=start
Arrhah-hah! I'se all right now! Well, I have something to do! See you later!
text=end
button=action:close,See you then!

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
Dr Zhark has written
What's wrong with this?

see, I could ask you the same question.
so what's wrong with the script?

if you want some help you should tell us something about the problem you have with it.
what does happen?
does something happen at all?
is there an error message?
if yes, what does it say?

so as I have no information of that now my first guess would be that you wrote any of these scripts into a wrong script-box.
and as you said that the second script is written into a trigger that is, as I read in the script, being activated I'd wildly guess that this is an areal trigger so you want the second dialogue to appear when entering the area of that trigger, right?
but in order to do this you have to write this script into the areal trigger and then write the second script you postet into a textcontainer:
1
2
3
on:trigger {
	dialogue "start", [ID of textcontainer];
}

it's the same with the first dialogue, you just have to write "on:use" instead of "on:trigger" into the first line and a different ID at the dialogue command of course. this then goes into the pirate's scriptbox and the first script you postet goes into a textcontainer as well.

old Confused

Dr Zhark
User Off Offline

Quote
Uhhh... The second script I put in was not in a trigger. It was in a text container. Here's what I did.
More >

If you need more information, state! Also,
what does happen?-Dialogue 18 (script 2) never shows
does something happen at all?-He only speaks Script 1
is there an error message?-No

Finally, there are a few other Pirates in the radius of 500.

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
Quote
Type: (Picture of Pirate)

well, I think this could be the problem because the trigger is just triggered when the number of pirates within the radius is smaller or equal 1 so if there are "a few other Pirates in the radius of 500" this wont be triggered.

I think this either has to be changed in a way that it is triggered when the number of pirates is bigger/equal 1
or in a way that it is triggered when the number of players is equal 1 (when the player enters the areal).


also @Qrchack:
no one needs to put any code into spoilers. this is the scripting questions thread, just in case you didnt notice, and that means that the scripts which are written in here are meant to be read.

old Try it

Dr Zhark
User Off Offline

Quote
It would help if you tried it for yourself, as mine is not triggering.

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
hmm, dont know exactly what the problem is but I just had an idea.

I think the problem could be that the trigger is activated while you still are in the dialogue but as the trigger would start a new dialogue and there cant be 2 dialogues at the same time it just doesnt open.

try to write a global timer which will start the trigger after 0.001 second (1 millisecond) instead of that it is started right in the dialogue:
1
timer 0, 1, 1, "starttrigger";
istead of the starttrigger command line which then goes into the global script like this:
1
2
3
on:starttrigger {
	starttrigger 18;
}

by this the trigger which opens the second dialogue starts with a little delay ater you have closed the first dialogue.

old Re: Scripting Questions

Lion_Hearted
User Off Offline

Quote
Hello again!

I've been trying to develop a type of plant that sticks to your feet like glue... and the main problem I'm having, is the problem of the player's speed.

I want the player to slow down when hes walking over the plants, and then to return to normal speed after walking past them...


I've tried dozens of different ways, but it never seems to work right.

Anybody got a working script?

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
how about this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
on:start {
	timer "self", 1000, 0, "plant_inrange";
}

on:plant_inrange {
	if(inrange("self", [RADIUS])==1) {
		if($speedlowered==0) {
			player_speed [LOW VALUE];
			$speedlowered=1;
		}else{
			player_speed [NORMAL VALUE];
			$speedlowered=0;
		}
	}
}
just write this into the definition-script of the plant and enter the necessary values. I think you can get the normal speed value of the player from the units.inf file from the player's definition.
so when walking near to this plant the speed you are moving with is drained for as long as you keep standing near it.

old Re: Scripting Questions

UnIdEnTiFiEd
User Off Offline

Quote
This is the script filfer used to make his inhand weapons.

Spoiler >


how do i make the weapon a bit higher? and how do i make it i cant pick the weapon up (seeing that it is an item)

and also, how do i make it if i hit something, it will light on fire AND give light with the radius of 100?
edited 1×, last 10.01.11 02:23:29 am

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
@UnIdEnTiFiEd:
to put the weapon a little bit higher I guess you could just move it a little bit upwards within the model itself.
I'm not sure about this because I didnt read the code that much in detail because it is a mess the way you posted it (no tabs and therefore no different levels within the script script and such) but I think that it has something to do with this:
1
$y+=20;
so setting this number to a higher value might also bring the solution.

and to be unable to pick the item up you can use a script like this:
1
2
3
on:collect {
	skipevent;
}
if you want that you cant pick the items up only at certain times you can use a variable and check whether it is 0 or 1 and whenever the situation changes so that you shall be able to pick the item up again or not, you swap the value of the variable from 0 to 1 and vice versa.

and to light something on fire you can use this as the definitionscript of the weapon:
1
2
3
on:impact {
	addstate "impact_class()", impact_id(), 4;
}
I dont know whether the radius of the light is exactly 100 but it should be something like that.
but in case that isnt you can also just use the command s2 cmd addstate to add either the state 22 (flare) or 24 (light) to it and resize it with the command s2 cmd statesize.

old Re: Scripting Questions

UnIdEnTiFiEd
User Off Offline

Quote
thanks hurri04 , but it unfortunatly doesnt work, it makes the gun have a seizer when shooting and now it aims at my guy but thanks anyway

EDIT= got it working!

how do i make this shoot at enemies really fast and the projectile is a bullet?


### Turret
id=4590
name=Turret
group=building
icon=gfx\defensetower.bmp
model=gfx\Chaingun\chaingun.b3d
scale=1.2
y=2
health=3000
mat=wood
state=0,28,0
script=start
     on:start {
          timer "self",3000,0;
          addstate "self",22;
          statesize "self",22,15;
     }
     on:create {
          timer "self",3000,0;
          addstate "self",22;
          statesize "self",22,15;
     }
     on:build_finish {
          event "defensetowerbuild",0,0;
     }
     on:use {
          msgbox "Defense Tower","sys/scripts/defensetower.s2s";
     }
     on:timer {
          local $x,$y,$z;
          $x=getx("self");
          $y=gety("self");
          $z=getz("self");
          $y+=28;
          projectile 29,$x,$y,$z,2,9,194,196;
     }
script=end

so far it shoots somewhere to the left at the slowest possible speed
edited 1×, last 11.01.11 08:36:40 am

old Re: Scripting Questions

Vectarrio
User Off Offline

Quote
@UnIdEnTiFiEd
for speed, change timer time in both lines
1
timer "self",3000,0;
3000 is rate. = 3sec

and to change coordinates of fire, use lines in on:timer{ thing like that:
1
2
3
4
5
6
7
8
9
10
on:timer {
          local $x,$y,$z;
          $x=getx("self");
          $y=gety("self");
          $z=getz("self");
          $x+=5;
          $y+=28;
          $z+=5;
          projectile 29,$x,$y,$z,2,9,194,196;
     }
of course, you can change values in these changes.

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
How do you make new states? I've seen it done on the Stranded2Ext, but don't know how to do it.
To the start Previous 1 2116 117 118121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview