![]() |
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. |
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. |
i see tokenize alot but dont understand it. What is that used for?
|
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; |
ooooo
so thats all i gotta put?? BTW, what does vecx and vecy do??? |
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; =) |
Quote:
|
| All times are GMT +2. The time now is 05:50 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.