DanteMccloud

Calling Script from outside mission PBO

31 posts in this topic

Hello all,

I've searched high and low and I'm just flat confused now haha. Here is the issue...

I have a Script that I'm trying to call with a killed EventHandler. That part works perfectly but I have the script stored in my mpmissions/exile.altis/scripts folder and I think that is what is causing the issues. This script is rewarding the player with Poptabs and respect for killing Ai from a Mod. The script itself I'm pretty sure works as it's not tossing any errors in RPT and an almost identical version of it is used by another functional AI script. 

I notice most Ai scripts run as PBO that is stored within @ExileServer and not from the Exile.Altis mission pbo which leads me to think that I need to store and call the script from @ExileServer instead of the mission PBO.  Is that the case? Also how would I do that?

i currently use the below to call the script however that will only call from within the Mission PBO is there a way to call from the @ExileServer section?

execVM "Scripts\Rewards.sqf";

It could be my script not doing the job but i think it has more to do with being called from inside the mission folder instead of the ExileServer folder

Share this post


Link to post
Share on other sites

If the client is running the script it needs to be in the mission PBO so they can access. Clients cannot access scripts on the server without additional unnecessary work.

Share this post


Link to post
Share on other sites
Advertisement

Here's the current layout, maybe I'm doing something wrong.

It's currently in the Mission PBO.

Exile.Altis/Zombie/Zkilled.sqf ... I turn Exile.Altis into a PBO and it runs on the dedicated server as intended.
In game when a player kills Zombie from the Ravage Mod. Zombie dies and uses the CBA Killed EventHandler which uses

[(_this select 0), (_this select 1)] execVM "zombie\ZKilled.sqf";

to call the script that should give the player Respect. So far I have confirmed it is calling the script cause I was getting errors in RPT and removed/fixed the errors now it doesn't show any issues in RPT but instead does nothing. Below is the script am I missing something?

private [
"_ai",
"_aikiller",
"_playerRespect",
"_repChange",
"_playerMoney",
"_repChange"];

_ai           = _this select 0;
_aikiller         = _this select 1;


//Scoring
if ((alive _aiKiller) && (isPlayer _aikiller)) then {
		
		//Respect change start
		_playerRespect = _aikiller getVariable ["ExileScore", 0];
		_playerMoney = _aikiller getVariable ["ExileMoney", 0];

		_repChange = 5;
		
		_playerRespect = _playerRespect + _repChange;
		_aikiller setVariable ["ExileScore",_playerRespect];

		_fragType = [[format ["%1 Kill",_ai_type],_repChange]];
		[_aikiller, "showFragRequest", [_fragType]] call ExileServer_system_network_send_to;

		ExileClientPlayerScore = _playerRespect;
		(owner _aikiller) publicVariableClient "ExileClientPlayerScore";
		ExileClientPlayerScore = nil;

		format ["setAccountMoneyAndRespect:%1:%2:%3",_playerMoney ,_playerRespect ,getPlayerUID _aikiller] call ExileServer_system_database_query_fireAndForget;
		//Respect change end

    };

The end goal is to grant the player Respect or Poptabs from killing zombies similar to when they kill Ai from DMS and Sarge-Ai. When I test it the respect and poptabs do not increase and no messages pop up or anything.

Share this post


Link to post
Share on other sites
2 hours ago, kuplion said:

Why not just use ExileZ Mod?

It does everything in that outdated script and more.

kinda brings it back to the original though of is there something in that script or post that I did wrong that would cause the Respect to not be givin to the player? As a coder I’m more interested in learning what I did wrong that causes it to not work.

 

I can look into it. Ravage i don’t think is that outdated it’s been updated fairly recently i think? That doesn’t really explain the issue with the script and such though :P I was under the impression the zombies from ExileZ worked the same as RyanZombies which we wanted to avoid anything RyanZombie related cause well... anyone that has used RyanZombies know they leave a lot to be desired. ExileZ wouldn’t work with Ravage I assume so we would have to swap ravage zombies for RyanZombies wouldn’t we? I'm game to try it out I suppose but I don't remember RyanZombies being anything but glitchy last time I played with them (be it on my server or other servers). I by all means do not mean to rag on them but I personally haven't met anyone that prefers RyanZombies over Ravage style zombies. I'm downloading and adding it to the test server currently now though to see if they are as rough around the edges as I remember.

EDIT: Seem's some of the functions that Ravage has it has with this, others are missing but can be coded in without much issue. I still never figured out why the respect reward script up above wasn't working though haha. Will continue to test with this to make it meet our needs thank you for linking it ^.^

Edited by DanteMccloud

Share this post


Link to post
Share on other sites
16 minutes ago, kuplion said:

Do you not like Ryan Zombies? xD

It's not that I dislike them, The reputation they have plus my past experiences soured them for me a bit. 2 years ago or so is my last experience with them and at that time they were subpar better than the zombies in A2 Dayz but not by much. I suppose that isn't fair though as it's been quite some time since I've played with them and they have almost positively been updated significantly since then. Before they didn't have very good configuration which sounds like ExileZ fixes that. I'm definitely interested in seeing the changes and if they have been cleaned up, plus the infection sounds dope!

