English Scripting Questions

2,429 replies
Goto Page
To the start Previous 1 2 ... 108 109 110 ... 121 122 Next To the start
11.10.10 09:30:32 am
Up
SLY3152
User
Offline Off
Psytechnic has written:




Thank U it was helpful but i want to know how do i store the user entered string like we store other values in variables . i tried a lot but errors are comming
hey my website http://hdfree.weebly.com/
13.10.10 01:55:23 am
Up
Lion_Hearted
User
Offline Off
Something that I plan on doing if no-one else has already done it...


Has anyone been able to compile an entire database on every stranded 2 command and its function, including example scripts on how to use the command?

I checked the stranded site, but the commands are often all jumbled with german... and I don't want to continuously go to the german translation site to understand it all.
View my models! Also, check out the realistic hunting and rotting meat system in my mod. Lion_Hearted's Mod
13.10.10 01:52:25 pm
Up
Vectarrio
User
Offline Off
Lion_Hearted has written:
Something that I plan on doing if no-one else has already done it...


Has anyone been able to compile an entire database on every stranded 2 command and its function, including example scripts on how to use the command?

I checked the stranded site, but the commands are often all jumbled with german... and I don't want to continuously go to the german translation site to understand it all.

Open your stranded2\core\scriptcommands.inf
There is commands which will be shown in script window in map editor
13.10.10 09:23:00 pm
Up
Sandman
User
Offline Off
Greeting!

I'm quite new here, because i need some info. I have read a couple of threads, and I saw many helpful people, so I hope someone can help me too.

So, my question:

How do I have to use the freestored command. I'm planning to make a trash box, that will self-clean itself every day. I'm not sure it would be the right command, but as I read them all, I think it must be the right one.

Here, what I have tried
Spoiler >


The code above was used in the object_buildings.inf file at the script part of the big storage entry. My plan was to successfully empty the big storage, when i wake up.
Changeday was done, so as the speech part, but the storage wasn't empty.
Do i made a simple mismatch?Edited wrong file?
Or is it my totally misconception?

That's all for today, but I'm sure I will have more questions.
Thanks for answers, I appreciate any help...
"People choose the paths that grant them the greatest rewards for the least amount of effort."
13.10.10 09:59:40 pm
Up
Lion_Hearted
User
Offline Off
I don't know really how to help you since I haven't tried anything like that, but did you test your object in 'debug' mode?

hit ~ then type in "debug" without quotes, then sleep, and on the change day, then there might be a report in the ~ log that might help you...


you can also save the log into a txt by just typing "save" without quotes...

Just an idea that might help you...
View my models! Also, check out the realistic hunting and rotting meat system in my mod. Lion_Hearted's Mod
13.10.10 10:58:13 pm
Up
Sandman
User
Offline Off
Lion_Hearted has written:
I don't know really how to help you since I haven't tried anything like that, but did you test your object in 'debug' mode?

hit ~ then type in "debug" without quotes, then sleep, and on the change day, then there might be a report in the ~ log that might help you...


you can also save the log into a txt by just typing "save" without quotes...

Just an idea that might help you...


Thanks for answering. Debugged, but nothing useful. I will copy the log under a spoiler, just in case, but it seems to skip that command...

Spoiler >


Anyway, i made a trashbox, but it's a bit complicate (mainly editing). It's a simple box, and a trade window appears on:use. Players are able to choose a category (foodstuff;woodstuff...etc) and trade the corresponding items to 'nothing'. The problem is, what if I have 4-500 unit of item to place in trash. Endless clicking...
Anyway, not a professional method, but at least "it works!"
"People choose the paths that grant them the greatest rewards for the least amount of effort."
13.10.10 11:29:12 pm
Up
Hurri04
Super User
Offline Off
Sandman has written:
Here, what I have tried
spoiler has written:
on:changeday {
     freestored "item", 214, "all";
     speech "positive";
}


the two parameters I marked boldly are the ones that cause the error.

the first parameter is about the class of the "thing" (usually an object) where the item is stored, but you wrote "item" which is wrong because the item isnt stored in another item. to correct this you would have to write "object" instead.

