Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Sprite Spacing (https://forums.graalonline.com/forums/showthread.php?t=12299)

Death_Link 09-19-2001 01:46 PM

Sprite Spacing
 
Ok alot of u may already know im makin some gun weapons. There are 2 more things i need 2 do.
1 is that i dont know how to put one long image as three seperate sprites in gani editor. They always come up as the same sprite!
2 is that for the particular level im working on i need 2 change the fireball gifs into my own gifs.
Can some1 help?

Knightoffrost 09-19-2001 02:45 PM

[ Delph Inc. ]
I've made a laser weapon for Galactica...it shoots out the laser images...at quite a fast speed and also makes the laser noise.

I'll stop with the: <[ Delph Inc. ]> </[ Delph Inc. ]> stuff...It gets quite annoying.
So for now on just look for the [ Delph Inc. ] at the top.

Death_Link 09-20-2001 11:22 PM

um... help me out here knight of frost. I actually posted askin' to do it. U obviousley know that. Can u help me?

Death_Link 09-21-2001 01:42 AM

well can any1 help me?

Thak2 09-21-2001 02:32 AM

figure out how to use setimgpart, once you know that, then setting specific sprites in a gani should be understandable.

Death_Link 09-21-2001 03:32 AM

kay i figured out how to do the gani's with the sprites, all i need 2 know now is how to replace the fireball images with my own bullet images for the guns only and how to stop the fireball making a sound. any1 help?

Death_Link 09-21-2001 01:11 PM

any1?

CyanideSR71 09-21-2001 11:33 PM

It's advised you just start from scratch and make a whole new NPC, using hitobjects and stuff...

Death_Link 09-22-2001 02:01 AM

well ur gunna have to help me out then. OK?

Knightoffrost 09-22-2001 02:29 PM

[ Delph Inc. ]
Yes...you need to start from scratch to change the arrow images.
Now...just because I feel in a bit of a good mood I'll post the image part for you:
NPC Code:

if(timeout){
for(e=0;e<this.out;e++){
if(this.arrowact[e]==0){
if(this.arrowdir[e]==3){
this.arrowx[e]+=this.arrowspeed;
showimg e,laser.gif,this.arrowx[e],this.arrowy[e];
changeimgpart e,1,2,29,5;
}
if(this.arrowdir[e]==0){
this.arrowy[e]-=this.arrowspeed;
showimg e,laser.gif,this.arrowx[e],this.arrowy[e];
changeimgpart e,13,20,5,29;
}
if(this.arrowdir[e]==1){
this.arrowx[e]-=this.arrowspeed;
showimg e,laser.gif,this.arrowx[e],this.arrowy[e];
changeimgpart e,0,12,29,5;
}
if(this.arrowdir[e]==2){
this.arrowy[e]+=this.arrowspeed;
showimg e,laser.gif,this.arrowx[e],this.arrowy[e];
changeimgpart e,3,21,5,29;
}
this.arrowtime[e]++;
}else{
this.arrowtime[e]=this.life*20;
}
}
}
}



I just closed the timeout command off...but just to let you know there's about another 80 lines of code in the script.
You'll also have to call the variables, make it so it can hit and hurt players + baddies. The player direction. Make the arrow disappear after a while.
Most of it is mainly using arrays.

Death_Link 09-22-2001 03:27 PM

I aint got much on arrays but ill give it a shot and ill post if i need help.

Death_Link 09-22-2001 03:36 PM

hey guys i changed the if (timeout) to if (weaponfired) and put my own images in instead of the lazer images and i fired the weapon and nothing. Here is what the code looks like now:

if(weaponfired){
for(e=0;e<this.out;e++){
if(this.arrowact[e]==0){
if(this.arrowdir[e]==3){
this.arrowx[e]+=this.arrowspeed;
showimg e,bullet.gif,this.arrowx[e],this.arrowy[e];
changeimgpart e,1,2,29,5;
}
if(this.arrowdir[e]==0){
this.arrowy[e]-=this.arrowspeed;
showimg e,bullet.gif,this.arrowx[e],this.arrowy[e];
changeimgpart e,13,20,5,29;
}
if(this.arrowdir[e]==1){
this.arrowx[e]-=this.arrowspeed;
showimg e,bullet.gif,this.arrowx[e],this.arrowy[e];
changeimgpart e,0,12,29,5;
}
if(this.arrowdir[e]==2){
this.arrowy[e]+=this.arrowspeed;
showimg e,bullet.gif,this.arrowx[e],this.arrowy[e];
changeimgpart e,3,21,5,29;
}
this.arrowtime[e]++;
}else{
this.arrowtime[e]=this.life*20;
}
}
}
}

joseyisleet 09-22-2001 04:12 PM

should be elementary now =)
 
now in the putimg parts put almost the same thing except replace putimg with hurtplayer (powerhere), then the array, same with hurtbaddy
should all be simple now, dont see why youd need 80 more lines of code...

Knightoffrost 09-22-2001 05:58 PM

[ Delph Inc. ]
First of all you havent set the arrows speed, the arrows x pos, and the arrows y pos.
The timeout should be there because that's the animation...if there is no timeout it would just place an image in one spot if scripted correctly.
I'll now post the variables:
NPC Code:

this.maxcount=30;
this.life=5;
this.arrowspeed=1;
this.arrowdamage=2;
setarray this.arrowx,this.maxcount+1;
setarray this.arrowy,this.maxcount+1;
setarray this.arrowdir,this.maxcount+1;
setarray this.arrowtime,this.maxcount+1;
setarray this.arrowact,this.maxcount+1;
this.init=1;



That's all I really want to post because I know there's people out there who just keep aimlessly wandering these boards looking for whole scripts to take.

Knightoffrost 09-22-2001 06:45 PM

[ Delph Inc. ]
Now...you have to test the players direction and say what you want the NPC to do when the player is facing that way.
e.g.
if (playerdir=3) {
this.arrowx[this.out]=playerx+1;
}

Now 'this.out' we'll talk about later because it counts how many arrows you have fired and adds each one to a specific number to be called separately.
playerdir=3 is just when the player is facing right
0=up
1=left
2=down
3=right
and playerx+1 is where the arrow will appear once fired.
You'll also need to add the arrows y position so:
if (playerdir=3) {
this.arrowx[this.out]=playerx+1;
this.arrowy[this.out]=playery+1.8;
}

Now all you have to do is add the position of the arrow for
playerdir:
0, 1, and 2.

After that...say which direction you want the arrow to be going:

this.arrowdir[this.out]=playerdir;
and also make it so that it adds another 1 to this.out everytime you fire the weapon.

so before all of the the direction and positioning stuff add:
if (isweapon) {
if (weaponfired&&playerdarts>0) {
freezeplayer 0.2;
player Laser.wav; //You can change this or delete it to have no sound.
playersprite=33;
playerdarts--;

Now you have most of what you need...all you need is the player/baddy hurting...and the pickup item code which is simple.


All times are GMT +2. The time now is 01:20 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.