![]() |
Vecx and Vecy
Someone mind explaining these two things too me in plain english? :) I know that vec stands for Vector, and I think vectors = speed+direction, but thats where my knowlege ends on this subject ;P
|
posted a while back.
NPC Code: Quote:
vecx(playerdir) //<-- that would equal the tile the player was standing on. (numeral direction for down: 2) Numeral Directions: 0 Up 1 Left 2 Down 3 Right Hope it helps. |
Err sort of, I still dont quite understand it, thanks though.
|
Quote:
|
I didn't really understand it at first either.. And it's kinda hard to explain.. Let's see...
*Steals Tarankusu's list* NPC Code: *explains list ferther* vecx(playerdir) // the best usage for it. vecx={0,-1,0,1} // like if playerdir {0,1,2,3} vecy={-1,0,1,0} // like if playerdir {0,1,2,3} if playerdir = 0, the VECY would = -1 if playerdir = 1, the VECX would = -1 if playerdir = 2, the VECY would = 1 if playerdir = 3, the VECX would = 1 playery=playery+vecy(playerdir) if he was faceing up, the playerdir would = 0, so it would add -1 to his playery, AKA playery-=1 //in other words.. move him up playerx=playerx+vecx(playerdir) if he was facing left, the playerdir would = 1, so it would add -1 to his playerx, AKA playerx-=1 //in other words.. move him left and so on and so forth... >;/ get it? |
So vecx and vecy are for moving the player?
|
Quote:
you can also use them for detecting tiles infront of the players dir. EXAMPLE: NPC Code: |
No, but MOST SCRIPTERS when there new.. they use it for movement...
NPC Code: |
Quote:
|
Quote:
I'm not sure about the playery+2 / playerx+1.5 myself. I tried taking it out, but it didn't work. It doesn't move the player or anything though. |
Hmmm... Is there like a guide or something, in plain english for scripting @_@;?
|
// Delete's post...
I posted a explination.. but explaining.. didn't make it sound right... hehe, i kinda confused myself >;O.. good idea < ask screen_name... |
Quote:
|
Quote:
By the way, I was playing around with triggeraction and I can't get it to work, NPC Code: Should that work, or am I just really dumb? |
Quote:
|
Quote:
|
Quote:
and the actiontest goes above the clientsided part. |
Quote:
|
Quote:
|
Quote:
Also if it is a separate NPC and the separate one has an image, the triggeraction must be on the image. kind of like opening an NPC, your mouse has to be on its image or that blank NPC outline |
Quote:
|
How do u work the mouse thingy anyway?
if (mousex==playerx) { or something? |
Quote:
|
Quote:
And for the mousex questionaire, I'm not too sure either. I've tried it all different ways. :( |
Quote:
- New script command: triggeraction targetx,targety,action,params; This is one of the commands that give you like 50% more scripting power than before. It is like a combination of hitobjects and callnpc, but better. With 'triggeraction' you invoke an event to the object on positon (targetx,targety). If the object is an npc, then the npc script is called with the flag 'action<action>' set, when the object is a player then the weapon scripts of the that player are called with the 'action<action>' flag set. 'params' can be one or more parameters, divided by commas; the called script can read the paramters by accessing the message code #p(paramindex). Because this is hard to explain with words, here some little examples: - trigger player weapons You can easily do a weapon which freezes the other player: if (playertouchsme) toweapons Freezing-Weapon; if (weaponfired) { triggeraction playerx+1.5+vecx(playerdir)*2, playery+2+vecy(playerdir)*2,freeze,; } if (actionfreeze) { freezeplayer 3; setplayerprop #c,FREEZED; } Both players must have this weapon for making it working. Then use it on the other player, and he will be freezed, because a 'freeze' action is sent to him and his weapon script, called with flag 'actionfreeze', will freeze him. You can also move the if (actionfreeze) ... into an system npc so the weapon can be used on all players. Other nice things you could do with triggering actions on players: a stealing weapon which lets the other player loose gralats (if (actionsteal) lay2 greenrupee,... ); complex attacking weapons that use your own hitpoint system instead of the default hearts thing - trigger npcs Until now npcs can only react to 'playertouchsme' and 'washit', other things are very hard to do (e.g. the mining on Graal2001 was made by checking periodically what animation the player has and before which stone the player stands). You could do callnpc, but this works only client-side and you needed to pass parameters with flags. Using 'triggeraction' you can make those things much easier. The mining axe could have the script if (weaponfired) { setani jaxe,hammergold0.png; triggeraction playerx+1.5+vecx(playerdir)*2, playery+2+vecy(playerdir)*2,mining,#v(axepower); } If you now use the weapon on a stone, the stone npc could check this so: if (actionmining) { axepower = strtofloat(#p(0)); this.power -= axepower; if (this.power<=0) { setstring uncraftedgold,#v(strtofloat(#s(uncraftedgold))+1); hide; } } With this thing you can also easily do switches which are activated with the hammer, or torch lamps which are turned on by using a torch on it. |
I DID read that, and to me there is nothing wrong with what i coded.
|
x+1.5
y+1.5 I find triggeraction woorks better when in the middle of the npc/player. |
I doubt this is possible, but can you use a call for a function via CLIENTSIDE and have the function DEFINED serverside?
---Shifter |
Quote:
|
Figured as much. Never tried it, lolz.
---Shifter |
| All times are GMT +2. The time now is 12:21 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.