PDA

View Full Version : Help making a chest like npc.


colin012
03-30-2007, 05:19 AM
I can't seem to figure out how to make my npc function like a chest that gives you the gold sword. this is what I'v come up with so far:


// NPC made by Pants
if (created) {
setimg goldchest.png;
}

//#CLIENTSIDE
if (playertouchsme) {
lay goldensword;
setimg goldchest_open.png;
destroy;
}


Thanks for your help I'm very new to this.


I also have it glowing so I want to make it stop glowing when It gives up the gold sword. Heres the script for the glow:

// NPC made by Stefan Knorr
if (created) {
setimg light2.png;
dontblock;
}
//#CLIENTSIDE
if (playerenters) {
setcoloreffect 1,1,,0.25;
drawaslight;
}

Rapidwolve
03-30-2007, 05:22 AM
Uhh, are you developing this off line or online?
PS: this is in the wrong forum =o

colin012
03-30-2007, 05:25 AM
Uhh, are you developing this off line or online?
PS: this is in the wrong forum =o


Offline and what do you mean wrong fourm? I'm prety sure this is the gs2.

killerogue
03-30-2007, 05:25 AM
AFABHSGJBOGSBGDSGSD


THIS IS THE GS2. TWO. TWO Forums.

What's with everyone doing GS1? It's so inneficient. :(

colin012
03-30-2007, 05:27 AM
AFABHSGJBOGSBGDSGSD


THIS IS THE GS2. TWO. TWO Forums.

What's with everyone doing GS1? It's so inneficient. :(

:cry: I don't know these things! How do you tell?

killerogue
03-30-2007, 05:29 AM
AFABHSGJBOGSBGDSGSD


THIS IS THE GS2. TWO. TWO Forums.

What's with everyone doing GS1? It's so inneficient. :(


function onCreated() {

setimg( "whateverimage.png" );
setshape( 1,32,32 );
seteffect( 0,0,0,1 );
drawaslight();
}

//#CLIENTSIDE

function onPlayerTouchesMe() {

showani("openaniblah");
addweapon("whatever weaponyyouwanttoadd");
}




E: You should take the time to read the wiki. You can learn alot of things and it shows you differences between GS1 and GS2. Also, GS2 you cannot use offline. You can only use Gs1 in the editor thanks. :] -> http://wiki.graal.net and http://wiki.graal.us for your use in learning. God speed.

kia345
03-30-2007, 05:32 AM
AFABHSGJBOGSBGDSGSD
What's with everyone doing GS1? It's so inneficient. :(

people dont want to change. i got into scripting, learned basic gs1, and refuse to learn gs2.

it may be 'innefficient' but scripting is like languages, english (or others) is your first, you struggle abit with your second (gs1) and you dont give a damn about your 3rd (gs2)

colin012
03-30-2007, 05:32 AM
function onCreated() {

setimg( "whateverimage.png" );
setshape( 1,32,32 );
seteffect( 0,0,0,1 );
drawaslight();
}

//#CLIENTSIDE

function onPlayerTouchesMe() {

showani("openaniblah");
addweapon("whatever weaponyyouwanttoadd");
}




E: You should take the time to read the wiki. You can learn alot of things and it shows you differences between GS1 and GS2. Also, GS2 you cannot use offline. You can only use Gs1 in the editor thanks. :] -> http://wiki.graal.net and http://wiki.graal.us for your use in learning. God speed.


It's not a weapon though. It's the fourth sword right after lizerd

killerogue
03-30-2007, 05:42 AM
It's not a weapon though. It's the fourth sword right after lizerd

>.>


player.swordimg = "Blah";

I think that's the correct syntaxing.

cbk1994
03-31-2007, 03:34 PM
GS2 doesn't work offline.

killerogue
03-31-2007, 07:54 PM
GS2 doesn't work offline.

I DEFINITELY DID NOT KNOW THAT!

cbk1994
03-31-2007, 10:51 PM
Offline

I assume he needs GS1? Or has someone hacked an NPC-Server to work offline? Didnt think so.

DustyPorViva
03-31-2007, 11:11 PM
Gani's and parameters :)
Make a gani of a closed chest.
Make a gani of the chest opening with the item raising out of it, and the item being set by a parameter and make this gani setbackto the opened chest gani.
Make a gani of the opened chest.
And as far as gs1/2 goes... you posted in the gs2 forums but posted a gs1 script.
For setting the sword power there's a command for it,
setsword sword4.png,4;
I think that's it.

As for the chest code itself... in GS1 with gani's it'd be something like:

//CLIENTSIDE
if (created||playerenters) {
setstring this.chest,chest_#L-#v(x)-#v(y);
if (strcontains(#s(this.chest),#s(client.openedchests ))) setcharani chest_opened,;
else setcharani chest_closed,;
setstring this.itemimg,sword4icon.png;
}
if (playertouchsme && !strcontains(#s(this.chest),#s(client.openedchests ))) {
if (int(playerx+.5)==x && int(playery-1)==y) {
setcharani chest_open,#s(this.itemimg);
setsword sword4.png,4;
addstring client.openedchests,chest_#L-#v(x)-#v(y);
}
}


I don't know gs2 and I can't help with the serverside stuff, but that should be enough to help you in the general direction.