Jump to content
Heeeere's johnny!

How to use a variable from another pbo file?

Recommended Posts

2) You want this to display to the entire server?

1) Hm, is possible, but the storage of such data is the main issue here.

Share this post


Link to post
Share on other sites

Lol, nvm didn't see the last part.

For the killer messages, this will be fairly simple to do. I would go the route of modifying the script that posts those kill messages.

Look for this line of script in the server_playerDied.sqf


if (KillMsgsIngame) then {
[nil, nil, rspawn, [_killer, _message], { (_this select 0) globalChat (_this select 1) }] call RE;
};

So lets get a little creative here. You want only the killer to see something? Well how about we send him a group message? Since every player is in their own group, you can easily do this and only that person will see it! So lets change it to reflect this:


[nil, nil, rspawn, [_killer, _message], { (_this select 0) groupChat (_this select 1) }] call RE;

Then simply reformat the _message (you will see it in that script) to reflect what you want to display =) AND everything is handled server side, yay!

Edited by dayz247

Share this post


Link to post
Share on other sites

Yeah, well I already know this from the blue print I found on the web. I have those kill messages already in.

But imagine I wanted to add a line saying something like: "Congratulations, that was your 100th headshot", or whatever, how would that be done? In the mission file, it would be called with "player getVariable ...".

I'm asking, because I'd like to have a blue print, because I've got some ideas still, but don't really know if I could implement them because I don't know if the messages could work...

Edited by Heeeere's Johnny

Share this post


Link to post
Share on other sites

On the server side.... headshots is a global variable "headShots" (as is "humanity", "humanKills", "banditKills", and "zombieKills" among others).

Maybe (floating an idea here):

Create a new global variable: oldHeadShots

Save the value of headShots to oldHeadShots

Everytime a player is killed: compare oldHeadShots to headShots

If (headShots == 100 && oldHeadShots == 99) {

rhint: "congratulations that was......."

}

To determine if you want to do this client or server side you need to balance memory usage (due to number of variables present on server) vs network usage (sending the new variable to the client everytime they kill someone).

Sorry about late reply, had some fires to put out.

  • Like 1

Share this post


Link to post
Share on other sites

Hey dude,

don't apologize for a delayed answer. This is a game without which life will go on anyway.

I had some PC problems the past dayz which is why I couldn't answer you. I ain't got any time at the moment. But I will let you know when I worked on the pbos again.

But something which seems "unsafe" to me in the first view is this If (headShots == 100 && oldHeadShots == 99).

I fear that this would be inaccurate, because this statement runs instantly when a player shoots a zombie or another player in the head. But probably the headShot counter does not update instantly and (even more important) before this statement is run and the message is sent.

So, I probably wouldn't do it that way...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×