Forum

> > Stranded II > Scripts > Exchange with Campfire
Forums overviewStranded II overview Scripts overviewLog in to reply

English Exchange with Campfire

6 replies
To the start Previous 1 Next To the start

old Exchange with Campfire

Zandorum
User Off Offline

Quote
Ok so I made it so the campfire works like 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
28
29
30
31
32
script=start
	on:build_finish {
		event "campfirebuild",0,0;
	}
	on:use {
		if (gotstate("unit",1,6)){
			if ((gotstate("self",4)+gotstate("self",5))>0){
				process "warm-up",3000;
				freestate "unit",1,6;
			}else{
				dialogue "start","sys/scripts/campfire.s2s";
			}
		}else{
			dialogue "start","sys/scripts/campfire.s2s";
		}
	}
	on:barkbranchfire1 {
		$tmp=currentid();
		if (distance("unit",1,"object",$tmp)<100){
			if ((gotstate("object",$tmp,"fire")+gotstate("object",$tmp,"eternalfire"))==0){
				$barkbranchfire=$tmp;
			}
		}		
	}
	on:addstate {
		if (state()==4){
			statevalue "self",4,0;
		}elseif (state()==5){
			statevalue "self",5,0;
		}
	}
script=end

What I want to do is when it opens the Menu which is setup like this:
1
2
3
4
5
6
7
page=start
title=Campfire
text=start
This is a Campfire, you put fuel into the campfire to keep it going.
text=end
button=action:close,Use Campfire
button=action:close,Leave

When I click Use Campfire it uses this command on it self:
exchange "self",1,7,24,25,107;

I have no idea how to do this.

Oh also how would I manipulate Items inside of a inventory and how would I go about making a timer. Sorta want the player to put fuel into the Campfire then have it slowly burn it up based on whats inside it taking more or less time to keep the fire going, then when it runs out going out and not being able to be setup again until you put more wood into it. Lastly how would one go about changing an objects model on the fly so when it would have no wood it would change model to my only rock circle model?

Thanks in Advance.

old Re: Exchange with Campfire

Hurri04
Super User Off Offline

Quote
check out these commands:
s2 cmd exchange
s2 cmd timer
s2 cmd model

your "barkbranchfire1" event doesnt make much sense to me.

for the "Use campfire" button check out s2 cmd dialogue.
the best thing to do would be to link to another page instead of "action:close". that page then should only have a script to call a timer which is run 1 time with 1 millisecond delay. call s2 cmd closemenu afterwards.
the timer should trigger a new event in which you then can use the exchange command to open the exchange menu.

for the timer that uses up the wood in the fire simply set the time to 60000 milliseconds which is 1 minute which is 1 ingame-hour. use s2 cmd freestored to decrease the amount of wood stored.

old Re: Exchange with Campfire

Zandorum
User Off Offline

Quote
The barkbranchfire1 thing is vanilla also Thank you!

Oh and what are all the On: Events? I cant find anything about it.

old Re: Exchange with Campfire

Hurri04
Super User Off Offline

Quote
that's vanilla? strange, it still doesnt make sense to me but then again I didnt look it up again now

basically the s2 cmd event command fires an event and s2 cmd on catches it.

old Re: Exchange with Campfire

Giftgnom
User Off Offline

Quote
I have another idea: you could set the statevalue to 1 and then you could make an on:kill-event (no clue if this works, when the player doesn't destroy it) and create 10 stones at the position of the campfire....

old Re: Exchange with Campfire

Hurri04
Super User Off Offline

Quote
that wont work because the fireplace is an object and not a unit.

but if you'd want to do some cool stuff with the fireplace I think it should be possible to create a number of stones lying around the fireplace in a circle as items and adding scripts to them so that on:collect they notify the fireplace object that a stone has been removed.

then when the timer triggers to use up some fuel, you could have a small chance that nearby objects catch fire based on how many stones you have removed.

for this thing it might be best to replace the normal campfire with the fireplace without the stone border though.

also, to put the icing on the cake you could give the stones and fuel-items a throw-behaviour so that the player can take them into his hand, aim and throw them and if he hits a fireplace then the wood/stones are added to the fireplace.
alternatively you could just make this trigger when the player has the item in his hand and uses the fireplace which might actually be better if I think about it now...

just dropping a few ideas if you guys are interested in getting a deeper look into scripting in S2

old Re: Exchange with Campfire

Giftgnom
User Off Offline

Quote
i thought it would be possible on objects because in the commandlist stood "killing/destruction"

> Just tested it out it is really not possible
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview