Forum

> > Stranded II > General > Builder's Prototypes (updated with dungeons...)
Forums overviewStranded II overviewGeneral overviewLog in to reply

English Builder's Prototypes (updated with dungeons...)

15 replies
To the start Previous 1 Next To the start

old Builder's Prototypes (updated with dungeons...)

Builder2-0
User Off Offline

Quote


I made this thread to list various prototype systems\concepts I've implemented but probably will not make a full use out of due to time\resource constraints.

1. Weapon Animations
http://www.youtube.com/watch?v=umqHcSttr_A

This was actually hilariously easy to do once I figured out the syntax for the s2 cmd image command. Basically, for the weapon of your choice (I chose the pickaxe for... specific reasons, to be revealed later in this thread probably) you add this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
on:attack1 {
		timer "self",1,1,"weaponanim";
	}
	on:weaponanim {
		$loop++;
		timer "self",100,1,"weaponanim";
		image 19, "gfx/mm/tools/frame01.bmp",300,0,1;
		if ($loop==1){
			image 19, "gfx/mm/tools/frame02.bmp",300,0,1;
		}elseif ($loop==2){
			image 19, "gfx/mm/tools/frame03.bmp",300,0,1;
		}elseif ($loop==3){
			image 19, "gfx/mm/tools/frame04.bmp",300,0,1;
		}elseif ($loop==4){
			image 19, "gfx/mm/tools/frame03.bmp",300,0,1;
		}elseif ($loop==5){
			image 19, "gfx/mm/tools/frame02.bmp",300,0,1;
		}elseif ($loop==6){
			image 19, "gfx/mm/tools/frame01.bmp",300,0,1;
			freetimers "self";
			timer "self",1,1,"weaponanim";
		}elseif ($loop==7){
			image 19, "gfx/mm/tools/transp.bmp",300,0,1;
			freetimers "self";
			$loop=0;
		}
	}

I can't seem to figure out if there is an "OR" command in S2script, if there is then you could trim this script down considerably. But, more interestingly is if you implement a local random variable then bridge off into some if\elseif\else based on the result, you can have however many different weapon strikes\animations as you want, and one will be chosen randomly.

If you don't want to clutter up your item .inf files you could always use s2 cmd extendscript to hide the "animation" part in a separate file. And if you want the animation to fit the screen throughout different resolutions you'll have to use s2 cmd getsetting.

Making the frames is the hardest part by far. I did a really bad job on my concept frames, but then again I made them all using a single pic.

A few prototypes I'm currently working on and will add to this thread when I finish with my tests:
-Shields
Current theory is on holding rmb (attack2), trigger either invuln, or store the health of the player then up it considerably and restore it when rmb is let go. Obviously needs chances of your block to be disrupted\broken through.

-"Special" attacks
Not really sure how these will work at all. My idea was for some detections\count_inrange to determine how many critters are around you and the health of them. Then if there was say, only 1, and the health was under a certain amount, by moving backward and left clicking you would execute a special move. IE; Hurling a sword at a wounded lion to finish it off.

-Dungeons
Look down the thread.

-Physic based resource collection
Basically instead of hitting trees\rocks\whatever and the material goes straight into your inventory, it flies off in chunks\projectiles. So if you're mining a rock then there will be stones and pebbles and ore getting knocked off of it. Creatures will be harvested not through inventory, but by cutting\skinning.
edited 2×, last 22.07.09 08:39:53 am

old Re: Builder's Prototypes (updated with dungeons...)

Vibhor
User Off Offline

Quote
That weapon is Falchion(believe me spended time with that one a lot)

It is very cool indeed builder should also make 3d weapons
like mod gradira

in it you can also wear clothes and it changes the hand of the player when holding weapon
edited 1×, last 19.07.09 06:01:51 pm

old Re: Builder's Prototypes (updated with dungeons...)

Builder2-0
User Off Offline

Quote
I just looked into how Gradira does 3d weapons (and I assume V666 as well). I don't like the method.

Simply put you spawn a model at the player, then set it's position and rotation in such a way that it is "held" by you, and then re-run that script every few milliseconds to keep it in sync.

So effectively, you've got ~20-30 lines of script running every 30 milliseconds.

But even at that speed, when you move it looks like a strobe effect is going on. The weapon flashes in out of existence, it lags behind, trying to re-sync in time with the player's movement speed. The effect is more disorientating and distracting than aesthetically pleasing.

old Re: Builder's Prototypes (updated with dungeons...)

Vibhor
User Off Offline

Quote
I liked it and it works fine
there were no problems with it
I know how to do it
With your trick of showing image i have an idea of 3d attack and and the weapon holding
Actually the problem is that when you hit the hand doesnt
move so it will be better with your idea

