Announcement: Be excellent to each other.


Caravel Forum : DROD RPG Boards : RPG Feature Requests : Get variable at (Like "set var at" but for reading instead of setting)
New Topic New Poll Post Reply
Poster Message
Xindaris
Level: Smitemaster
Avatar
Rank Points: 1832
Registered: 06-13-2015
IP: Logged
icon Get variable at (+1)  
The "set var at" commands let you change the stats of even a normal monster.

It'd be helpful for certain applications if there was also a "get var at" command that puts the given thing (stats, description, etc.) into a return variable or something.

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text

09-05-2025 at 05:59 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
hyperme
Level: Smitemaster
Avatar
Rank Points: 1624
Registered: 06-23-2006
IP: Logged
icon Re: Get variable at (+1)  
You can use the _EnemyStat primitive function in a Set var command (or other commands that support resolving equations) to extract the standard monster stats.

For various predefined vars, it should be possible use Set var at for that as well. When it resolves and equation, it does so as the character at the specified position, meaning its local values will be used. So you can set a global var equal to _MyHue, for example, and that will extract the value from the character.

____________________________
[Insert witty comment here]
Qzvlkx?
09-06-2025 at 10:48 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 1832
Registered: 06-13-2015
IP: Logged
icon Re: Get variable at (+1)  
Maybe I misunderstand what you're saying, but the following code doesn't seem to work the way you're suggesting:

Click here to view the secret text


The "set var" commands work as expected, setting "totalatk" to 0, then 1, then 2. At (10, 8) is a vanilla Mad Eye, so I would expect at least one of those "set var at" commands to add 95 to "totalatk", but instead they evidently do nothing.

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text


[Last edited by Xindaris at 09-06-2025 11:32 PM]
09-06-2025 at 11:31 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Nuntar
Level: Smitemaster
Avatar
Rank Points: 5544
Registered: 02-20-2007
IP: Logged
icon Re: Get variable at (+2)  
_EnemyATK is a variable. hyperme is talking about the _EnemyStat function primitive. (There is a list of these, together with syntax, below the list of predefined variables in the F1 help.)

Here's an example script that reads the ATK of a monster at (10,8):
  Set var "TotalAtk" = 0
  Set var "TotalAtk" + _EnemyStat(10,8,1)
  Speech "$TotalAtk$",Normal,Self,0,.


The third parameter of _EnemyStat is 0 to read the HP, 1 for ATK and 2 for DEF.

____________________________
50th Skywatcher
09-07-2025 at 04:14 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 1832
Registered: 06-13-2015
IP: Logged
icon Re: Get variable at (+2)  
Okay, that's buried deeper than I'd looked. This should make my dumb custom thing work great. Sorry, and thanks!

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text

09-07-2025 at 04:25 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD RPG Boards : RPG Feature Requests : Get variable at (Like "set var at" but for reading instead of setting)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.9
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.