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 214 15 16121 122 Next To the start

old Re: Scripting Questions

Gradir
User Off Offline

Quote
Thanks.
I'll be waiting forward to see the bug repaired At the moment my script works fine, except for the bug. He even moves the spawned coconut-parts in the direction of the player a bit, in case they could spawn inside of some object (they still can, but...)
Well, by the way I came upon another things:
Is it possible to add a new state to the game?
And how can I make a repeated event that occur on the specific gametime? I know I can set such thing easily in Editor by setting the timer. Now how to create such a timer from script? Thanks in advance again

edit: I realised that the program cuts the music in menu if it's too long. Is there a way to prevent this?
edited 1×, last 12.02.08 09:46:41 am

old Re: Scripting Questions

bizzl
User Off Offline

Quote
Gradir has written
Well, by the way I came upon another things:
Is it possible to add a new state to the game?

Yes, but they wont have any effects.

Gradir has written
And how can I make a repeated event that occur on the specific gametime? I know I can set such thing easily in Editor by setting the timer. Now how to create such a timer from script? Thanks in advance again

use s2 cmd timer

old Re: Scripting Questions

Gradir
User Off Offline

Quote
Ok, but how can I make it occur on a certain gametime? I can only set the realtime miliseconds

old Re: Scripting Questions

bizzl
User Off Offline

Quote
Gradir has written
Ok, but how can I make it occur on a certain gametime? I can only set the realtime miliseconds

You can check every second wether the time is right or not
there is no other way than that, since you can't configure the timer info via scripting, sry.

old Re: Scripting Questions

Guest

Quote
Two questions. One: me and my cure arrows again.Please tell me why this dosn't work...