old Re: Builder's Prototypes (updated with dungeons...)

Amritsar
User Off Offline

Quote
Holy damn Builder, that pickaxe thing was cool. I remember a little while ago everyone was saying that stuff like that would never happen, physically impossible due to the source code.

Not the most incredibly realistic animation and the style of the pickaxe is horribly different from Stranded graphics but I think it's a hell of an accomplishment.

old Re: Builder's Prototypes (updated with dungeons...)

Builder2-0
User Off Offline

Quote
Dungeons:
Right, so basically what we have here is this;

A structure, that when used, teleports you to another map (possibly built to resemble a dungeon, but it could be anything, ie; a ship teleporting you to another island).

For the sake of not-fucking-shit-up, and keeping possible bugs to a minimum, this structure should either be a building, or an object. Making it an item will result in untold horrors, like velociraptors leaping through your monitor and eating you.

To continue, you can explore this other map as you wish. Destroy stuff. Build stuff. Gain skills. Lose health. Ect.

Through a structure on this other map (hopefully built in by default...) you can travel back to the original map.

Oh yea, I totally forgot to mention that currently health\thirst\hunger\sleep isn't saved, but that's easy to do. It's like 4 lines.

So here is the code for the first structure (the "entrance" on map 1):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
on:use {
//id creation is hard to explain, I'll do it later
		event "idcreation";
//this is used before you've entered the "other" map
		if ($time <= 0){
			$savedx=getx("unit",1);
			$savedy=gety("unit",1);
			$savedz=getz("unit",1);
			$time=1;
			savemap "maps\data\gameid $s2g_id.s2",0,0,0,0,0,0;
			loadmap "maps\dungeon\01.s2",1,1,1,1,1,1;
//and this used after you've used it once
		}elseif ($time == 1){
			$savedx=getx("unit",1);
			$savedy=gety("unit",1);
			$savedz=getz("unit",1);
			savemap "maps\data\gameid $s2g_id.s2",0,0,0,0,0,0;
			loadmap "maps\data\dung01 $s2g_id.s2",1,1,1,1,1,1;
		}
	}
	on:idcreation {
//ID creation stuff goes here
	}
	on:load{
//if you are coming back via the exit structure
//it teleports you to where you entered from
		if ($dungeonused == 1){
			setpos "unit",1, $savedx,$savedy,$savedz;
			freevar $savedx,$savedy,$savedz,$dungeonused;
		}
	}

And here is the code for the exit (on map 2):
1
2
3
4
5
6
on:use {
//"$dungeonused" is to determine when you are coming back to map 1 via this exit
		$dungeonused=1;
		savemap "maps\data\dung01 $s2g_id.s2",0,0,0,0,0,0;
		loadmap "maps\data\gameid $s2g_id.s2",1,1,1,1,1,1;
	}

So you are probably wondering what this "$s2g_id" is. Well, basically it is what I use to keep different games seperate. Not saved games, not maps. But games.

Imagine Stranded 2 as a road. Everytime you start a new island, or random map, or adventure, you create a new path that forks off of the road.

Each of those paths is a different "$s2g_id". Although technically, the $s2g_id is not generated until it's needed (the first time you use the entrance structure).

What this allows is saving\modifying\loading of maps without actually messing them up across different games. Now, for obvious reasons this ID needs to be unique to every game. I couldn't think of any good way to generate a unique ID easily, or effectively, or simply, so instead I opted for the next best method:

A bunch of damn-near random variables. Luckily, this script only runs *once*. So here it is, my best bet for making a random ID:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
on:idcreation {
		if ($s2g_mapid == 0){
			local $i,$x,$y,$z,$day,$hp,$h,$s,$t,$cskill,$fskill,$skill,$w,$gt,$hr,$m,$map,$px,$py,$pz,$r1,$r2,$r3,$mapid;
			$i=currentid();
			$x=getx("self");
			$y=gety("self");
			$z=getz("self");
			$day=day();
			$hp=getplayervalue(1);
			$h=getplayervalue(2);
			$s=getplayervalue(4);
			$t=getplayervalue(3);
			$cskill=skillvalue("fish");
			$fskill=skillvalue("hunt");
			$sskill=skillvalue("wood");
			$w=getweather();
			$gt=gt();
			$hr=hour();
			$m=minute();
			$map=mapsize();
			$px=getx("unit",1);
			$py=gety("unit",1);
			$pz=getz("unit",1);
			$r1=random(1,999);
			$r2=random(1,999);
			$r3=random(1,999);
			$mapid=(((($i*10)+($x+$y+$z)+($px+$py+$pz)+$r1+$r2+$r3+$map+$m+$hr+$gt)*($w+1))+($cskill+$fskill+$sskill)+$day+($hp*10)+($h+$s+$t));
			$s2g_id=abs($mapid);
			freevar $i,$x,$y,$z,$day,$hp,$h,$s,$t,$cskill,$fskill,$sskill,$w,$gt,$hr,$map,$m,$px,$py,$pz,$r1,$r2,$r3,$mapid;
		}
	}

