• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Own only one (LOAP) Job

Status
Not open for further replies.
Level 4
Joined
Nov 17, 2015
Messages
91
Hello! I made a standard LOAP job, the entire thing works just how I want it to, but there is one problem.

I'd like players to be unable to run around claiming every job on the map. Is there a way to group all the jobs up and make a condition that checks if they already have one?

Here is my current script:
jpg_by_darkvinylscratch-d9h250p.jpg


Thank you all for your replies in advance. I appreciate them greatly! :goblin_good_job:
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
You use a boolean array to represent players having a job. The array index is the player slot meaning it is a mapping from a player to a unique boolean variable.

When a player tries to get a job and the boolean is false it succeeds as the player does not have a job. When a player gets a job you set the boolean to true for that player since he now has a job. If they try to get another job and the boolean is true it fails because the player already has a job. If they quit their job you set it to false because the player no longer has a job.

This quite literally translates into English as "If player has a job, then he cannot get another job".
 
Level 4
Joined
Nov 17, 2015
Messages
91
You use a boolean array to represent players having a job. The array index is the player slot meaning it is a mapping from a player to a unique boolean variable.

When a player tries to get a job and the boolean is false it succeeds as the player does not have a job. When a player gets a job you set the boolean to true for that player since he now has a job. If they try to get another job and the boolean is true it fails because the player already has a job. If they quit their job you set it to false because the player no longer has a job.

This quite literally translates into English as "If player has a job, then he cannot get another job".

With pictures so the new born can understand? :goblin_cry:
Toddlers to triggers love picture books! :goblin_good_job:
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
You have not explained your API enough for me to write relevant scripts for it.

In any case here are some triggers which hopefully demonstrate how to implement the idea in GUI.

  • Take Job 1
    • Events
    • Conditions
      • HasJob[(Player number of INSERT_PLAYER_HERE)] Not equal to True
    • Actions
      • Set HasJob[(Player number of INSERT_PLAYER_HERE)] = True
      • -------- job initalization actions here --------
  • Quit Job 1
    • Events
    • Conditions
      • HasJob[(Player number of INSERT_PLAYER_HERE)] Equal to True
    • Actions
      • Set HasJob[(Player number of INSERT_PLAYER_HERE)] = False
      • -------- job quit actions here --------
Substitute fields appropriately to suit your implementation.
 
Level 4
Joined
Nov 17, 2015
Messages
91
It worked! Thanks a million!
I'll submit my final product for other people who're having problems in a second here.:goblin_good_job:
 
I don't mean to jump in even though DSG has been providing help, but I'm bored so...

This is what DSG is talking about:
  • Set tempUnit = (Triggering Unit)
  • Set tempPlayer = (Owner of tempUnit)
  • Set tempInt = (Player number of tempPlayer)
  • Set HasJob[tempInt] = TRUE or FALSE

  • tempUnit - Unit variable
  • tempPlayer - Player variable
  • tempInt - Integer
  • HasJob = Boolean array
You need the player number to make it MPI so that each HasJob boolean is unique to the player triggering the event. Their number will never change, so their HasJob will always be relevant to them. You don't need to create a variable for each one, the only important variable you need is HasJob[array]. I just hate seeing parantheses within parantheses.
 
Level 4
Joined
Nov 17, 2015
Messages
91
Product 2

Hey thanks for the help guys, you certainly saved me from a headache later in the process. Is this right?
thumb_colourbox4780996_by_darkvinylscratch-d9h81fp.jpg
 
Last edited:
Level 4
Joined
Nov 17, 2015
Messages
91
Hey thanks for the tip! :goblin_good_job:
I think they can just quit job and rejoin job to re-spawn the base item if a troll steals it.
Though its probably primitive compared to what system you have in mind to counter it.
(They can only turn it in for gold anyway if they are the owner of the job)
 
Last edited:
Status
Not open for further replies.
Top