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
  #1  
Old 04-13-2003, 02:13 PM
Chicken_l33t Chicken_l33t is offline
Banned
Join Date: Sep 2002
Location: NewZealand
Posts: 467
Chicken_l33t is on a distinguished road
A little help >.>

I was mucking around with 360 Rotations and all and I joined all the NPCs with npc[i].x and y and it all worked out fine, then I came across a problem when I added a new one and one went missing and I double checked >.>.

is there a max of npcs that can be on npc[i].x and y?.
Reply With Quote
  #2  
Old 04-13-2003, 02:59 PM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
well, if you do a for loop to index all the npcs, it will include all the npcs. ( I dont know what you mean, 'max' ).

This is an example, of using a for loop with npcs[index]

NPC Code:

//#CLIENTSIDE
if (created) {
speed = 1;
timeout = .05;
}
if (timeout){
for (i=0;i<npcscount;i++){
dx = npcs[i].x - playerx;
dy = npcs[i].y - playery;
dist = (dx*dx+dy*dy);
newx = (dx/dist)*speed;
newy = (dy/dist)*speed;
npcs[i].x += newx;
npcs[i].y += newy;
}
timeout = .05;
}




Thats just an example of how to use it. (npcs move away from player)

help at all?
__________________
Former Global Scripting Team Member


Reply With Quote
  #3  
Old 04-13-2003, 03:11 PM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
*edited the script*

yea your right heh. I just wasn't sure if he was indexing all the npcs, somehow, but there ya go hehe.

And Chicken, maybie if you posted part of your script we could see why its stopping, or if your doing it correctly :P
__________________
Former Global Scripting Team Member


Reply With Quote
  #4  
Old 04-13-2003, 03:17 PM
Chicken_l33t Chicken_l33t is offline
Banned
Join Date: Sep 2002
Location: NewZealand
Posts: 467
Chicken_l33t is on a distinguished road
Yeh exactly what I ment Kai, sorry I wasent clear lol.
I'll try your script soon ning and see if it's what's the problem but i'm sure it's the array and one of the parts in the array have gone missing, maybe it's a spelling mistake (but I don't think it is).
Reply With Quote
  #5  
Old 04-13-2003, 04:04 PM
Chicken_l33t Chicken_l33t is offline
Banned
Join Date: Sep 2002
Location: NewZealand
Posts: 467
Chicken_l33t is on a distinguished road
I'll just cut it down, wont be to hard lol.

and i'll do some spell checks and all I just wanted to know if there was a max, the scripts fine but yeh it could be a bug.
*goes to sleep*
Reply With Quote
  #6  
Old 04-14-2003, 11:01 PM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
Quote:
Originally posted by Kaimetsu
It might be a bug in Graal (eg, it might be limited to 256 elements or something), but I'd need to see the script to be sure.
I was thinking, I don't know what you mean by elements, if you mean npcs then It can't be the bug.

Attached is a level with 256 + npcs in.
I also added a "eek get away from me" script for the entertainment value, if you change npcs[i].x/y with playerx/y then you get different movement, more like a "eee come here sexy".

Well anyway, yea.
Attached Files
File Type: nw elements.nw (24.8 KB, 156 views)
__________________
Former Global Scripting Team Member


Reply With Quote
  #7  
Old 04-15-2003, 03:09 AM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Quote:
Originally posted by Ningnong


I was thinking, I don't know what you mean by elements, if you mean npcs then It can't be the bug.

Attached is a level with 256 + npcs in.
I also added a "eek get away from me" script for the entertainment value, if you change npcs[i].x/y with playerx/y then you get different movement, more like a "eee come here sexy".

Well anyway, yea.

I added more 70 elements and it's working fine. (Maybe it's a bug as Kai said?)
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #8  
Old 04-15-2003, 12:48 PM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
aaah, i see. :grin:
__________________
Former Global Scripting Team Member


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:57 PM.


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