The variables used in generation of the $s2g_id:
The x, y, z of the structure. The x, y, z of the player. 3 random numbers, each anywhere from 1-999. The map size. The hour. The day. The minute. The game time in milliseconds. The weather. The "wood" skill. The "fish" skill. The "hunt" skill. The day. The local ID of the structure. The health, hunger, thirst, sleep of the player.

So yea. If you *somehow* managed to get a duplicate ID, congratz on breaking the system.

Anyway, some examples on possible application of this:
You could build a ship, that when used, teleports you to another island map. And then the ship on that map can be used to teleport back to the original map.

You could have a chance for a random "dungeon" entrance to spawn on random islands. The entrance brings you into a special map modeled like a dungeon with cool stuff in it.

Ect.

A note;
This script is *only* for if you want the player to be able to travel between the two maps freely, while modifying them.

If you just want to teleport the player:
loadmap "maps\MAP.s2",1,1,1,1,1,1;

Done. If however you want the player to be able to build a hut on island 1, travel to island 2, drop a stone, and go back to island 1 where the hut still stands, then head back to island 2 where the stone still rests...

That is what this script is for. I just called it "Dungeons" because that is originally what I was playing around with. Yay for prototyping.

old Re: Builder's Prototypes (updated with dungeons...)

Vibhor
User Off Offline

Quote
What a F***in idea

does it works?
how will you make it random loading?
If you make random dungeon in a map woudnt it be random every time you load it?
if its a ship dungeon then how about a under water temple
in which the player has to swim a lot?
If you are making dungeon then make sure to decrease the attack rate of the animal and monsters

and the last thing
uhhh.....
You should make equipments like shield,sword etc just like a RPG(YAY RPG fan rocks)

old Re: Builder's Prototypes (updated with dungeons...)

Builder2-0
User Off Offline

Quote
Vibhor has written
What a F***in idea

does it works?
how will you make it random loading?
If you make random dungeon in a map woudnt it be random every time you load it?
if its a ship dungeon then how about a under water temple
in which the player has to swim a lot?
If you are making dungeon then make sure to decrease the attack rate of the animal and monsters

and the last thing
uhhh.....
You should make equipments like shield,sword etc just like a RPG(YAY RPG fan rocks)

...

1. Yes. It works. That is what all that fucking code does. It makes it work. *facepalm*

2. It's not a random map.

3. I will not be using this code (...much). I merely posted it here if others wish to make use of it.

old Re: Builder's Prototypes (updated with dungeons...)

Amritsar
User Off Offline

Quote
Wow Builder, that's a hell of a job to just give out, that's pr cool man.

Out of curiosity though, what is the variable to and from? What's the chance of getting the same thing and totally screwing yourself over?

But this is seriously some amazing work. Congratulations Builder

old Re: Builder's Prototypes (updated with dungeons...)

DontKnowToScript
User Off Offline

Quote
thats an amazing,yes really,number of lines to write.for builder,its like writing about 10 lines with a pencil
but im sure its very damn exhausting.
anyway,congratz on writing these billion tons of lines. (Medal:advanced writer!:write a billion lines of code!)

old Re: Builder's Prototypes (updated with dungeons...)

Ominus
User Off Offline

Quote
there we go, cleaned all the dust off.
Anyway, i got a question about the on:idcreation script.
Where should i put it? I put it into game.inf but i dont think it worked as the id of the saved maps was 0 ( only tried once though)

But i must admit, it looks awsome going from your mine entrance into an undergound cave like map, heres some pictures, hoping it will calm down anyone that might be angry for me reviving a month old thread

One moment ur at the mine entrance
http://img.photobucket.com/albums/v162/Infidel/Stranded%202%20dev/screen_00011.jpg
(yes the dirt pile is missing the dirt texture, forgot to move it to the proper folder :P)


The next ur underground cursing for forgetting to put the return script to the exit lol
http://img.photobucket.com/albums/v162/Infidel/Stranded%202%20dev/screen_00012.jpg


EDIT: Nevermind, even though i read 3 times through your post i only noticed it when i was looking for something totally different in your script

Now i feel like an idiot for reviving a month old thread
edited 2×, last 23.08.09 06:41:45 pm
To the start Previous 1 Next To the start
Log in to replyGeneral overviewStranded II overviewForums overview