Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-27-2007, 10:59 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Baddy bugged on gmap

I made a baddy(ala zora's in Zelda), and it works fine in regular levels, but once it's put on gmap it completely bugs out. It doesn't show at all, it doesn't echo anything if I put an echo in it, and I can't figure out what's wrong with it. Here's the code, I'll attach the image as well for anyone who wants to mess with it hands on. What I want is it to randomly pop up in the level it originates in, not around the gmap.

Grrr... apparently I'll have to attach the script as well because the forums are being dumb!
Attached Images
 
Attached Files
File Type: gani dusty_baddy_fish.gani (461 Bytes, 278 views)
File Type: txt dustybaddyfish.txt (1.2 KB, 323 views)
Reply With Quote
  #2  
Old 08-28-2007, 10:58 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Hmmm eventually use onPlayerEnters() instead of onCreated()
Reply With Quote
  #3  
Old 08-28-2007, 01:12 PM
PrinceOfKenshin PrinceOfKenshin is offline
That guy with a beard
PrinceOfKenshin's Avatar
Join Date: May 2004
Location: Ontario, Canada
Posts: 819
PrinceOfKenshin has a spectacular aura aboutPrinceOfKenshin has a spectacular aura about
Quote:
Originally Posted by Stefan View Post
Hmmm eventually use onPlayerEnters() instead of onCreated()
Woot i was right. I was going to say that but when i hit reply it said bad request.
Because gmaps kinda run all scripts at once and if you have onCreated it will appear once
__________________


Quote:
Game Master (Server): Greetings PrinceOfKenshin, there are new posts on the forums that demand your urgent attention! God speed, the fate of the world is in your hands. If you fail, middle earth will forever be in the darkness and your children will be enslaved by McKain.
Reply With Quote
  #4  
Old 08-28-2007, 01:42 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Well, I changed that and it didn't help anything. This shows up in F2:
GraalScript: Loop limit exceeded in script of (in level vs_world-a3.nw at pos (35, 32))
And still not showing anything, and not executing the scripts.
Reply With Quote
  #5  
Old 08-28-2007, 01:56 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
havent looked at the script but did your try that % thing?
__________________
Deep into the Darkness peering...
Reply With Quote
  #6  
Old 08-28-2007, 02:50 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Could easier with a onwater2() ;o
__________________
Reply With Quote
  #7  
Old 08-28-2007, 03:16 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Do something like this to prevent endless loop:
PHP Code:
  for (i=0i<4i++) {
    
this.this.gmapo[0]*64 int(random(0,62));
    
this.this.gmapo[1]*64 int(random(0,62));
    if (
onwater(this.x-1+(i%2), this.y-1+int(i/2)))
      break;
  } 
Reply With Quote
  #8  
Old 08-28-2007, 03:33 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Chompy View Post
Could easier with a onwater2() ;o
I did that at first, but for some reason it wasn't working right. It'd find water, but half the time it appear half-way off the water for some reason, so I ditched it.
Reply With Quote
  #9  
Old 08-28-2007, 03:38 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by DustyPorViva View Post
I did that at first, but for some reason it wasn't working right. It'd find water, but half the time it appear half-way off the water for some reason, so I ditched it.
Tried Stefan's method/correction?

oh, and at onwater2:

!onwater2(this.x - 1, this.y - 1, 64, 64)
__________________
Reply With Quote
  #10  
Old 08-28-2007, 10:51 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Hmm, Stefan's method doesn't actually force the NPC to spawn in water.
It works... but it'll spawn on land and such. So it's obvious the problem is the loop limit, although I dunno why it doesn't work on gmap's when it works fine on .nw's
Reply With Quote
  #11  
Old 08-29-2007, 12:24 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Hm, I generally prefer baddies to be serverside, because it makes it more like a true MMO, and less like a single player game where other players happen to be there, but still, nice work. But, unfortunately I believe this.level will return the gmap name, you'd have to script it to figure out the level name based on the x/y on the GMAP, which I believe the default profiles in Graal do when you look at your own profile. There's probably a few ways you could do it.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #12  
Old 08-29-2007, 12:33 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I was going to do it serverside, but there's too many complications with that. Also, shootball() doesn't work serverside, and I can't use projectiles for that(I originally did, but they disappeared on wall collision, defeating the purpose of this baddy).
And I've deducted that it's the loop causing the problem(see above post), because when the loop was removed, it works fine... except of course it spawns on land because it's not checking for water.
Reply With Quote
  #13  
Old 08-31-2007, 06:55 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I think I've finally 'fixed' the problem. Instead of finding water every time it warps, I'm simply going to have a 256 loop when it's created, and check every 4x4 square, and if it's water, add it to an array, and when it's time to warp, pick it's position from the array.

EDIT: seems this is not working...
PHP Code:
  this.gmapo={int(thiso.x/64),int(thiso.y/64)};
  
this.waterspots = new[256];
  for (
i=0;i<256;i++) {
    
this.waterspots[i]=i;
    if (!
onwater2((this.gmapo[0]*64)+((i%16)*4),(this.gmapo[1]*64)+(int(i/16)*4),4,4)) {
      
this.waterspots[i]=-1;
      
showimg(i+500,"door.png",(this.gmapo[0]*64)+((i%16)*4),(this.gmapo[1]*64)+(int(i/16)*4));
    }
  } 
The point of this is to run through the level and whatever is NOT water, erase it from the array. Now, even besides that, check out the showimg bit. It should show a door at ever 4x4 square that is NOT water. It shows doors throughout the whole level, even where there is water. It makes absolutely no sense!

Last edited by DustyPorViva; 08-31-2007 at 07:54 AM..
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 01:24 AM.


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