the second parameter is about the ID of the specific object which you dont necessarily know unless you write the script right into the object's scriptbox in the editor. but as you write this into a definition file you dont know it.
so one way to get the ID would be to use another command before that script line:
Code:
1
$id=currentid();
this is the first way; the script line gives you a feedback about the current ID of the certain object and saves it into a variable called "$id".
afterwards you could write the name of the variable right into the script line:
Code:
1
2
3
4
5
on:changeday {
     $id=currentid();
     freestored "object", $id, "all";
     speech "positive";
}


the second way is a little easier.
instead of writing the class and the ID of the object into a script that is executed "within" the object itself, you can also write "self" instead of the two parameters "class" and "id" in nearly any case where they appear together in commands:
Code:
1
2
3
4
on:changeday {
     freestored "self", "all";
     speech "positive";
}
edited 1×, last 14.10.10 01:58:14 pm
14.10.10 08:47:03 am
Up
Sandman
User
Offline Off
Thank you so much, it works like a charm.
As I spend more and more time with scripting, I will surely have questions. Now I know, where to go!
"People choose the paths that grant them the greatest rewards for the least amount of effort."
15.10.10 10:08:17 pm
Up
Lion_Hearted
User
Offline Off
People go through tons of hours making maps, setting infos, and making certain aspects look fascinating, and in an overall making a map look handmade...


But, I was thinking,

Could I make a map generator, that specifically made things so that they looked hand-made...


Like...

On a very low ratio, I could make the land shape itself into a mountain, and then as a compound event, I would make most rocks found only on high mountains, together with iron deposits... so, like every once in a while you'll come across a mountain that has rocks all over it with iron deposits hidden in it... I would also program it so that the mountain had a color change of grey, or everything above a certain height changed colors to something greyish...

Or, also, I could add a freshwater info to a certain ratio, and where the freshwater info was, the ground would lower itself so that there would be a pond... and there would be brown color around the pond.

This also includes diffrent spawn ratios like, where there was a spawn info for grain, lots of grain would appear around that spawn point, and the ground would look golden...




But,

Thats beside the point, is that possible...

And if so, could someone give me example scripts on how to change the color of the ground, and, how to lower and raise the ground?
View my models! Also, check out the realistic hunting and rotting meat system in my mod. Lion_Hearted's Mod
15.10.10 10:36:36 pm
Up
Vectarrio
User
Offline Off
@Lion_Hearted
I wanted to make rivers generator with that commands, I mean cmds:
s2 cmd terrain - thats for river
s2 cmd terraintexture for color changing, but colors are generated for WHOLE map only
15.10.10 11:20:52 pm
Up
Lion_Hearted
User
Offline Off
So, Vectar, your saying that the terrain texture cannot be changed for just a specific location? It has to be changed for the whole map?



Edit:

I've created a script that will place a projectile inside an animal on impact...

I've only tested it with the spear...


You throw the spear, and it embeds itself inside the animal, and you can get it back when you examine the animal's inventory...



But,

I'm not too sure if I got the free variable commands right... Could someone confirm that for me please?

Sorta new at using variables...

