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 286 87 88121 122 Next To the start

old Re: Scripting Questions

neek49
User Off Offline

Quote
oky im making a balista and welll im just lerning script as i go so how do i get it to take an item out of my inven wehn i hit it?script pleas some one? o_Oo ya and an eeror meseg if i dont have the item
edited 1×, last 05.02.10 06:17:44 am

old Re: Scripting Questions

Vectarrio
User Off Offline

Quote
Vibhor has written
it really makes unit go back
but the projectile speed is the same

EDIT:It also increases speed of everything
it even increased my speed

I don't know about projectile.
But I really forgot that you are unit too
Try that:
1
2
3
4
5
6
7
8
on:keyhit|yourkeyID|{
     loop ("units"){
	if(loop_id()>1){
         	 addstate "unit",loop_id(),"speed";
       		 statevalue "unit",loop_id(),"speed",-1;
  		}
	}
}
If not, then this:
1
2
3
4
5
6
7
8
on:keyhit|yourkeyID|{
     loop ("units"){
	if(loop_id()>1){
         	 addstate "unit",loop_id(),7;
       		 statevalue "unit",loop_id(),7,0;
  		}
	}
}
Also try to change this 7 to 6, or speed value(-10 or -1) to 0.

EDIT: Yep, and if you want projectiles, maybe you can change it this loop "units" to "items".

old Re: Scripting Questions

Vibhor
User Off Offline

Quote
cant i add items with units too?
going to test it now

EDIT:the first one makes unit moon walk :p
but the second one doesnt work
i have another idea that it will change behavior to stand idle
but it wont stop the movement of player
i just want to stop movement of player and units
projectile not necessary for now
can i even change behavior of units via commands in editor?

old Re: Scripting Questions

Vectarrio
User Off Offline

Quote
s2 cmd ai_stay !
Put this instead of states in loop:
1
ai_stay loop_id(),1;
And when finish of time stop,
1
ai_stay loop_id(),0;
in loop of cource.
And delete the "if" thing, because it is to avoid player changes.
I don't know how to stop player.

old major workload

Flametail
User Off Offline

Quote
I have notice when building maps that I cannot enter a house in maps that i make. please tell me how to edit the configs to allow me to enter a house and close the door behind me. If you find it easy or just want to do it, maybe add a key to it, so that I need a key to operate the door.

For the hard part of this post, I would like to know how to edit the configs to allow me to build a house, to build a yacht and allow said yacht to hold things.

old Re: Scripting Questions

Vectarrio
User Off Offline

Quote
White house? This model is not made for "entering", you cannot. It is not a bug, and you cannot do anything, only create new model

What new command are in multiplayer? (i know only send, play3d)
edited 1×, last 05.02.10 04:46:32 pm

old Re: Scripting Questions

Vibhor
User Off Offline

Quote
Flametail has written
I have notice when building maps that I cannot enter a house in maps that i make. please tell me how to edit the configs to allow me to enter a house and close the door behind me. If you find it easy or just want to do it, maybe add a key to it, so that I need a key to operate the door.

For the hard part of this post, I would like to know how to edit the configs to allow me to build a house, to build a yacht and allow said yacht to hold things.


House is not enterable
you have to be intelligent and use s2 cmd loadmap
as for the "hard part"
its quite easy
just study the buildings and object inf
as for the yatch
look for raft script in units

old Re: Scripting Questions

Flametail
User Off Offline

Quote
Vectar666 has written
White house? This model is not made for "entering", you cannot. It is not a bug, and you cannot do anything, only create new model


Vibhor has written
Flametail has written
I have notice when building maps that I cannot enter a house in maps that i make. please tell me how to edit the configs to allow me to enter a house and close the door behind me. If you find it easy or just want to do it, maybe add a key to it, so that I need a key to operate the door.

For the hard part of this post, I would like to know how to edit the configs to allow me to build a house, to build a yacht and allow said yacht to hold things.


House is not enterable
you have to be intelligent and use s2 cmd loadmap
as for the "hard part"
its quite easy
just study the buildings and object inf
as for the yatch
look for raft script in units


ok, as for the house, thats why I am asking. I would like to make the house enterable. even if its cheasy like click the door and magically you are there. There doesnt have to be anything special. I just have to be able to go inside. even if it looks bad.

vectar666: I have no idea where to even begin to create an enterable model.


EDIT: Following your hazy instructions, the player can now build a house and a yacht that holds 1M. now we just have to figure out the house.....
edited 1×, last 05.02.10 10:22:03 pm

old Re: Scripting Questions

Psytechnic
User Off Offline

Quote
Flametail has written
I would love that


There is a much simpler way, but slightly more bloated.
Have the house with an on:use function to free the current object (with a closed door) and replace it with an identical house with an open door. It's cheesy, but it works. This does mean that you can't add objects to the house with different functions (like a cooker or something).

To do that, you could set the house object on:use to loadmap of a saved house inner. This is more complicated but more rewarding as you will be able to have various objects within the house that do various things.

old Re: Scripting Questions

Flametail
User Off Offline

Quote
hmm, I will start with vectar666's idea about replacing the current house model with an enterable one, because it suits my needs. But I won't forget your second idea, in case I need/want something more.
edited 1×, last 06.02.10 05:37:46 pm

old Re: Scripting Questions

Vibhor
User Off Offline

Quote
Flametail has written
hmm, I will start with vectar666's idea about replacing the current house model with an enterable one, because it suits my needs. But I won't forget your idea, in case I want something more.


actually psytechnic's idea is much better and easy
you just need two commands
s2 cmd savemap and s2 cmd loadmap
fix it with an event and you will get a master piece

old Re: Scripting Questions

Vectarrio
User Off Offline

Quote
I meant Psytechnic's idea too. Replace with house with closed door(but it is normal inside, it will be new model), and on:use it replaces to other object or model.

old Re: Scripting Questions

Vibhor
User Off Offline

Quote
Vectar666 has written
I meant Psytechnic's idea too. Replace with house with closed door(but it is normal inside, it will be new model), and on:use it replaces to other object or model.


thats hard work
plus units wont be able to enter it

old Re: Scripting Questions

Vibhor
User Off Offline

Quote
Vectar666 has written
It replaces to open door
It is not hard work
1
2
3
on:use{
model "gfx\house.b3d"
}


i was talking about model
but since i dont get to do anything i am okay with everything

old Re: Scripting Questions

Flametail
User Off Offline

Quote
ok, another long post as I piece together what you are trying to do.

You want to replace the current model of the house with one that includes an interior, and have a second copy of that model but with an open door.

These new models will be scripted to function like a gate does. On use it switches the current model to the one with the open door and vice versa.

Pretty much, players uses the door by pressing {usekey}, the model of closed door house is replaced with model of open door house. Player enters the house via open door. Player can then turn around and hit {usekey} and the model of open door house is switched with closed door house, therebye shutting the player in the house.



NOTE: {usekey} is the key you press to use items, which for me is rightshift, but I forgot the defualt so I put {usekey} in the desription

old Re: Scripting Questions

Flametail
User Off Offline

Quote
ok, just wanted to be sure.

(on a sidenote: I've come to notice, if not on level terrain, the terrain usually juts up into a building, like with a hut. becuase of this, it seems advisable not to add flooring to the new models. If flooring is added, the terrain would just come through the floor anyway. Besides, if there is no floor, I can build torches and other objects inside the house.
To the start Previous 1 286 87 88121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview