Scripting: Human-controlled instance of MovementObject
-
- Posts: 5
- Joined: Fri Nov 11, 2011 12:08 pm
Scripting: Human-controlled instance of MovementObject
Is there a way to check if an instance of a MovementObject is human controlled? Maybe a way to get the instance of a human-controlled object?
I am messing with hotspots, and am trying to make a counter of the number of players in a hotspot, and display it on the screen only if you are in the hotspot. Currently, when a non-human player enters a hotspot, it also displays (and removes from display when leaving) the text, which is undesired behavior.
An aside question:
I've seen some video demonstrating splitscreen in OG. Is there a method to display text on only one of the screens, and not the other (preferably a method to designate which player I am displaying the text to)?
I probably should at least test to see if I can get splitscreen working before I try to fix that problem that my script may have with it, but I figured I would ask while I had it in mind.
Another aside:
Yay; my first post! Hehe
I am messing with hotspots, and am trying to make a counter of the number of players in a hotspot, and display it on the screen only if you are in the hotspot. Currently, when a non-human player enters a hotspot, it also displays (and removes from display when leaving) the text, which is undesired behavior.
An aside question:
I've seen some video demonstrating splitscreen in OG. Is there a method to display text on only one of the screens, and not the other (preferably a method to designate which player I am displaying the text to)?
I probably should at least test to see if I can get splitscreen working before I try to fix that problem that my script may have with it, but I figured I would ask while I had it in mind.
Another aside:
Yay; my first post! Hehe
Re: Scripting: Human-controlled instance of MovementObject
Hey there, I love first posts like this =)
As far as I know neither of those are currently possible, but should be eventually.
I may be wrong on the first one though, I haven't looked into it very much, but I'm positive that the game doesn't differentiate well between the split screens yet. I'm sure some of the other guys that have done more scripting can better answer the first part though.
As far as I know neither of those are currently possible, but should be eventually.
I may be wrong on the first one though, I haven't looked into it very much, but I'm positive that the game doesn't differentiate well between the split screens yet. I'm sure some of the other guys that have done more scripting can better answer the first part though.
Re: Scripting: Human-controlled instance of MovementObject
I have a hazy memory of there being a variable in aschar.as that defines an AI-controlled character. I'm not very certain though.
Re: Scripting: Human-controlled instance of MovementObject
Well, if you have the id of any character you can use ReadCharacterID(int id) to get a MovementObject@ and you can pass integer and float functions to them, but I don't think we can count player's yet.
Re: Scripting: Human-controlled instance of MovementObject
The following code is repeated in numerous places throughout level.as, should tell you what you need?
Code: Select all
int num = GetNumCharacters();
for(int i=0; i<num; ++i){
MovementObject@ char = ReadCharacter(i);
if(char.controlled){
...
}
}
-
- Posts: 5
- Joined: Fri Nov 11, 2011 12:08 pm
Re: Scripting: Human-controlled instance of MovementObject
Thank you this has helped. char.controlled was exactly what I needed.
Re: Scripting: Human-controlled instance of MovementObject
For consistency's sake I'm moving this to the modding subforum.