Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Torch NPC -Help?- (https://forums.graalonline.com/forums/showthread.php?t=27831)

darkriders_p2p 04-22-2002 04:03 AM

Torch NPC -Help?-
 
I'm trying to make a simple Torch for a quest for a server, but when I fire the weapon it goes wierd.When you walk, it is and idle gani without the light effect, when its idle, its a walking gani with light.Plz help meh :( I INDENT FOR YOU)
NPC Code:

if (weaponfired) {
if (client.torch==0) {
client.torch=1;
timeout=.5;
}
else client.torch=0;
}
if (timeout) {
if (client.torch==1) {
if (strcontains(#m,idle)) {
setani torch_idle,torch2.png;
}
if (strcontains(#m,walk)) {
setani torch_walk,torch2.png;
}
}
timeout=0.05;
}


Goboom 04-22-2002 08:11 AM

UNTESTED
try...
NPC Code:

if (weaponfired) {
if (client.torch==0) {
client.torch=1;
timeout=.5;
}
else client.torch=0;
}
if (timeout) {
if (client.torch==1) {
replaceani idle,torch_idle;
replaceani walk,torch_walk;
}
timeout=0.05;
}


darkriders_p2p 04-22-2002 09:05 AM

I tried replaceani, it doesn't show the lamp/torch.

Spanko 04-22-2002 04:44 PM

Quote:

Originally posted by darkriders_p2p
I tried replaceani, it doesn't show the lamp/torch.
That's strange, since the actual torch on Graal2001 does use replaceani.

SaijinGohan 04-22-2002 06:55 PM

what you are trying to do is no practial logical way since you would have to use #m, setani, and replaceani. with replaceani you can only replace a gani with a gani and you want to setani with a new graphics so my suggestion would be to make a new gani using the torch2.png and using this code.

NPC Code:

if (weaponfired) {
if (!client.on) {
set client.on;
replaceani idle,torch_idle2;
replaceani walk,torch_walk2;
}else{
unset client.on;
replaceani idle,idle;
replaceani walk,walk;
}
}


Saga2001 04-22-2002 11:16 PM

Well you could also have a timeout and send params with a setani...:cool:

darkriders_p2p 04-23-2002 02:28 AM

Ok, I'll use replaceani but someone post teh ganis here, because mine might be broken.

emortylone 04-25-2002 09:17 PM

Why not put a walking gani? so if the gani = walking one, setgani walking_torch.gani i don't deal w/ gani's and sprites too much, heh.
---Shifter

emortylone 04-26-2002 08:43 PM

god, just putting me down in one thread after another! LOLz, how is that a bad solution? That is the solution i came up with. remember, i'm @ school and it is like EARLY! i can't get axx to the forums @ home, it won't load up for some reason?? So i don't have axx to all of my stuff and i'm thinking on little caffeine! ;)
---Shifter

emortylone 04-26-2002 08:57 PM

Heh, true dat. I see what you're saying. But u could increase the timeout for that part and have it change the timeout l8er or something? or stop the gani if the player stops.
Yeah, you'er giving me something to do in first period, this is great. Thanx m8!
---Shifter

emortylone 04-26-2002 09:08 PM

Ah, point taken. I bow to your superior skillz heh. Yeah, there should be a way to change the default Gani. I mean not just one time use, but more of a global thing. I heard about their being one for tiledef and such.
---Shifter

emortylone 04-26-2002 09:12 PM

Then why would it not work then? If you can replace the default ani's then the default ones should not show?? Sorry, if you can't tell i don't use ganis often, heh.
---Shifter

emortylone 04-29-2002 08:14 PM

LOL, okiez then. Perhaps just put an NPC of a torch and have it attachplayertoobj ?? that would seem easier, but maybe not as good looking.
---Shifter

emortylone 04-30-2002 08:13 PM

If you need it done, that is a way. The NPC will be on the player, make it sized so it hangs on the right, it won't be the best, but if it ABSOLUTELY needs done, i don't see what the problem is there?
---Shifter

emortylone 04-30-2002 08:24 PM

Yeah, i do. I've used it b/4. It puts the npc basically on top of the player. put a torch image w/ a partially transparent effect on top of the player. Or set it for playerx, playery (circular image that lights the place, then has a lantern on the right side where the players hand is. Then showimg timeout=0.05, hide the image, then show it player x, player y again, it is constantly updating and the image will be there until if (this.use==1&&weaponfired) timeout=0 (or crazy numbers like imaginary ones!)
---Shifter

emortylone 04-30-2002 08:50 PM

Yeah? and, you put the light all around, so it is visible, and the lantern on the right side of the person so it is barely visible. I am telling you it would work just fine, not the best, but would work.
---Shifter

Saga2001 04-30-2002 11:09 PM

Quote:

Originally posted by Kaimetsu


No, it attaches the player to the NPC. If the NPC moves, the player moves with it. If the player moves, the NPC stays stationary. It's for making things like boats, where the player moves with the boat that he's standing on.

Man this guy is relentless with his wrong ideas. Attachplayertoobj type,id; is used for boats, trains, etc. If you want to make your torch npc work well, all you need to do is make a gani that has a light effect in it, use gani-scripting like ghostlights.gani from Graal2002 Server, and change the light effects on the attributes, and then all you need to do is replacegani or is it replaceani? Well either way, you replace walk with your walking gani and idle with your idle gani (Just edit walk and idle so they contain your gani-scripting and rename) and then you can do it find.
Oh yeah, and if you are sure this would work (your attachplayertoobj; ) then why did you start this thread?:rolleyes:

emortylone 05-01-2002 08:03 PM

1) I did not start this thread.
2) If you use timeouts you achieve it. I've done it b/4. not the best thing to use but whatever. This is pointless to argue on
---Shifter

Saga2001 05-01-2002 11:01 PM

Quote:

Originally posted by emortylone
1) I did not start this thread.
---Shifter

Oops, sorry, I thought you did. I was having a bad day took it out in the wrong place, sorry man. ;)

Projectshifter 05-02-2002 08:26 PM

That is okay. Some people like (me) are a bit thick, and like to think that they know more than smarter people (you). LOL, this is emortylone, on my real account now! Feels good, heh. I know what you guys are saying, but w/ a timeout=0.05 and then attach player toobj it would constantly put the NPC on top of the player. Oh well, dropping it, heh.
---Shifter

Saga2001 05-02-2002 11:36 PM

Quote:

Originally posted by Kaimetsu


Nargh it would put the player on top of the NPC!!!

Exactly if the npc would be on top of the player, it would be attachobjtoplayer not attachplayertoobj...:(

Projectshifter 05-03-2002 08:40 PM

Lol, i know this. That is why i said it wouldn't be the best. The player would be under the light and lamp.
---Shifter

Saga2001 05-04-2002 02:30 AM

Quote:

Originally posted by Kaimetsu


And the player wouldn't be able to move properly.

Well let him try to script it and post it maybe?
If you attachplayertoobj; it takes the npc's setshape2; if that npc has none, it takes no set, so the player is stuck unable to move. Just use replacegani; unless SOMEHOW project shifter makes this...:rolleyes:


All times are GMT +2. The time now is 04:35 AM.

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