RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[Resolved] [RPGMaker 2k3] Detecting distance/range from event to player?

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 67
RMRK Junior
I'm trying to create an ABS, and I want it so RPG Maker 2k3 would detect the range between a player and an event (NPC/enemy). I want to make it so if the player is right next to the event and hits shift, the Player will 'damage' the enemy (by means of lowering a variable or something). Does anyone know how to do this? Thank you so much.
« Last Edit: July 18, 2011, 07:16:57 PM by samfortunato »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
You can set a variable to the x or y position of any character (event or player). All you'd need to do is check the direction and see if the difference between the player's and event's location is 1 or -1, as the case might be.

**
Rep: +0/-0Level 67
RMRK Junior
How do you check the difference between two variables? I know you can do greater than or less than, equal to etc., is that all I have to do? Or is there a way to check if there is a specific number difference, i.e. a difference of 1 like you said? Unless I'm confused...

EDIT: Resolved; found a way to figure out the calculations. The tutorial I found it from is here: http://rpgmaker.net/tutorials/16/ to detect 'square' proximity (I think, not sure if it's circle; i only tested it out with a distance of 1) if anyone wants to do this.
« Last Edit: July 18, 2011, 07:16:45 PM by samfortunato »