I am currently playing around with script stuff and noticed that "SpawnSpot" returns a value if it successfully spawns an actor, actually if you spawn an actor with "SpawnSpot" on a map spot and one is blocked, it returns "1" if I have understood this correctly.
But how can I use that in ACS? I mean, how can I restart a spawning script in case SpawnSpot doesn't return 1 but 0? Or how can I proceed through script if it returns 1 as expected?
How does the "return value" work?
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
-
- Lead GZDoom+Raze Developer
- Posts: 49182
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: How does the "return value" work?
You use it like any other return value:
Either assign it to a variable or check it directly with an 'if' statement.
So
Either assign it to a variable or check it directly with an 'if' statement.
So
Code: Select all
script 1(void)
{
int num = SpawnSpot(...);
if (num == 0) restart;
}