### Cure_Arrow
id=999
name= Curing Arrow
group=ammo
icon=gfx\curer2.bmp
model=gfx\arrow_fire.b3d
fx=16
behaviour=ammo:59,ammo:60,ammo:61
weaponstate=16
scale=0.5
mat=wood
weight=10
info=An arrow with healing potion soaked on cloth, cures the target.
damage=0
healthchange=0
script=start
on:impact {
          if (impact_first()==1){
               if (skillvalue("hunt")>=100){
                    if (random(1,10)<=8){
                         $tmp=create("item",53);
                         setpos "item",$tmp,impact_x(),impact_y(),impact_z();
                         setrot "item",$tmp,0,getyaw("unit",1),0;
                    }
               }
          }
     }

     on:impact {
          freetimers "impact_class",impact_id,"cease_healthpotion";
          timer"unit",1,30000,impact_id,"cease_healthpotion";
          freestate "impact_class",impact_id,"intoxication";
          freestate "impact_class",impact_id,"dizzy";
          freestate "impact_class",impact_id,"fuddle";

Seond question: How do I find the I.D. of an object while playing the game?

Alright I admit it. Question three: I want to make a pestiside item that you can drop on the ground and grasshoppers will eat it instead of grain, and it will kill them. Is it possible?

old Re: Scripting Questions

Guest

Quote
how would u make music play one after another using on:use on a stone and then how would u make it stop using the same

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
first:
(I ask this everyone who asks for scripting as a guest )
did you already work through the tutorials? And have you at least basic skills in scripting?
If you do, show us the script you've produced so far.
Otherwise read the tutorials first.

old Re: Scripting Questions

ESKARN
User Off Offline

Quote
this is the first script i tryed and i cant get it to work

//~test_guy_script
on:use {

if($quest_test==0){
          dialogue "start","maps/adventure/test.s2s","test_guy";
     }elseif($quest_test==1){
     if (playergotitem(65)>=30{
     dialogue "success","maps/adventure/test.s2s","test_guy";
     }else{
     dialogue "failure","maps/adventure/test.s2s","test_guy";
     }else{
dialogue "postquest","maps/adventure/test.s2s","test_guy";
               }
          }
     }
}
//~test_guy
page=start
title=testman
text=start
im a test guy!
text=end
button=p1,cool you work
button=action:close,im leaving

page=p1
text=start
yep i work its great
text=end
button=p2a,how u going
button=p2b,bla bla bla

page=p2a
text=start
good for a test guy
text=end
button=p3a,great want somthing since u cant move
button=p3b,so...
button=action:close,im going

page=p2b
text=start
go away
text=end
button=action:close,fine

page=p3a
text=start
yes suprise me
text=end
button=p4,cool im off to find something

page=p3b
text=start
go away
text=end
button=action:close,fine

page=p4
script=start
$quest_test=1;
starttrigger 65;
diary "the test","maps/adventure/test.s2s","test_diary";
script=end

page=success
title=testman
text=start
you have a watch great u ass now i can see how slow time goes by
text=end
button=action:close,be that way then
script=start
$quest_test2=2;
freestored "unit",1,65,30;
find 73;
free "info",65;
extendentry "the map","maps/adventure/test.s2s","test_diary2";
script=end

page=failure
title=testman
text=start
what no gift *hint watch*
text=end
button=action:close,fine ill get the hint watch

page=postquest
title=testman
text=start
having fun
text=end
button=action:close,i dont like you

//~test_diary
i have meet a guy and he is a test i should help him
i want to give him something

//~test_diary2
i dont like what he gave me





any ideas

old Re: Scripting Questions

DC
Admin Off Offline

Quote
your indention is a bit messed up
I fixed it and discovered that you have too many closed brackets.
furthermore it makes no sense to have two or more else in a row because only the first one can be executed (else has no condition -> can't be false -> no else)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
on:use {
	if($quest_test==0){
		dialogue "start","maps/adventure/test.s2s","test_guy";
	}elseif($quest_test==1){
		if (playergotitem(65)>=30{
			dialogue "success","maps/adventure/test.s2s","test_guy";
		}else{
			dialogue "failure","maps/adventure/test.s2s","test_guy";
		[b]}else{    <- makes no sense![/b]
			dialogue "postquest","maps/adventure/test.s2s","test_guy";
		}
	}
}
[b]}    <- not needed![/b]

old Re: Scripting Questions

Guest

Quote
I made a few items but SII won't register this:

###CakeMix
id=983
name=Raw Cake Mix
group=food
icon=gfx\paste.bmp
model=gfx\paste.b3d
scale=0.65
mat=water
weight=200
info=Cake Mix! Bake a cake with this!
rate=3000
script=start
     on:use {
          if ((count_inrange("state",5,50)+count_inrange("state",4,50))>0){
               fry;
               process "baking",1000;
               alteritem 1,982;
          }else{
               msg "I need fire to bake this!",3;
               speech "negative";
          }
     }
script=end

It acts likes its not an item, when i go to "dm, give item" it's not listed

old Re: Scripting Questions

DC
Admin Off Offline

Quote
strange. id 983?! do you have so many different items? is it listed in the editor?
try dm->execute script and enter the following script to give the item to the player
1
find 983;

old Re: Scripting Questions

Guest

Quote
I just started counting down from 999 when I started making my own items. When I made it and tried to check if it was there, it wasn't there in the item list.

old Re: Scripting Questions

stealth
User Off Offline

Quote
You have to increase the value limit_items in sys/game.inf

If it isnt defined, it defaults to 256

old Re: Scripting Questions

Guest

Quote
Well, I have items 999-990 which all work, but some of the 989-980 don't work. Wierd

old Re: Scripting Questions

Guest

Quote
! I figured it out! I forgot the "script=end" on the item before that so StrandedII thought it was one thing, but when it saw the "Script=end" on my mix, it went on to the next item.

old Re: Scripting Questions

Gradir
User Off Offline

Quote
Is there a possibility to add a new type of animation to a unit/object? like idle or move?

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
do you mean the model itself or just the definitions?

you sadly can't edit the b3d-model files S2 is using, so you can't change the animations of the units that are already existing, but you can of course create new units and use animations in them.
To the start Previous 1 214 15 16121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview