OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Mike on 07 Nov 2002, 03:55:31
-
How can I use Hint to show something different to each player.. In other words how do I hint to only one player?? Plz help
-
I'm not sure, I don't know much about mp editing but something like this could work
? unitname1 == player : hint "say something"
? unitname2 == player : hint "say something else"
-
isnt that just adding a condition to the hint line which everyone see's ???
-
oh yeah I never thought of that, the local commmand will probably have somthing to do with it then.
-
Actually, I think this would work:
? unitname1 == player : hint "say something"
? unitname2 == player : hint "say something else"
but if it doesn't you can try using a local check too:
?((local player1) && (player == player1)):hint "player1 hint"
?((local player2) && (player == player2)):hint "player2 hint"
?((local player3) && (player == player3)):hint "player3 hint"
But then Im not sure if that would make any difference either.
-
well.... heres my script.... and it appears to work.. I have 2 players that basically purchase a $200 Jeep... Now I got another problem related with this script.. I dont know how to get it all to activate with an addaction command. :(
Rep1startingmoney = _this select 0
Rep2startingmoney = _this select 1
RepJ1 = FALSE
RepJ2 = FALSE
? Rep1 distance jeept < 6 : RepJ1 = TRUE
? Rep2 distance jeept < 6 : RepJ2 = TRUE
? RepJ1 : Goto "buyjeep1a"
? !RepJ1 : Goto "buyjeep1b"
? RepJ2 : Goto "buyjeep2a"
? !RepJ2 : Goto "buyjeep2b"
#end
RepJ1 = FALSE
RepJ2 = FALSE
exit
#buyjeep1a
? RepJ1 : Rep1startingmoney = Rep1startingmoney - 200
#buyjeep1b
_msg=Format["Money: $%1",Rep1startingmoney]
Hint _msg
Goto "end"
#buyjeep2a
? RepJ2 : Rep2startingmoney = Rep2startingmoney - 200
#buyjeep2b
_msg=Format["Money: $%2",Rep2startingmoney]
Hint _msg
Goto "end"
The hint part Seems to only hint to one player.. unless its hinting both players and Im seeing the right result each time.. .. I dunno :\
I want each player to be able to activate this script with the addaction but to know which player activated.. Ive tried:
BuyJeep = Player1 AddAction ["Buy Jeep $200", "[Rep1startingmoney,Rep2startingmoney] exec "jeep.sqs"]; BuyJeep = Player2 AddAction ["Buy Jeep $200", "[Rep1startingmoney,Rep2startingmoney] exec "jeep.sqs"];
but it wont let me do it like that.. theres a problem in the script exec line..
-
it looks like you have a unneeded "
try this line
BuyJeep = Player1 AddAction ["Buy Jeep $200", [Rep1startingmoney,Rep2startingmoney] exec "jeep.sqs"];
-
I just took out the:
Rep1startingmoney = _this select 0
Rep2startingmoney = _this select 1
then activated with normal:
BuyJeep = Player1 AddAction ["Buy Jeep $200", exec "jeep.sqs"]
and it worked.. but thanks for noticing the flaw :)
-
Not sure if you can pass variable to a script using the AddAction command, which is quite frankly a pain in the arse. BUT if you wanted to be able to detect WHO buys the jeep (player one or player2) praps creating two seperate scripts (one for each player) and simply calling the buyjeep script from within them. That might sound complex but here is an example
(BTW you do not need EXEC in the addaction)
BuyJeep = Player1 AddAction ["Buy Jeep $200", "jeepp1.sqs"];
BuyJeep = Player2 AddAction ["Buy Jeep $200", "jeepp2.sqs"];
jeepp1.sqs CONTENTS:
[Rep1startingmoney,Rep2startingmoney,1] exec "jeep.sqs"];
EXIT
jeepp2.sqs CONTENTS:
[Rep1startingmoney,Rep2startingmoney,2] exec "jeep.sqs"];
EXIT
NOTE: the 1 and 2 variables added to the list... This way the player number who called the script will be sent to the jeep.sqs script..
I have no idea if I just answered a question for you or made things more difficult - if so my appologies :)
Ciao ciao
Adam
-
any help is good. Thanks :cheers:
-
I wrote my script over.. and tested it with a few different meathods... and Im still only getting 1 player alone that is getting the messages... and im attempting to message all players, but individually.. I attached my script.. if anyone knows why it isnt working lemme know. The script works in conjunction with a few other scripts.. basically to actually create the jeep and to add the action to the player to be able to buy the jeep...