Custom Variables and conditionals

Status
Not open for further replies.

Joat

Gum Phoenix
Well, this probably can’t be done without hacking into the program, but is there a way to establish custom variables and conditionals? I mean creating a variable (such as Sector1Entered), then checking it later on (an if/then conditional).
 
If hacking (or editing the source, but I like to call it hacking) is the only way, how do I do that? And how do I check it later on in a map script?
 
Lucky I already know Java. From there, it should be relatively easy. I mean, I’ve learned new programming languages for smaller reasons.

Then again, unless there is a way to do an if/then check activated by something on the map, it might be a waste of time.
 
..I think you might be looking for linedef executors. They activate when a player is inside the sector, and then execute a series of commands, all done inside the map without any extra scripting.

Need an example? Mystic Temples.
 
The current linedef executors don’t really do what I want them to.

Alright, here’s what I want.

I plan on creating a game with ‘adventure fields’. All the levels in one adventure field must be completed before the player can enter the next one. However, there is no linedef for that.

Let me demonstrate what I want to do in a sort of coding form.

When the adventure field is first entered, this activates:
Code:
var level1-1 = 0 //this is turned to 1 when the first level of the adventure field is done.
var level1-2 = 0
var level1-3 = 0

I’m using something similar to Spidermonkey for this example. It should be easy to figure out. Anyway, I need another script to then be able to check those variables and do something only if all the level variables are set to 1.
 
A cheap way of doing this would be to grant an emblem at the end of a level/boss. This you'd have to do by finding a way to force the character to earn the emblem. (Possibly a small level that starts them right at the emblem & end sector in one place?) Also, you'd have to set the rewards to open a new adventure field map with the new path open. Meaning copy/pasting the whole map, and applying the small difference.

Cheap, yes. Takes up space, yes. But it also works. The only way I know of. May be possible without being so totally cheap, but I haven't heard of a way.

EDIT: Segmint, Linedef Executors only last for the duration of one level. They can't set a global variable, meaning he can't make what he wants with linedef execs alone.
 
Segmint said:
WELL SORRY, it's not like what he's saying is absolutely clear.

Joat said:
The current linedef executors don’t really do what I want them to.

...

Segmint said:
WELL SORRY, it's not like what he's saying is absolutely clear.

Joat said:
Alright, here’s what I want.

I plan on creating a game with ‘adventure fields’. All the levels in one adventure field must be completed before the player can enter the next one. However, there is no linedef for that.

...

Segmint said:
WELL SORRY, it's not like what he's saying is absolutely clear.

Joat said:
Let me demonstrate what I want to do in a sort of coding form.

When the adventure field is first entered, this activates:
Code:
var level1-1 = 0 //this is turned to 1 when the first level of the adventure field is done.
var level1-2 = 0
var level1-3 = 0

...

Segmint said:
WELL SORRY, it's not like what he's saying is absolutely clear.

Joat said:
I’m using something similar to Spidermonkey for this example. It should be easy to figure out. Anyway, I need another script to then be able to check those variables and do something only if all the level variables are set to 1.

It all seems rather straightforward to me. :\
 
Dark Warrior, your idea of emblems could work, but it is also impractical in a way. First, emblems cannot be saved in a save file. If an emblem is gained in one game, it is gained in all of the play-throughs.

Besides, how would I go about making something happen depending on how many emblems the player has?

In the end, I may go about it in a similar way, but with chaos emeralds, not emblems.
 
=P

I mean, if he could explain what he actually wants in his freaking adventure field (like EXACTLY WHAT HE WANTS TO HAPPEN; Example: When player does a, that activates b, but please replace the variables with WHAT THE PLAYER NEEDS TO DO TO ACTUALLY CLEAR IT). If you did that, maybe I could figure out a more suitable way to do it in SRB2.
 
What I need is for when a player clears one of the levels in the field, it activates something. When all of those somethings in an adventure field are activated, the player can access the next adventure field.
 
I don't believe individual chaos emeralds can trigger a global variable. Also, SOCs determine how many emblems unlock what. And, yes, emblems are saved in a save file if SRB2 is told to, also by a simple SOC variable. The specific variable escapes me, but you can find it in Mystic Realm's MAINCFG.
 
Joat said:
What I need is for when a player clears one of the levels in the field, it activates something. When all of those somethings in an adventure field are activated, the player can access the next adventure field.

Yes, but WHAT DOES THE PLAYER HAVE TO DO TO CLEAR IT? Argh. I mean, there are tons of ways a player can clear a level, but you have to explain exactly how it has to be cleared.
 
He wants global triggers.

If a player beats a level, it adds to a global value.

When the value reaches a certain point, a new adventure field is unlocked.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top