I am trying to learn more about arma scripting and coding though and from looking at that script I posted and the method used does anything stand out that would cause the rewards to not function though? I'm still fairly new to Arma coding stuff and hate having to rely on snippets and such from others so trying to learn what went wrong in this case to better understand this stuff moving forward. ^.^ any help is greatly appreciated.

Share this post


Link to post
Share on other sites
On 1/14/2019 at 1:25 PM, kuplion said:

Do you not like Ryan Zombies? xD

I tried playing with the aggressive and moaning on/off settings in ExileZ and within the Z&D Mod itself but none of that stops the player scream only the zombie side screams. I would image that it would be as simple as adding a bit within ExileZ-mod to prevent the "Scream1-9" files from playing similar to how the Moaning and Aggression silencing works?

EDIT: Just in case anyone else would like to do this as well the below is the information related to the scream.

attack.sqf

line 55 			_scream = selectRandom RZ_HumanScreamArray;
line 56				[_target, _scream] remoteExecCall ["say3d"];

line 88				_scream = selectRandom RZ_HumanScreamArray;
line 89				[_x, _scream] remoteExecCall ["say3d"];


fn_preInit.sqf

line 74				RZ_HumanScreamArray = ["ryanzombiesscream1", "ryanzombiesscream2", "ryanzombiesscream3", "ryanzombiesscream4", "ryanzombiesscream5", "ryanzombiesscream6", "ryanzombiesscream7", "ryanzombiesscream8", "ryanzombiesscream9"]; // relative path

line 499 			_scream = selectRandom RZ_HumanScreamArray;
line 500			[_target, _scream] remoteExecCall ["say3d"];

line 575			_scream = selectRandom RZ_HumanScreamArray; 
line 576			[_x, _scream] remoteExecCall ["say3d"];

 

Edited by DanteMccloud

Share this post


Link to post
Share on other sites

Hello @DanteMccloud,

(This may not be the ENTIRE reasons why)

Server Side Scripts:

Prevents 'tampering' with the code as it is on the server

ONLY the server runs this code and NOT the players

 

Client Side Scripts:

ONLY the player runs these scripts

These scripts are REQUIRED by the client to play

 

So, from what I read (skimmed over) in your original post, you can have the script on BOTH server or client.  BUT, in order to have it on the server, the SERVER must be checking EVERY TIME a unit is killed.  Where on the client, it is ONLY when THEY kill someone.

So, in SIMPLE TERMS, if you have 10 players, EVERY TIME an AI is killed, the SERVER must 'check' all 10 players.  BUT, on the client side of things, ONLY this ONE PLAYER who killed would be 'doing the checking'.  And ONLY this computer is checking too.  Not the other 9 clients nor the server.

This means, in the end, the server is NOT checking every player AND no 'extra burden' is placed upon the server.

If I am not wrong, 100% of ALL SCRIPTS could be run from the server, but I doubt the server would be very 'playable'.

Remember:  In Exile at least, the 'heavy lifting' is done by the CLIENTS and NOT the server.  This is the 'idea' of 'Distributed Computing' as the 'workload' is SHARED out amongst other computers and NOT on a SINGLE (server) computer.

 

So, you COULD put it on the server, it is NOT RECOMMENDED as the MANY issues that will arise...  ;)

 

:)

 

  • Like 1

Share this post


Link to post
Share on other sites
23 minutes ago, Z80CPU said:

Hello @DanteMccloud,

(This may not be the ENTIRE reasons why)

Server Side Scripts:

Prevents 'tampering' with the code as it is on the server

ONLY the server runs this code and NOT the players

 

Client Side Scripts:

ONLY the player runs these scripts

These scripts are REQUIRED by the client to play

 

So, from what I read (skimmed over) in your original post, you can have the script on BOTH server or client.  BUT, in order to have it on the server, the SERVER must be checking EVERY TIME a unit is killed.  Where on the client, it is ONLY when THEY kill someone.

So, in SIMPLE TERMS, if you have 10 players, EVERY TIME an AI is killed, the SERVER must 'check' all 10 players.  BUT, on the client side of things, ONLY this ONE PLAYER who killed would be 'doing the checking'.  And ONLY this computer is checking too.  Not the other 9 clients nor the server.

This means, in the end, the server is NOT checking every player AND no 'extra burden' is placed upon the server.

If I am not wrong, 100% of ALL SCRIPTS could be run from the server, but I doubt the server would be very 'playable'.

Remember:  In Exile at least, the 'heavy lifting' is done by the CLIENTS and NOT the server.  This is the 'idea' of 'Distributed Computing' as the 'workload' is SHARED out amongst other computers and NOT on a SINGLE (server) computer.

 

So, you COULD put it on the server, it is NOT RECOMMENDED as the MANY issues that will arise...  ;)

 

:)

 

Thank you ^.^ this is actually very helpful. Basically I'm trying to now figure out how to alter it so that it is being ran similar to how ExileZ does its MPKilled function and have it called when the Player kills the zombie. (Currently working on trying to integrate ExileZ instead of Ravage) but trying to override that super annoying screams which doesn't looks like it'll be too hard actually haha.

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.