Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #16  
Old 02-17-2009, 12:00 AM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,746
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
Quote:
Originally Posted by Tyhm View Post
if you put a timeout in if(created):
Serverside: it's a lot like playerenters, because created's called once Ever for the Entire Server - which is often also when a player enters - but it could hypothetically start a script for an empty room. I guess it's useful if that's what you're going for - this event's going to happen whether anyone's here to see it or not - but generally it's good practice to, if a timeout happens when playerscount<1, do nothing until playerenters.
Clientside: dangerous, as it starts the loop only once per session; if you leave the room, the timeout stalls, and when you return it doesn't re-start.
Thanks for the clarification. So if I made the script serverside I could achieve my goal in initializing the loop, but since it would put pointless strain on the NPC Server, it would make more sense making it clientside and with playerenters?

I'm going back to my older levels and converting to GS2, and I'm wondering if I change certain tiles and use updateboard to make the changes visible, would the changes be made locally or for everyone in the level, or does it depend on the context I use those commands?
__________________
Save Classic!
Reply With Quote
  #17  
Old 02-17-2009, 12:04 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by maximus_asinus View Post
Thanks for the clarification. So if I made the script serverside I could achieve my goal in initializing the loop, but since it would put pointless strain on the NPC Server, it would make more sense making it clientside and with playerenters?

I'm going back to my older levels and converting to GS2, and I'm wondering if I change certain tiles and use updateboard to make the changes visible, would the changes be made locally or for everyone in the level, or does it depend on the context I use those commands?
Serverside, there is a server option (savelevels=true) which when you use updateboard/updateboard2, the changes are actually saved.
__________________
Reply With Quote
  #18  
Old 02-17-2009, 12:13 AM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,746
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
Quote:
Originally Posted by cbk1994 View Post
Serverside, there is a server option (savelevels=true) which when you use updateboard/updateboard2, the changes are actually saved.
Okay in my example I have a path that is normally blocked unless Player A shoots an NPC with an arrow. It would be nice for Player A and B to see the changes if they're in the level when the NPC is shot, but if Player C enters he would not see this newly made path. Is such a result possible?
__________________
Save Classic!
Reply With Quote
  #19  
Old 02-17-2009, 12:31 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by maximus_asinus View Post
Okay in my example I have a path that is normally blocked unless Player A shoots an NPC with an arrow. It would be nice for Player A and B to see the changes if they're in the level when the NPC is shot, but if Player C enters he would not see this newly made path. Is such a result possible?
It would probably be better to use images for what you want, or even invisible NPCs, that, when shot, stop blocking for x time.

PHP Code:
function onActionProjectile() {
  
dontblock();
  
scheduleevent(3"Block""");
}
function 
onBlock() {
  
blockagain();
}
//#CLIENTSIDE
function onCreated() {
  
setshape(1WIDTH_IN_PIXELSHEIGHT_IN_PIXELS);

Should be able to get the basic gist out of the above code.
__________________
Reply With Quote
  #20  
Old 02-17-2009, 12:47 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Yes; to accomplish what you want, you'd just have to set it up so that when the target's hit, for all players in the room, tell their clientsides that the path is clear.

Unfortunately I suck at triggeractions, so I'll leave it to someone else to show you what that script would look like. :-P
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #21  
Old 02-17-2009, 03:40 AM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,746
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
Quote:
Originally Posted by cbk1994 View Post
It would probably be better to use images for what you want, or even invisible NPCs, that, when shot, stop blocking for x time.

PHP Code:
function onActionProjectile() {
  
dontblock();
  
scheduleevent(3"Block""");
}
function 
onBlock() {
  
blockagain();
}
//#CLIENTSIDE
function onCreated() {
  
setshape(1WIDTH_IN_PIXELSHEIGHT_IN_PIXELS);

Should be able to get the basic gist out of the above code.
Yes, I agree with you, I probably should use an image, BUT I dislike using images (almost as much as I hate using custom tiles) because I can achieve the same effect without creating a new image.

I have another question, relating to my refusal to using images. Is it possible to draw tiles over a player and make it not block? I read somewhere about Graal using multiple layers for tiles.
__________________
Save Classic!
Reply With Quote
  #22  
Old 02-17-2009, 04:15 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Umm, yeah? Showimg doesn't block, but I don't know if that's what you're looking for...it's certainly Possible to showimg pics1.png; changeimgpart to a 16x16 tile...
If you want to give yourself a LITTLE less of a heart attack, you could make a Gani of the set of tiles you want...

the last thing I read about Graal using multiple layers for tiles, it turned out they meant the Z axis, and the rest of us were still boned...there's never a quick and easy way to tile a bridge Over a path...you can attachplayer to an NPC of a bridge, but...
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #23  
Old 02-17-2009, 06:35 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by maximus_asinus View Post
Yes, I agree with you, I probably should use an image, BUT I dislike using images (almost as much as I hate using custom tiles) because I can achieve the same effect without creating a new image.

I have another question, relating to my refusal to using images. Is it possible to draw tiles over a player and make it not block? I read somewhere about Graal using multiple layers for tiles.
The code I posted does not require an image
__________________
Reply With Quote
  #24  
Old 02-17-2009, 11:02 PM
WanDaMan WanDaMan is offline
Master Tux
WanDaMan's Avatar
Join Date: Aug 2002
Location: England, United Kingdom
Posts: 5,571
WanDaMan is a jewel in the roughWanDaMan is a jewel in the rough
Send a message via MSN to WanDaMan
Quote:
Originally Posted by maximus_asinus View Post
I have another question, relating to my refusal to using images. Is it possible to draw tiles over a player and make it not block? I read somewhere about Graal using multiple layers for tiles.
It is possible, however; it would probably be easier to use an image. Menion Leah used pics1.png as the image and identified the tiles he wanted for the part using script instead of creating a new image for the tiles he needed.
Reply With Quote
  #25  
Old 02-20-2009, 09:09 PM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,746
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
How does VECX and VECY work? The Wiki isn't informative at all.
__________________
Save Classic!
Reply With Quote
  #26  
Old 02-20-2009, 11:00 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by maximus_asinus View Post
How does VECX and VECY work? The Wiki isn't informative at all.
vecx(dir) and vecy(dir) are the same as doing cos(pi * (dir + 1) % 4 / 2) and sin(pi * (dir + 1) % 4 / 2)

To put it simply, this is how I always remembered it: it will return the direction that something should be moving in relation to the direction that you input.

For example, vecx(3) will return 1, while vecx(1) will return -1:

If your direction is 1 you are facing left, obviously the object should travel -1 (x). If you are facing right, 3, the object could travel 1 (x).

Same relation is for vecy(dir).
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #27  
Old 02-21-2009, 12:01 AM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,746
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
Thanks Tig (damn percent signs gave me 404 error, so I can't quote you).
__________________
Save Classic!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:51 AM.


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