English Scripting Questions

2,429 replies
Goto Page
To the start Previous 1 2 ... 60 61 62 ... 121 122 Next To the start
13.03.09 03:05:26 am
Up
lint35
User
Offline Off
I was woundering if there was a script I could ad when ever the player dies music plays. Is this possible?
IMG:http://bfbc2.statsverse.com/sig/userbar4/360/KI113R%20L3M0NZ.png
13.03.09 07:16:30 am
Up
Flying Lizard
User
Offline Off
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
Worte sind wie Pfeile, man kann sie nicht zurücknehmen.
13.03.09 07:46:48 am
Up
lint35
User
Offline Off
Alright I understand that, but what I'm really looking for is where to put the script.
IMG:http://bfbc2.statsverse.com/sig/userbar4/360/KI113R%20L3M0NZ.png
13.03.09 09:53:28 pm
Up
Gradir
User
Offline Off
Just think about it - the best place would be scripts in Player unit in units.inf, no?
probably on:kill
Early to rise, early to bed makes a man healthy, wealthy and dead.
14.03.09 12:47:39 am
Up
lint35
User
Offline Off
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?
IMG:http://bfbc2.statsverse.com/sig/userbar4/360/KI113R%20L3M0NZ.png
14.03.09 03:03:03 am
Up
Gradir
User
Offline Off
Code:
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
Early to rise, early to bed makes a man healthy, wealthy and dead.
14.03.09 12:56:17 pm
Up
Geree
User
Offline Off
Hi!PLS anyone can show me an example how to make a teleport ?
14.03.09 01:01:15 pm
Up
Westbeam
User
Offline Off
here:
Code:
1
2
3
on:use {
setat "unit",1,"info",1;
}

Make this in an object. You will teleport to the info with ID 1.
14.03.09 03:52:13 pm
Up
Geree
User
Offline Off
very thx...and for diary entry
14.03.09 04:28:12 pm
Up
Westbeam
User
Offline Off
here, make this in the global script:
Code:
1
2
3
4
on:start {
add "text";
diary "diary";
}
14.03.09 05:01:13 pm
Up
Geree
User
Offline Off
Sorry for my questions, but I&#180;m newbie in scripting...:)
14.03.09 09:55:38 pm
Up
lint35
User
Offline Off
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
IMG:http://bfbc2.statsverse.com/sig/userbar4/360/KI113R%20L3M0NZ.png
14.03.09 11:31:04 pm
Up
Geree
User
Offline Off
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
15.03.09 12:06:44 am
Up
Zune5
COMMUNITY BANNED
Offline Off
Try looking through this thread, you may find something...
Zune5 feels diagonally parked in a parallel universe.
15.03.09 09:55:02 am
Up
Westbeam
User
Offline Off
@Geree
make the diaryscript in a time-trigger
15.03.09 11:36:14 am
Up
Geree
User
Offline Off
thanks a lot:)
15.03.09 02:17:30 pm
Up
Gradir
User
Offline Off
@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:
Code:
1
$x=getx("unit",1)

and then use them instead of "self" -
Code:
1
create "item",146,$x,$z;
Early to rise, early to bed makes a man healthy, wealthy and dead.
17.03.09 06:50:10 am
Up
lint35
User
Offline Off
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
IMG:http://bfbc2.statsverse.com/sig/userbar4/360/KI113R%20L3M0NZ.png
17.03.09 10:41:34 pm
Up
Geree
User
Offline Off
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?:$
19.03.09 10:41:07 pm
Up
Holy_Dragon
User
Offline Off
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 2 ... 60 61 62 ... 121 122 Next To the start