script=start
     on:impact {
          $tmp=impact_class();
          $tmp2=impact_id();
          //+14 Bonus Damage on Flesh
          if (compare_material($tmp,$tmp2,"flesh")==1){
               damage $tmp,$tmp2,14;
               addstate $tmp,$tmp2,"bleeding";
               statevalue $tmp,$tmp2,"bleeding",6;
          local $tmp3;
          $tmp3=create("item",200,0,0,1);
          store $tmp3,$tmp,$tmp2;
          freevar $tmp3;
          }
          elseif (compare_material($tmp,$tmp2,"flesh")==0){
                    $tmp=create("item",200);
                    setpos "item",$tmp,impact_x(),impact_y(),impact_z();
                    setrot "item",$tmp,0,getyaw("unit",1),0;
freevar $tmp;
freevar $tmp2;
}

script=end


It works fine without any error reports on stranded 2's debuging menu...


But, my question is, does the freevar work?
edited 1×, last 17.10.10 06:04:03 pm
View my models! Also, check out the realistic hunting and rotting meat system in my mod. Lion_Hearted's Mod
18.10.10 03:41:44 pm
Up
Xaeveax
User
Offline Off
Ok I know this is a silly question but oh well. What is the scripting for riding? Like, riding a raptor? I know its in the .inf somewhere but I can't seem to get the right one. What I'm trying to do is make a raptor that I can ride and never fall off, and make sure that it wont attack me. Anyone got a script for that? I would really appreciate it!

Edit: I also want it to happen without the raptor needing to be tame. (I can just set the behavior to normal so thats ok)
18.10.10 04:01:42 pm
Up
Lion_Hearted
User
Offline Off
Haven't tested it, but I think this might be what your looking for...



### Raptor
id=2
name=Raptor
group=animal
icon=gfx\raptor.bmp
model=gfx\raptor.b3d
scale=0.5
colxr=15
colyr=30
behaviour=animal
health=110
speed=2.5
eyes=10
turnspeed=3.0
ani_idle1=4,8,0.02
ani_move=2,3,0.06
ani_die=8,11,0.05
ani_attack=12,16,0.07
sfx=raptor
acceleration=0.08
maxdepth=35
loot=9,3
loot=94,8
loot=95,4
loot=96,1
script=start
     on:use { ride; }
     on:kill {
          event "iskill_hunt","global";
     }
script=end





Tell me if it doesn't work and I'll debug it... I didn't really pay much attention to detail while doing it...



Now for a question of my own,

How do I make the left shift (number 42) into a key...

I want to make it so on left shift, or even the middle mouse button, I run...

But...

I can't figure out how to bind a new key...
View my models! Also, check out the realistic hunting and rotting meat system in my mod. Lion_Hearted's Mod
18.10.10 04:02:46 pm
Up
Hurri04
Super User
Offline Off
Code:
1
2
3
on:use {
     ride;
}

this should do the job.
just write the script into the scriptbox of the raptor in the editor and add the tamed-state to it.
18.10.10 04:07:29 pm
Up
Xaeveax
User
Offline Off
Alright awesome it worked lion_hearted! Sweet. Now I just need one more thing... hmmm.. meh ill post it here. Is anyone able to make (or rather copy) a raptor model except with an external texture? (so that i can go in and make my own texture for it) The only modelling program I have is Blender, and it doesnt export to the files stranded reads, so I can't edit textures on raptors and other such things. Anyone able to do this?
18.10.10 04:25:01 pm
Up
Hurri04
Super User
Offline Off
Lion_Hearted has written:
Now for a question of my own,

How do I make the left shift (number 42) into a key...

I want to make it so on left shift, or even the middle mouse button, I run...

But...

I can't figure out how to bind a new key...


you have to edit the game.inf to make a new key.

write this before the line "script=start":
Code:
1
scriptkey=00,Sprinting

instead of "Sprinting" you can choose any other name you like, but this is only what the function is called in the options where you set a certain key.

also, you can increase the 00 to 01, 02 and so on if you are going to make more keys.

then you have to write this below the line "script=start":
Code:
1
2
3
4
5
6
7
8
9
10
11
12
on:keyhit00 {event "startsprint", "global";}

on:startsprint {
     < put your script to start the running-process here >
}


on:keyrelease00 {event "stopsprint", "global";}

on:stopsprint {
     < put your script to stop the running process here >
}


save the game.inf and start the game, then go to the options and set a specific key for the Sprinting script.
edited 1×, last 18.10.10 05:43:59 pm
18.10.10 05:31:33 pm
Up
Lion_Hearted
User
Offline Off
Awesome man!

Awesome!


/Lion_Hearted hugs Hurri, then quickly lets him go...


You smell... stranded...

Thanks, it worked perfectly!

I'm still curious as to wither or not I correctly freed the variables in my last script...


script=start
on:impact {
$tmp=impact_class();
$tmp2=impact_id();
//+14 Bonus Damage on Flesh
if (compare_material($tmp,$tmp2,"flesh")==1){
damage $tmp,$tmp2,14;
addstate $tmp,$tmp2,"bleeding";
statevalue $tmp,$tmp2,"bleeding",6;
local $tmp3;
$tmp3=create("item",200,0,0,1);
store $tmp3,$tmp,$tmp2;
freevar $tmp3;
}
elseif (compare_material($tmp,$tmp2,"flesh")==0){
$tmp=create("item",200);
setpos "item",$tmp,impact_x(),impact_y(),impact_z();
setrot "item",$tmp,0,getyaw("unit",1),0;
freevar $tmp;
freevar $tmp2;
}

script=end
View my models! Also, check out the realistic hunting and rotting meat system in my mod. Lion_Hearted's Mod
18.10.10 05:47:10 pm
Up
Hurri04
Super User
Offline Off
so... what's this script for exactly?
18.10.10 06:25:11 pm
Up
Lion_Hearted
User
Offline Off
Its rather unrealistic that a spear would break real life after hitting something...

Its also hard to get a spear when a lion or raptor or literally any kind of animal falls ontop of it when you shoot them down...

Same goes for arrows...


So that script does this...


script=start
##Obviously starting the script##
on:impact {
## when the spear hits something...##
$tmp=impact_class();
$tmp2=impact_id();
##It grabs the class, and the ID, and stores them in variables...**
if (compare_material($tmp,$tmp2,"flesh")==1){
##If the spear hit a flesh material, or... in other words, an animal...**
damage $tmp,$tmp2,14;
##It causes 14 more damage then it would cause if it hit a different material##
addstate $tmp,$tmp2,"bleeding";
statevalue $tmp,$tmp2,"bleeding",6;
##Naturally when an animal gets pierced by a spear or arrow or anything for that matter, it bleeds...##
local $tmp3;
##A variable that is set for only this projectile...##
$tmp3=create("item",200,0,0,1);
store $tmp3,$tmp,$tmp2;
##The variable creates another spear, (ID 200) and stores that spear in the class ($tmp,) and ID ($tmp2,) of the animal...##
freevar $tmp3;
##This frees up the local variable, to prevent the CPU from getting lagged up because of useless variables using up memory space...##
}
##now starts a new enviroment...##
elseif (compare_material($tmp,$tmp2,"flesh")==0){
##One in which the material that the spear hit is not flesh...##
$tmp=create("item",200);
##the class ID of the material hit creates another spear##
setpos "item",$tmp,impact_x(),impact_y(),impact_z();
setrot "item",$tmp,0,getyaw("unit",1),0;
##And it sets the spear right at the position where the spear made its impact, and rotates the spear so that it is contrary to unit 1 (the player)**
freevar $tmp;
freevar $tmp2;
##Now here is where I'm worried that my Freevariables didn't actually free the variables... I just need to know if the variables are actually erased, or do I have to switch the position of the freevars around before they work... or do they work already... Psytechnic's modviewer doesn't register any bugs, and neither does the game... however, I want to know if about 300 spear throws down the road the game is gonna quit because of so many variables locking up the system...##
}

script=end


Explained...


And, just in case your wondering what is going to replace the hunting skill value, I've picked a more realistic way...

I'm going to implement a critical hit system to each of the animals... there's going to be 3 ways of hitting an animal... grazed, wounded, and critical shot. At a low hunting skill, your more likely to graze an animal, and have to kill it with multiple hits and shots before actually bringing it down... with a medium skill ratio, your now alot more likely to wound it, and while causing it much more damage then grazing it, you'll most likely have to shoot twice before actually killing it... with a high skill level, you'll be able to critically hit it about half the time, a critical hit will take a fantastically damaging hit...

That simulates real life,

As in real life, in hunting, either you totally miss, (that would be the fault of the player in this case...) or you graze it, (low hunting skill,) or you wound it, and have to track it, (medium hunting skill,) or you hit it in the lungs or heart, or head, (high hunting skill,) and don't have to worry about it coming after you at all.

And... in real life... rarely does a beginner score one of those lung hits... however a pro who knows what he's doing, is pretty sure to get a wounded animal, and pretty good at making it a fatal shot too...
View my models! Also, check out the realistic hunting and rotting meat system in my mod. Lion_Hearted's Mod
18.10.10 06:48:17 pm
Up
Hurri04
Super User
Offline Off
well, you could try to put the names of the variales into quotation marks and you can also put multiple names into one freevar command:
Code:
1
freevar "$tmp", "$tmp2";


but I dont think those few variables would make any problem. I already run Stranded 2 with way over 500.000 variables without any problem!

but if the freevar command still doesnt work you might try this:
Code:
1
temp "$tmp", "$tmp2";

writing this instead of the freevar command should make the local variables temporary which means that when saving and loading the game the variables wont be saved.


the stuff about the improved hunting system sounds really nice.
but you really shouldnt worry about a few more or a few less variables that are saved, they dont really make a difference.
To the start Previous 1 2 ... 108 109 110 ... 121 122 Next To the start