Sign in to follow this  
Followers 0
«  ✦Fear✦  »

Help me with my script, please.

2 posts in this topic

Posted (edited)

I have a problem.
The AI I am using are zombies, which are being spawned by a spawner in game, which spawns 'waves' of zombies, but these zombies dont award cash, however normal, pre-spawned AI from the EDEN editor do.

My files:

Money variable
_player setVariable["HG_myCash",500];

    Add action to player
_player addAction["<img image='HG_SWSS\UI\gun.paa' size='1.5'/><t color='#FF0000'>Open Weapons Shop</t>",{["HG_DefaultShop"] call HG_fnc_dialogOnLoadItems},"",0,false,false,"",'(alive player) && !dialog'];


_player setVariable["cash",500];


if (side _x == east) then {
_x addMPEventHandler ["MPKilled", {
(_this select 1) setVariable ["HG_myCash", ((_this select 1) getVariable "HG_myCash") + 200];
hint format ["You have been awarded $200"];
} forEach allunits; 


Edited by « ✦Fear✦ »
Codes were not quoted correct.

Share this post

Link to post
Share on other sites

You need to do more than this. You have to first get the variable of a players money, then you set that + whatever value you use. After that you need to push it to the database. Check DMS coding how we do it. You also need to apply this on all the AI spawned units. It's recommended not to use forEach allunits because that would cause conflicts.



Share this post

Link to post
Share on other sites

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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.