This forum is locked and will eventually go offline. If you have feedback to share you can find us in our Discord channel "MythoLogic Interactive" https://discord.gg/nECKnbT7gk

Forum rules

Tag the Player who enters an Area.

Here you can find answered ScriptAPI topics.
Forum rules
By using the forum you agree to the following rules.
Locked
User avatar
TheOriginalCj
Moderator
Moderator
Posts: 177
Joined: Tue Mar 15, 2016 10:28 pm
Title: Lifetime Sentence to SF Wiki
SFD Alias: RedneckJed
Started SFD: PreAlpha 1.1.0
Location: USA
Gender:
Contact:

Tag the Player who enters an Area.

Post by TheOriginalCj » Tue Apr 12, 2016 6:18 am

In an AreaTrigger, is the Caller the IObject/IPlayer who enters/leaves the AreaTrigger? If so, how would I add a tag to them if I wanted to trigger a certain event to happen to that player at a later time?
0 x
Superfighters Wiki Founder
The Superfighters Wiki
Join the Wiki!
Danger Ross wrote: What are you doing here wiki-slave?! GET BACK TO WORK!

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1887
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 36

Post by Gurt » Tue Apr 12, 2016 6:45 pm

You can't "tag" objects using a custom Tag property. Instead save the unique ID of the object to a hashset, list, array or variable (whatever your preferred method is) and check if you have stored the unique ID in those variable(s).
0 x
Gurt

User avatar
TheOriginalCj
Moderator
Moderator
Posts: 177
Joined: Tue Mar 15, 2016 10:28 pm
Title: Lifetime Sentence to SF Wiki
SFD Alias: RedneckJed
Started SFD: PreAlpha 1.1.0
Location: USA
Gender:
Contact:

Post by TheOriginalCj » Tue Apr 12, 2016 10:31 pm

Alright, but I will be calling the variable I'll be "tagging" in a seperate function, does the API support a type of global variable in its current state?
0 x
Superfighters Wiki Founder
The Superfighters Wiki
Join the Wiki!
Danger Ross wrote: What are you doing here wiki-slave?! GET BACK TO WORK!

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1887
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 36

Post by Gurt » Wed Apr 13, 2016 6:08 pm

Sure.
Just declare the variables outside your functions. Use static if you need to cross-access them from inside other classes.

Code: Select all

bool TestA = false;
static bool TestB = false;

public void OnStartup()
{
	TestA = true;
	TestB = true;
}

public class Foo 
{
	public void Bar() 
	{
		TestB = true;
	}
}
0 x
Gurt

User avatar
TheOriginalCj
Moderator
Moderator
Posts: 177
Joined: Tue Mar 15, 2016 10:28 pm
Title: Lifetime Sentence to SF Wiki
SFD Alias: RedneckJed
Started SFD: PreAlpha 1.1.0
Location: USA
Gender:
Contact:

Post by TheOriginalCj » Wed Apr 13, 2016 7:47 pm

Gurt wrote:Sure.
Just declare the variables outside your functions. Use static if you need to cross-access them from inside other classes.

Code: Select all

bool TestA = false;
static bool TestB = false;

public void OnStartup()
{
	TestA = true;
	TestB = true;
}

public class Foo 
{
	public void Bar() 
	{
		TestB = true;
	}
}
Excellent. It's a bit different from source C where your PC doesn't like you if you do that. Thanks Gurt!
0 x
Superfighters Wiki Founder
The Superfighters Wiki
Join the Wiki!
Danger Ross wrote: What are you doing here wiki-slave?! GET BACK TO WORK!

Locked