Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Adding Variables

2 years ago
Okay, so complete newb question, but how do I properly add variables? I'm playing around with making a combat system and I'm following the instructions given with how they'd be added, but it isn't working. Specifically, I'm trying to add a static variable to a random one.

For example, I'm trying to set it up where the damage/attack rolls for the characters and monsters are random each time (that's gone well) and I can add or subtract things from that roll to add an extra element to the combat. So it would look something like this upon the monster attacking:

%MONSTDAM := 4D4

PLYR1HP := PLYR1HP - (%MONSTDAM + 6)

I use the reset function for the monster's damage and that works by itself, but it ignores anything I try to add to it. In this example, the monster's overall damage shouldn't be lower than 10. I've also tried subbing the 6 on its own with a variable that's set at 6, but to no avail. Any advice? Am I missing something?

EDIT: Nevermind, I figured it out what I was doing wrong.

Adding Variables

2 years ago
Great, excellent. Good talk, I'm glad we could resolve this.

Adding Variables

2 years ago


You could have explained what you were doing wrong. Maybe would help someone else in the future.

Adding Variables

2 years ago
^ This has happened to me more times than I can count

Adding Variables

2 years ago
Yeah, fair point.

I just needed to remove the space between the addition of the variables and it worked fine.

Instead of

PLYR1HP := PLYR1HP - (%MONSTDAM + 6)

It should be

PLYR1HP := PLYR1HP - (%MONSTDAM+6)

Removing that space has been working for these types of variable interactions so far.

Adding Variables

2 years ago
Well, whatever you did to fix it, that was not it, as scripting ignores all spaces and line breaks that are not between quotes...

Your scripting could literally be one giant wall of text with no spaces and still run fine.

Adding Variables

2 years ago
Just realized I still typed it wrong. It was

PLYR1HP := PLYR1HP-(%MONSTDAM+6)

In any case, I’m not sure what I did if that was not it. I was trying several things to fix the issue and I was testing it as I did something new, and that’s what ended up working for me.