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 07-23-2001, 08:34 AM
ownerofbabylon ownerofbabylon is offline
Lord Helmut
ownerofbabylon's Avatar
Join Date: Jun 2001
Location: Gainesville FL
Posts: 1,763
ownerofbabylon is on a distinguished road
Send a message via ICQ to ownerofbabylon Send a message via AIM to ownerofbabylon
Creatures

I am making a creature that follows the player around and I was experimenting with setimgpart and stuff. I know Merlin wont help if u dont have some of it done so here is what i did.

// NPC made by Lord Helmut (LAT)
if(playerenters){
setimgpart bomy.png,98,52,40,43;
}
if (playerdir==left) {
setimgpart bomy.png,48,99,48,43;
}
if (playerdir==right{
setimgpart bomy.png,140,98,44,44;
}

I was playing around and seeing how this stuff worked and i got the right thing for setimgpart and i was happy. But I want it so it watches a player and when they walk left it turns left and stays behind them. So like if a player x = 30 then this x is like 2 less. How would I make it work so it constantly did somthing? Because I want this to follow the player and each time there x increases the creatures increases by the same amount.

I used a bomy as a example but this is not the real one. It was just for experimenting.
__________________


Warrior of Light

WWW.BABYLONSERVER.COM
Reply With Quote
  #2  
Old 07-23-2001, 08:53 AM
Merlin Merlin is offline
Banned
Merlin's Avatar
Join Date: Jul 2001
Location: Merlin - U S A Malak - United Kingdom
Posts: 2,543
Merlin is on a distinguished road
Send a message via ICQ to Merlin Send a message via AIM to Merlin
if (Created) {
tokenize x;
tokenize y;
timeout=.5;}
if (playerx=playerx&&timeout) {x=playerx-2;
timeout=.5;
}
if (playery=playery&&timeout) {y=y-1;}

Well actualy I have no idea but that may work.
Reply With Quote
  #3  
Old 07-23-2001, 09:14 AM
ownerofbabylon ownerofbabylon is offline
Lord Helmut
ownerofbabylon's Avatar
Join Date: Jun 2001
Location: Gainesville FL
Posts: 1,763
ownerofbabylon is on a distinguished road
Send a message via ICQ to ownerofbabylon Send a message via AIM to ownerofbabylon
i see tokenize alot but dont understand it. What is that used for?
__________________


Warrior of Light

WWW.BABYLONSERVER.COM
Reply With Quote
  #4  
Old 07-23-2001, 12:17 PM
General General is offline
Banned
Join Date: Apr 2001
Location: Station Square
Posts: 984
General is on a distinguished road
Send a message via ICQ to General Send a message via AIM to General Send a message via Yahoo to General
tokenize is useless in that script, he is a newbie scripter...
a better one would be

x=playerx+vecx(playerdir)*3;
y=playery+vecy(playerdir)*3;
Reply With Quote
  #5  
Old 07-23-2001, 01:33 PM
ownerofbabylon ownerofbabylon is offline
Lord Helmut
ownerofbabylon's Avatar
Join Date: Jun 2001
Location: Gainesville FL
Posts: 1,763
ownerofbabylon is on a distinguished road
Send a message via ICQ to ownerofbabylon Send a message via AIM to ownerofbabylon
ooooo

so thats all i gotta put??

BTW, what does vecx and vecy do???
__________________


Warrior of Light

WWW.BABYLONSERVER.COM
Reply With Quote
  #6  
Old 07-24-2001, 07:02 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
vecx and vecy is weird but it works.
erm ill try to explain what it does and how it does..
what it does is ..
it returns a -1 or a 0 or a 1 . depending on the playerdir. and its used to move things ''forward'' or backwards or whatever..
if you do
playerx+=vecx(playerdir);
playery+=vecy(playerdir);
it will move the player 1 spot forward. (the way hes facing)
how it does is simple..
ill tell you in english
if playerdir is 0 (up) vecx returns 0 and vecy -1
if playerdir is 1 (left) vecx returns -1 and vecy 0
if playerdir is 2 (down) vecx returns 0 and vecy 1
if playerdir is 3 (left) vecx returns 1 and vecy 0

its also usefull for triggeraction
triggeraction playerx+1.5+(vecx(playerdir)*2),
playery+2+(vecy(playerdir)*2),blabla;

=)
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #7  
Old 07-28-2001, 11:36 PM
ownerofbabylon ownerofbabylon is offline
Lord Helmut
ownerofbabylon's Avatar
Join Date: Jun 2001
Location: Gainesville FL
Posts: 1,763
ownerofbabylon is on a distinguished road
Send a message via ICQ to ownerofbabylon Send a message via AIM to ownerofbabylon
Quote:
Originally posted by LiquidIce00
vecx and vecy is weird but it works.
erm ill try to explain what it does and how it does..
what it does is ..
it returns a -1 or a 0 or a 1 . depending on the playerdir. and its used to move things ''forward'' or backwards or whatever..
if you do
playerx+=vecx(playerdir);
playery+=vecy(playerdir);
it will move the player 1 spot forward. (the way hes facing)
how it does is simple..
ill tell you in english
if playerdir is 0 (up) vecx returns 0 and vecy -1
if playerdir is 1 (left) vecx returns -1 and vecy 0
if playerdir is 2 (down) vecx returns 0 and vecy 1
if playerdir is 3 (left) vecx returns 1 and vecy 0

its also usefull for triggeraction
triggeraction playerx+1.5+(vecx(playerdir)*2),
playery+2+(vecy(playerdir)*2),blabla;

=)
Thanks man. Now I understand how to use Vec better. I still dont quit get triggeraction but i may learn if I keep playing with it. Thanks again =D
__________________


Warrior of Light

WWW.BABYLONSERVER.COM
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 08:44 PM.


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