
Storm
Joined: Dec 19, 2011
Send memes to www.loganpaul.com/cliffhanger
|
Posted: Aug 29, 2018 08:44 AM
Msg. 1 of 2
So I'm testing out a script to create player progression. I can't figure out how to make the script compile where it reads the global "player_experience" as a function in a sleep or condition statement. How would I go about doing this? (global "short" player_level 0)
(global "short" player_experience 0)
(global "short" exp_gain 0)
(script continuous level_up (sleep_until (= (player_experience) 5) 1) (show_hud_help_text 1) (set player_level 2) (hud_set_help_text level_2); and repeat until like level 15 or 20 )
(script dormant test (if (= (ai_living_count enc_test) 0) (set player_experience (+ 0 5)) ) )
(script startup game (ai_place enc_test) (wake test) )
|

DeadHamster
Joined: Jun 8, 2014
https://discord.gg/Neu4EJM
|
Posted: Aug 29, 2018 12:58 PM
Msg. 2 of 2
player_experience is a global, and should be referenced like
player_experience
If you had created a static script named player_experience, then you would reference it like;
(player_experience)
Globals create variables that are called upon as though they were numbers. Static Scripts are functions that are called upon by other scripts to perform a task. This is usually beneficial when you want to perform a function multiple times, or in many separate scripts. Like spawning AI, or updating what vehicle the player is using. Globals are for values you want to perform operations, such as a score, a kill count, or any kind of timer or counter.
|