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 260 61 62121 122 Next To the start

old Re: Scripting Questions

lint35
User Off Offline

Quote
I was woundering if there was a script I could ad when ever the player dies music plays. Is this possible?

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
The player is handled like a unit. So, whever something happens to the player, the corresponding event is started at the unit 1. The command you need would be s2 cmd music

old Re: Scripting Questions

Gradir
User Off Offline

Quote
Just think about it - the best place would be scripts in Player unit in units.inf, no?
probably on:kill

old Re: Scripting Questions

lint35
User Off Offline

Quote
Thanks! Well I'm trying to make a weapon when you use it, it will flash. Like I'm making a gun that when you shoot it will flash yellow real quick. I also want it to spawn/drop an item like a shell. Any suggestions?

old Re: Scripting Questions

Gradir
User Off Offline

Quote
1
2
3
4
5
on:attack1
	{
	flash 220,208,196,0.002,0.9;
	create "item",<shell's item ID number>,"self","self";
	}

something like that


BTW, it seemsfunction s2 cmd randomcreate doesnt work on objects:?:
edited 1×, last 14.03.09 08:24:38 am

old Re: Scripting Questions

Westbeam
User Off Offline

Quote
here:
1
2
3
on:use {
setat "unit",1,"info",1;
}
Make this in an object. You will teleport to the info with ID 1.

old Errors

lint35
User Off Offline

Quote
Thanks for the scripts, but the creat item dosn't really work I hoped it would. It creats the item great but it spawns it in the middle of the map. Is there a way to make it either spawn where you are standing or spawn directly in the player's bag? I have a few more script errors that I can't get rid of:

### UMP
id=150
name=H&K UMP-45
group=weapon
icon=gfx\umpicon.bmp
model=gfx\UMP.b3d
scale=0.15
behaviour=gun
range=300
rate=150
mat=metal
weight=250
info= a basic SMG.
damage=15
healthchange=0
script=start
     on:attack1 {
          flash 255,252,187,5.050,0.1;
          create "item",146,"self","self";
          if (gety("unit",1)<-15){
               skipevent;
               speech "negative"; }
          if (playergotitem(29)>0) {
          local $sht;
          $sht++;
          if (gety("unit",1)<-15){
               skipevent;
               speech "negative";
               msg "This gun can't",3;
               msg "shoot under water!",3;
          }elseif ($sht==26){
     process "reloading",400;
     play "crack2.wav",15;
     play "crack1.wav",15;
     freevar "$sht";
     skipevent;
     }else{
     if (playergotitem(29)>0) {      play "ump_fire.wav"; }
          }
     }
     on:impact {
          $tmp=impact_class();
          $tmp2=impact_id();
          //+100 Bonus Damage on Flesh
          if (compare_material($tmp,$tmp2,"flesh")==1){
               damage $tmp,$tmp2,100;
          //+100 Bonus Damage on Fruit
          } elseif (compare_material($tmp,$tmp2,"fruit")==1){
               damage $tmp,$tmp2,100;
          //+200 Bonus Damage on Glass
          } elseif (compare_material($tmp,$tmp2,"glass")==1){
               damage $tmp,$tmp2,200;
          }
          freevar $tmp;
          freevar $tmp2;
     }
     on:inhand {
          play "crack1.wav";
     }
     on:noammo {
          speech "negative";
          msg "No ammo!",3;
     }
script=end

_____________________________________________

Same with another similar gun, it keeps saying on the debug menu that 'on' must not be subordinated to conditions.


One more question , I'm trying to make an item that when you use it, it makes you faster but it ware off after a while but I cant seem to get the free state script to work properly without freeing the state too early. Your help is much apreciated

old Re: Scripting Questions

Geree
User Off Offline

Quote
Hi! pls can anyone tell me more button scripts, like button=script:map ?

and pls what i have ti write,when i want a diary entry later in my map?
edited 2×, last 14.03.09 11:54:54 pm

old Re: Scripting Questions

Gradir
User Off Offline

Quote
@lint35

the best effect would probably be when the player gets the shell through s2 cmd store command and then drops it, that the icon flies away Stranded way, but I'm pretty sure it's impossible to script. What you can is either s2 cmd store the item in the player's inventory, use s2 cmd find that will inform the player about finding the item, or spawn it in the player's position, using variables with player's X and Z coordinates, like:
1
$x=getx("unit",1)
and then use them instead of "self" -
1
create "item",146,$x,$z;

old Re: Scripting Questions

lint35
User Off Offline

Quote
Thanks, I got the shells to drop sucessfully. It looks a little messy but it's okay. Now I need some help with a script. I need a script that when you throw this item, a unit runs after it and eats it. Then after that it will explode after a certain amount of time. With all my efforts it dosn't seem this script is real. once again your help is much apreciated.

-Lemon/lint35

old Re: Scripting Questions

Geree
User Off Offline

Quote
Hi! Sry for my another n00b question!:D
I want to script, when I drop something on something, it makes a teleport, like on the second island ....Can you show me pls?:$

old Trade Script

Holy_Dragon
User Off Offline

Quote
Since there are no clear intructions on trade scripts, I will do my best to explain what to do. I will also place a sample working script so anyone can use.

1. first you need to create a text document in the game files. make one in the maps files (mods/sranded II/maps).

2. place this in the text file:

on:start {
ai_stay "self";
}
//~chieftainscript
on:use {
fademusic 10000;
dialogue "start","maps\sales.txt","chieftaindialogue";
}
//~chieftaindialogue
page=start
title=chieftain
text=start
Yo!
Welcome to the gun store, Want to buy some hunting gear? I would be interested in doing business with you!
text=end
button=sell,Yeah, I have something to sell!
button=buy,Show me your goods!
button=nothing,I have no treasures.
button=action:close,I don't want anything!

page=nothing
title=chieftain
text=start
What? No treasures? I take Gold coins,... and I love fried fish by the way! So find something for me!
text=end
button=sell,Maybe I got something.
button=buy,What is your offer?
button=action:close,Bye.

page=sell
title=Trade with chieftain
# fried fish -> Gold
trade=start
sell=90,1
buy=5,1
trade=end
button=buy,I want to buy something.
button=action:close,Bye.

page=buy
title=Trade with chieftain
# Gold -> Bullet
trade=start
sell=5,1
buy=29,10
trade=end
# Gold -> Shotgun
trade=start
sell=5,30
buy=110,1
trade=end
# Gold -> Pistol
trade=start
sell=5,25
buy=58,1
trade=end
button=sell,I have something to sell.
button=action:close,Bye.


3. after you have put this script in the text document; Start up the game and click on editor.

4. just use a small map that you can see at first; Now, click on Units and scroll down to chieftain (40). Click on the chieftain and place him on the island.

5.Click on the chieftain thats on the island, now, click on script, then click on import script and search for the sales.txt that you made in maps.(mods/stranded II/maps). Click on the sales.txt and click the green ok check. Click ok again and the click ok once more.

6. now save and name yor map. You should be able to play this map in single maps section.

*** I hope this helps anyone out that doen't have a clear understanding of the trade script. From this script you can make different varities of trade scripts.
edited 1×, last 20.03.09 01:32:03 am
To the start Previous 1 260 61 62121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview