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 256 57 58121 122 Next To the start

old Re: Scripting Questions

Guest

Quote
@Gradir Yup yup, completely true - yours free the timer on pickup, which I forgot. Also checks if there is still a fire in range. And also makes sure the thing isnt already frying. I only gave you the utmost basic code to do what you asked x)

@DontKnowHowToScript Oh dang, that's what you get for writing at like 7 in the morning

old Re: Scripting Questions

Guest

Quote
While I'm at it, there is a final possible tweak to that thingy - though I wonder if it would actually worth the trouble. That said tweak consisting in adding a global event, presumably like that : (Note : this is pure speculative code)
1
2
3
4
5
6
7
8
9
10
11
// Main event
on:newfirestarted {
	loop ("items") {
		$id=loop_id();
		$typ=type("items",$id);
		if ((($typ==MeatId1)+($typ==MeatId2)+(...))>0) 	{
			event "checkfry","items",$id;	
		}
		
	}
}

Then, in your meat code, add the related event :
1
2
3
4
5
6
7
8
9
on:checkfry {
	if ((count_inrange("state",5,50)+count_inrange("state",4,50))>0) {
		if($fry==0) {
			timer "self",15500,1,"fry";
			play "fry.mp3";
			$fry=1;
		}
	}
     }

Yeah, purely speculative, untested code - you gotta love it.
Then you add the global event to every action that starts a fire, so that if you drop a piece of meat then light the fire on, it will start to fry.

As I said, no idea if it is worth the trouble to anyone - I'm just having some fun coding here.

old Re: Scripting Questions

Gradir
User Off Offline

Quote
sure its worth the trouble gotta test it and think on that, but a little later, haven't got much time ATM. thanks for your efforts on that topic

old throwing ax help

darksol
User Off Offline

Quote
i made a throwing ax and i want it to stick were it lands but win it hits it drops the code for it is here

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
### throwing ax
id=121
name=throwing ax
group=ammo
icon=gfx\axe.bmp
model=gfx\axe.b3d
fx=16
scale=0.2
mat=wood
weight=3
behaviour=spear
info=throwing ax o what fun
damage=12
healthchange=0
script=start
	on:impact {
		if (impact_first()==1){
				$tmp=create("item",121);
					setpos "item",$tmp,impact_x(),impact_y(),impact_z();
					setrot "item",$tmp,0,getyaw("unit",1),0;
				}
			}
script=end

i was wondering what model format for the map is
edited 1×, last 08.12.08 03:08:59 am

old Re: Scripting Questions

Guest

Quote
How do you turn cheat mode off so you cant activate it?
i checked in sys files under mods but i cant find it?

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
Look at it like this:
If someone want's to destroy the fun of the game by cheating it's his own fault.
But sometimes the cheatsystem is really helpfull, especially when you're stuck and don't want to search an item for 20 days in a row.

old Re: Scripting Questions

Guest

Quote
Flying Lizard has written
Look at it like this:
If someone want's to destroy the fun of the game by cheating it's his own fault.
But sometimes the cheatsystem is really helpfull, especially when you're stuck and don't want to search an item for 20 days in a row.


To bad you can,t disable it.
anywho I didn,t want to cheat i was just typing random things into the console

old Re: Scripting Questions

DontKnowToScript
User Off Offline

Quote
how to make the game save variables
i think of loadmap ... but how? (the variables: $exp,$expneed,$level,$job)
please answer soon.
i cant get done with global game since if i want bosses i :
when i get back i will get back to the 4th job island (or other islands) and i will get back to level 1 and exp 1...
i will get back to job 0...
my exp need will get to 1,starting the game again in level,exp and job to when i started to play...
and how to count if a specific unit exists on the island?

old Re: Scripting Questions

DontKnowToScript
User Off Offline

Quote
i require the answer of the moderators,they explain way better...
ok got how to save them
now other thing:how to make animating sprite (like the fire,but they are just a pic! how they can animate?) i want to make a blue fire
and how to make a player write something and save in a variable? (s2 cmd trim ?)
edited 2×, last 05.01.09 11:49:34 am

old Re: Scripting Questions

DontKnowToScript
User Off Offline

Quote
i know about particle,but i want to change the fires color not in all cases but a certain one to be blue.
and inputwin:it cannot let the player write things. i think the most good command is,let the player write something in a file and load it as a variable in message box.ok?

old Building Script

Jimi Hendrix
User Off Offline

Quote
I have fixed this script will post it at the end
edited 3×, last 07.01.09 01:56:35 am

old Re: Scripting Questions

Tau
User Off Offline

Quote
In the item "stone", you could place a "free "self"" after the "create". Then the stone would be killed on impact, and replaced with the new stone.

old Building with in game objects

Jimi Hendrix
User Off Offline

Quote
Ok I think it works now,I had to make behaviour=killthrow.Here is a working script that allows you to pick up an item and use that item you pick up to create Buildings or wood piles,anything you could dream of.This script can be applyed to any item in the game and ,object.The reason you need to make an item an object is so when it lands the surfaces stays where it contacts,items just fall ito themselfs.I have only got script for Large Branch and Stone at the moment but its easy to add what ever you want by changeing a few numbers and names round.To place an object equip in hand and press Left mouse button to throw it where you aim,and just pick it up with the "E' key.Here are scripts for stone and Large branch

Link to some screen shots of stone stucture I built real quickly out of about 50 stones

http://img116.imageshack.us/my.php?image=screen01zm3.jpg

http://img116.imageshack.us/my.php?image=screen02wb6.jpg

http://img386.imageshack.us/my.php?image=screen06rf0.jpg

http://img114.imageshack.us/my.php?image=screen07ik1.jpg



copy this into items_material in sys folder



### Stone
id=4995
name=Stone
behaviour=killthrow
group=stone
icon=gfx\stone03.bmp
model=gfx\stone03.b3d
scale=1.3
mat=stone
health=1000
speed=1.8
drag=1.8
rate=1000
mat=stone
weight=1
info=a heavy stone
healthchange=0
script=start



     on:impact{


                    freevar $tmp;
          freevar $tmp2;
          if (impact_first()==1){
                         
$tmp=create("object",242);
                    setpos "object",$tmp,impact_x(),impact_y(),impact_z();
                    setrot "object",$tmp,0,getyaw("unit",1),0;
          



               }
          }

     }

script=end



### Large Branch
id=4994
name=Large Branch
behaviour=killthrow
damage=2
speed=13
drag=0
rate=1500
group=material
icon=gfx\branch.bmp
model=gfx\branch.b3d
scale=2.5
mat=wood
weight=500
speed=1.8
drag=1.8
rate=3000
info=A large branch. Used for buildings, tools, and other things too.
script=start


on:impact{


                    freevar $tmp;
          freevar $tmp2;
          if (impact_first()==1){
                         
$tmp=create("object",2928);
                    setpos "object",$tmp,impact_x(),impact_y(),impact_z();
                    setrot "object",$tmp,0,getyaw("unit",1),0;
          



               }
          }

     }

script=end








Copy this in sys/objects_trees

### Large branch
id=2928
name=Tree
group=tree
icon=gfx\tree01.bmp
model=gfx\branch.b3d
swayspeed=1
swaypower=2
fx=16
scale=2.5
mat=wood
health=600
find=15,20,3
find=24,40,5
find=26,15,1
find=107,5,1
find=107,150,3,1,28
behaviour=tree
healthchange=300
script=start

     on:use {
          $sh = health("self");
          if($sh>0){
               $x=getx("self");
               $z=getz("self");
               $newId=create("item",4994,$x,$z);
               $h = $sh - 100;
               health "unit", $newId, $h;
               free "self";
          


     // Spawn Trunk
     on:kill {
          if (spawntimer("self")>=0){
               event "iskill_wood","global";
               create "item",7,getx("self"),getz("self"),3;
               corona getx("self"),getz("self");
          }
     }
script=end





copy this in objects_stone

### Stone
id=242
name=Stone
behaviour=stone
group=stone
icon=gfx\stone03.bmp
model=gfx\stone03.b3d
scale=1.3
mat=stone
health=1000
autofade=350
find=4989,30,1,1,88
find=4987,15,1,1,30
find=4924,30
find=23,90,2
find=21,90,7
script=start
     on:use {
          $sh = health("self");
          if($sh>0){
               $x=getx("self");
               $z=getz("self");
               $newId=create("item",4995,$x,$z);
               $h = $sh - 100;
               health "unit", $newId, $h;
               free "self";
          }
     }



script=end
edited 9×, last 07.01.09 07:33:21 am

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
@Dontknowtoscript
1.oh sry, you'r right. Then I doubt that there is any way to create a blue flame, at least I can't think of any.

2. hm that's odd, the only reason why DC created inputwin, was for inputing strings

old Axe stay where it lands

Jimi Hendrix
User Off Offline

Quote
This is for darksol so his axe stays where it hits


Code:

### throwing ax
id=121
name=throwing ax
group=ammo
icon=gfx\axe.bmp
model=gfx\axe.b3d
fx=16
scale=0.5
mat=wood
weight=3
behaviour=killthrow
info=throwing ax o what fun
damage=12
speed=12
drag=3
rate=2000
healthchange=0
script=start

on:impact {



     if (impact_first()==1){
          
                    $tmp=create("item",121);
                     setpos "item",$tmp,impact_x(),impact_y(),impact_z();
setrot "item",$tmp,0,getyaw("unit",1),0;

               
                    }
     
}
}
script=end
edited 1×, last 07.01.09 07:39:04 am

old Re: Scripting Questions

HudaJan
Super User Off Offline

Quote
Flying Lizard has written
@Dontknowtoscript
1.oh sry, you'r right. Then I doubt that there is any way to create a blue flame, at least I can't think of any.

And what about s2 cmd statecolor ? it should be possible...
To the start Previous 1 256 57 58121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview