All I want to do is have a variable that can have a unique value for each player in MP. I've tried "parm.other.xxx = 1" but all the players on the same team seem to inherit the same value whenever I assign to it.
$player seems to be an array, I guess if it's a hash, something like "$player[local.n].var = 1" inside a for loop could work, but I haven't been able to get it working.
Any help at all would be greatly appreciated. I've been through every scrap of moh doc I can find. If anyone can throw down an example code morsel, that would be excellent. Ultimately, I'd like to have the unique variable value be assigned by a trigger_multiple.
Thanks for your time,
SysQuik
Individual player variables in MP ???
Moderator: Moderators
I actually saw that one, but when I set parm.other.warning from a trigger_multiple, and then did a println of parm.other.warning, all of the players huds listed the new value assigned to what I expected to be only the player that triggered the trigger.multiple. Here's the code:
Code seems simple enough. Player joins the dm, "parm.other.warning = NIL" displays in the hud until the player walks into the trigger, then "parm.other.warning = 1" is displayed in the hud. Now have another player join the dm and as soon as they join "parm.other.warning = NIL" is displayed again in both player's huds. What I would expect to happen is for the 1st player hud to display "parm.other.warning = 1" and the 2nd player hud to display "parm.other.warning = NIL". Since after all parm.other.warning should be unique for each player right? What am I missing? I wouldn't think I'd have to use an array, but if I do could someone post the simplest array that would work?
Thanks for your time and your amazingly fast response!
SysQuik
Code: Select all
main:
thread parm_other_warning_trigger
level waittill spawn
thread trace_parm_other_warning
end
parm_other_warning_trigger:
while ( $parm_other_warning_trigger )
{
( $parm_other_warning_trigger ) waittill trigger
parm.other.warning = "1"
}
end
trace_parm_other_warning:
while (1)
{
iprintln "parm.other.warning = " (parm.other.warning)
wait .3
}
end
Thanks for your time and your amazingly fast response!
SysQuik
At some points your understanding of the scripting language is fundamentally wrong and I'll try to correct that
First of all, the script runs on the server only, and therefore is the same for all players. An iprintln command can't possibly give a different output for different players.
Next, parm.other does not represent a player property. The parm object is a rather mysterious object that can be used for specific script functions, like finding out who triggered something. The parm.other variable is set by any trigger when it's triggered, the value will be the entity that triggered it.
For example, a trigger could set parm.other = $player[2], that is the second player in the $player array.
Then, by typing parm.other.warning = 1, you're actually setting $player[2].warning = 1.
By typing:
println parm.other.warning
you're printing the .warning variable of the last player who triggered something (or NIL if parm.other is NIL (will result in a cannot cast NIL to listener error)).
Anyway I hope this clears up some clouds
First of all, the script runs on the server only, and therefore is the same for all players. An iprintln command can't possibly give a different output for different players.
Next, parm.other does not represent a player property. The parm object is a rather mysterious object that can be used for specific script functions, like finding out who triggered something. The parm.other variable is set by any trigger when it's triggered, the value will be the entity that triggered it.
For example, a trigger could set parm.other = $player[2], that is the second player in the $player array.
Then, by typing parm.other.warning = 1, you're actually setting $player[2].warning = 1.
By typing:
println parm.other.warning
you're printing the .warning variable of the last player who triggered something (or NIL if parm.other is NIL (will result in a cannot cast NIL to listener error)).
Anyway I hope this clears up some clouds
- The Jackal
- Sergeant Major
- Posts: 101
- Joined: Wed May 07, 2003 10:09 am
- Contact:
http://www.planetmedalofhonor.com/rjuka ... guage.htmlsysQuik wrote:Do you know of a document that covers core principals of this sort of thing?
