PDA

View Full Version : Tiles You on


ZeekTheMan2
08-02-2006, 06:11 AM
Ok i am making a movement system but i dont really now how to tell what part of the tileset you are on so i can make the player sit on a chair can any one help me

Angel_Light
08-02-2006, 06:37 AM
i'm not positive but it's like

function onTimeout() {
if (ontiles(x,y) {
setani("sit","");
}
setTimer(0.05);
}

ZeekTheMan2
08-02-2006, 06:44 AM
i'm not positive but it's like

function onTimeout() {
if (ontiles(x,y) {
setani("sit","");
}
setTimer(0.05);
}

yes but what part of the tiles like what x and what y you are on i cant fingure that out .

KuJi
08-02-2006, 07:39 AM
I do something similar to this:


// INCOMPLETE CODE \\
this.tile = tiletype(player.x + 0.5, player.y);
this.tile2 = tiletype(player.x + 1.5, player.y);

if (this.tile == 3 && this.tile2 == 3) {
setani("sit", NULL);
} elseif (this.tile == 4 && this.tile2 == 4) {
setani("sleep", NULL);
}


I don't know all the tiletypes by heart, go test them out. mk :p

ZeekTheMan2
08-02-2006, 08:06 AM
//function onActionServerSide() {
if (params[0] == "walking") {
clientr.walking = true;
}
if (params[0] == "not walking") {
clientr.walking = false;
}
//}
//#CLIENTSIDE

function onCreated() {
disabledefmovement();
this.walking = 0;
this.speed = .94568;
}
function onTimeout() {
if (clientr.walking == true){
client.walkingz --;
}
if (client.walkingz <= 0) {
triggeraction(0, 0, "serverside", "-System_Movement", "not walking");
setani("idle", NULL);
}
if (keydown(0)) {
triggeraction(0, 0, "serverside", "-System_Movement", "walking");
player.y -= this.speed;
player.dir = 0;
setani("walk", NULL);
client.walkingz = 2;
}
if (keydown(2)) {
triggeraction(0, 0, "serverside", "-System_Movement", "walking");
player.y += this.speed;
player.dir = 2;
setani("walk", NULL);
client.walkingz = 2;
}
if (keydown(1)) {
triggeraction(0, 0, "serverside", "-System_Movement", "walking");
player.x -= this.speed;
player.dir = 1;
setani("walk", NULL);
client.walkingz = 2;
}
if (keydown(3)) {
triggeraction(0, 0, "serverside", "-System_Movement", "walking");
player.x += this.speed;
player.dir = 3;
setani("walk", NULL);
client.walkingz = 2;
}
if (onwater(player.x + 1.5 + (vecx(player.dir)*0.1), player.y + 2 + (vecy(player.dir)*0.1))) {
setani("swim", NULL);
}
this.tile = tiletype(player.x, player.y);
this.tile2 = tiletype(player.x + 1.5, player.y);

if (this.tile == 3 && this.tile2 == 3) {
setani("sit", NULL);
}
elseif (this.tile == 4 && this.tile2 == 4) {
setani("sleep", NULL);
}
}
setTimer(0.05);
So this is what i got now and i need a little help on the onwall stuff and yea kuji they work just the sit one is a little off though. And i well be making the grab stuff when i get the on wall stuff done

KuJi
08-02-2006, 08:32 AM
//function onActionServerSide() {
if (params[0] == "walking") {
clientr.walking = true;
}
if (params[0] == "not walking") {
clientr.walking = false;
}
//}
//#CLIENTSIDE

function onCreated() {
disabledefmovement();
this.walking = 0;
this.speed = .94568;
}
function onTimeout() {
if (clientr.walking == true){
client.walkingz --;
}
if (client.walkingz <= 0) {
triggeraction(0, 0, "serverside", "-System_Movement", "not walking");
setani("idle", NULL);
}
if (keydown(0)) {
triggeraction(0, 0, "serverside", "-System_Movement", "walking");
player.y -= this.speed;
player.dir = 0;
setani("walk", NULL);
client.walkingz = 2;
}
if (keydown(2)) {
triggeraction(0, 0, "serverside", "-System_Movement", "walking");
player.y += this.speed;
player.dir = 2;
setani("walk", NULL);
client.walkingz = 2;
}
if (keydown(1)) {
triggeraction(0, 0, "serverside", "-System_Movement", "walking");
player.x -= this.speed;
player.dir = 1;
setani("walk", NULL);
client.walkingz = 2;
}
if (keydown(3)) {
triggeraction(0, 0, "serverside", "-System_Movement", "walking");
player.x += this.speed;
player.dir = 3;
setani("walk", NULL);
client.walkingz = 2;
}
if (onwater(player.x + 1.5 + (vecx(player.dir)*0.1), player.y + 2 + (vecy(player.dir)*0.1))) {
setani("swim", NULL);
}
this.tile = tiletype(player.x, player.y);
this.tile2 = tiletype(player.x + 1.5, player.y);

if (this.tile == 3 && this.tile2 == 3) {
setani("sit", NULL);
}
elseif (this.tile == 4 && this.tile2 == 4) {
setani("sleep", NULL);
}
}
setTimer(0.05);

Is complaining about the script allowed or no :(?

ZeekTheMan2
08-02-2006, 08:47 AM
go ahead i like to learn more anyways

KuJi
08-02-2006, 05:13 PM
SO what I gave you = works nice?

ZeekTheMan2
08-02-2006, 08:58 PM
Yes it works good

Yen
08-02-2006, 09:08 PM
Do you understand how often you're sending a trigger to the server?
Don't complain when your server crashes. >_>

... Come to think of it, why would you want whether or not the player is walking handled on the serverside?

xAndrewx
08-02-2006, 09:31 PM
Do you understand how often you're sending a trigger to the server?
Don't complain when your server crashes. >_>

... Come to think of it, why would you want whether or not the player is walking handled on the serverside?
I was thinking the same...

ZeekTheMan2
08-03-2006, 04:02 AM
i was thinking of doing somthing else when the player is walking but never mind about the script kuji gave me one but i have another question is there any way to shoot particles affects to hit some one or do i need a ganis or somthing

KuJi
08-03-2006, 04:42 AM
I didn't even understand the point of him commenting out the trigger on serverside o.o

contiga
08-03-2006, 08:02 PM
And if you'd realy want a string with "walking" or "not walking", you can also use client. (being set clientside), which in this case, doesnt need to be secure.