• 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.

Quests

Status
Not open for further replies.
Level 11
Joined
Jun 2, 2013
Messages
613
You could use GetLocalPlayer, but technically this should work (might leak but shouldn't since you're using the All Players Group):

  • Player Group - Pick every player in (All players matching ((Matching player) Equal to YourPlayer)) and do (Quest - Create a Required quest titled YourQuest with the description Your quest desc..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp)
 
Level 4
Joined
Nov 17, 2015
Messages
91
You could use GetLocalPlayer, but technically this should work (might leak but shouldn't since you're using the All Players Group):

  • Player Group - Pick every player in (All players matching ((Matching player) Equal to YourPlayer)) and do (Quest - Create a Required quest titled YourQuest with the description Your quest desc..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp)


Is there any way to stop the leaking?
 
Level 4
Joined
Nov 17, 2015
Messages
91
Set a temp player group variable to your player then use that group to run that action.

Destroy that variable with call
  • DestroyForce(udg_YourForce)

Hey, I made this:
  • Book read
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Farming 101
    • Actions
      • Player Group - Add (Owner of (Triggering unit)) to BookRead
      • Wait 0.10 seconds
      • Player Group - Pick every player in BookRead and do (Actions)
        • Loop - Actions
          • Quest - Create a Required quest titled Book with the description description, using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
      • Wait 0.10 seconds
      • Custom script: DestroyForce(udg_BookRead)
And it gives me this error that is removed upon deleting DestroyForce(udg_BookRead):
JASS:
function Trig_Book_read_Conditions takes nothing returns boolean
    if ( not ( GetItemTypeId(GetManipulatedItem()) == 'I00L' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Book_read_Func005A takes nothing returns nothing
    call CreateQuestBJ(bj_QUESTTYPE_REQ_DISCOVERED , "TRIGSTR_289" , "TRIGSTR_290" , "ReplaceableTextures\\CommandButtons\\BTNAmbush.blp")
endfunction

function Trig_Book_read_Actions takes nothing returns nothing
    call ForceAddPlayerSimple(GetOwningPlayer(GetTriggerUnit()) , udg_BookRead)
    call TriggerSleepAction(0.10)
    call ForForce(udg_BookRead , function Trig_Book_read_Func005A)
    call TriggerSleepAction(0.10)
    DestroyForce(udg_BookRead)
endfunction
 
Level 12
Joined
May 22, 2015
Messages
1,051
I've seen these "TRIGSTR_289" , "TRIGSTR_290" things before and I am curious about them. They seem to appear if you convert a GUI trigger into JASS when the GUI trigger had a large string.

Is this something to worry about? It seems like it is making strings and storing them somewhere. By changing the strings inside those function calls to new strings, am I basically leaking data in the editor?

I noticed another stupid spot you can basically "leak" data in the editor is with abilities. If you make an ability have 100 levels, and change all the data for all the levels, you get a big increase in map size (bunch of kb depending on number of fields you change). However, if you lower the level, it does not fix this. The map size stays. If you change the levels back to 100, you will notice the editor stores all your modified fields. You have to manually reset them before lowering the levels in order to free up that space again.

I just don't want to have pointlessly larger map file size if it is avoidable.
 
Level 11
Joined
Jun 2, 2013
Messages
613
That's basically storing the string of your quest description and quest title. How you edit that once it's in JASS I'm not sure. However, I would imagine it creates it like that regardless of string length. Let's just hope that that data gets deleted :) (you just never know with blizzard)

As far as the ability goes, once you set the 100 levels they will be there until you actually delete the ability. I guess logically just changing the available levels wouldn't fix it because you've already created 100 levels for it. Just think about if you create an array with a size of 1000. Even if you only use the first 10 indices you still have an array of 1000, unless you destroy the array.
 
Level 12
Joined
May 22, 2015
Messages
1,051
That's basically storing the string of your quest description and quest title. How you edit that once it's in JASS I'm not sure. However, I would imagine it creates it like that regardless of string length.

As far as the ability goes, once you set the 100 levels they will be there until you actually delete the ability. I guess logically just changing the available levels wouldn't fix it because you've already created 100 levels for it. Just think about if you create an array with a size of 1000. Even if you only use the first 10 indices you still have an array of 1000, unless you destroy the array.

I expanded the abilities I know I shrunk to 100 levels and reset all the pink fields (wasn't so bad with the autofill thing). My map size dropped by 13kb after fixing 3 abilities. I didn't do anything other than clear the data from level 11-100 which were not used since the max level was 10.

In-game, loading the ability takes the same amount of time, at least from what I can tell (10 levels with whatever data vs 10 levels with the same data and 90 levels of unused data). It only changed the map size. It's because it stores all the pink fields even though I stopped using them.

I'll have to be cautious with those stupid TRIGGER_### strings then. I will just delete the action before changing it to JASS if it does that. Hopefully that clears it lol.
 
Level 11
Joined
Jun 2, 2013
Messages
613
Oh I should probably note that if you ever plan on destroying that quest or updating it, you should be setting a variable to it within the loop.

You could probably give every quest it's own variable with an array to keep up with the respective players, OR create A quest array for each player where each index is a specific quest.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
You could use GetLocalPlayer, but technically this should work (might leak but shouldn't since you're using the All Players Group):

  • Player Group - Pick every player in (All players matching ((Matching player) Equal to YourPlayer)) and do (Quest - Create a Required quest titled YourQuest with the description Your quest desc..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp)

You are NOT using a GetLocalPlayer(), NOR using the Picked player as parameter (which is impossible anyway).
So, this will NOT work.

What you need is this:

- Custom script: set udg_LocalPlayer = GetLocalPlayer()
- If
---- (Owner of (Triggering unit)) is equal to LocalPlayer
- Then
---- Quest - Create quest

However, if a quest is not able to be created locally, you have to do this:

- Custom script: set udg_LocalPlayer = GetLocalPlayer()
- Quest - Create quest
- If
---- (Owner of (Triggering unit)) is not equal to LocalPlayer
- Then
---- Quest - Disable quest
 
Level 11
Joined
Jun 2, 2013
Messages
613
I know I didn't use GetLocalPlayer.

I wasn't able to test it with multiplayer emulation, but I did test it in single player as both Player 1 and Player 2. It only made the quest if I was Player 1.
  • QuestTest
    • Events
      • Time - Elapsed game time is 3.00 seconds
    • Conditions
    • Actions
      • Set YourPlayer = Player 1 (Red)
      • Player Group - Pick every player in (All players matching ((Matching player) Equal to YourPlayer)) and do (Actions)
        • Loop - Actions
          • Quest - Create a Required quest titled Test with the description This quest is a tes..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp

What about it won't work? It may cause a Desync because I haven't tested that, but I can confirm it will only create a quest for the matching player.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Im pretty sure that it will make the quest for player 2 as well.

The thing is that in a GetLocalPlayer() if block, you only run the script for the clients that succeeded on the if statement.
So if GetLocalPlayer() == Player(0), then only Player(0) will run that script.

However, in a ForForce(), you are running the script for ALL players, and you run the script a number of times equal to the number of players inside the group and each time with a different GetEnumPlayer() value.

So "Quest - Create quest" will run for ALL players.
 
Level 11
Joined
Jun 2, 2013
Messages
613
Here, I modified the trigger. Based on what you're saying, we can agree that both quests should show up for Player 1, yes?

  • QuestTest
    • Events
      • Time - Elapsed game time is 3.00 seconds
    • Conditions
    • Actions
      • Set YourPlayer = Player 1 (Red)
      • Set NotYourPlayer = Player 2 (Blue)
      • Player Group - Pick every player in (All players matching ((Matching player) Equal to YourPlayer)) and do (Actions)
        • Loop - Actions
          • Quest - Create a Required quest titled Test with the description This quest is a tes..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
      • Player Group - Pick every player in (All players matching ((Matching player) Equal to NotYourPlayer)) and do (Actions)
        • Loop - Actions
          • Quest - Create a Required quest titled Secret Quest with the description Only Player 2 can s..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
When testing the map, After 3 seconds, only the "Test" quest is created for player 1 but doesn't create the "Secret Quest". (see Image)

I understand how GetLocalPlayer works.

However, theoretically, this trigger creates it only for player 1 because player one is the only player that matches the condition when cycling through 'all players' (returns true).

I could be wrong, but from what I can tell it looks to be working correctly, at least with quests.
 

Attachments

  • test.w3x
    16.9 KB · Views: 38
  • test.PNG
    test.PNG
    361.9 KB · Views: 75
Level 24
Joined
Aug 1, 2013
Messages
4,658
  • Test
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set Force = (Player group(Player 2 (Blue)))
      • Player Group - Pick every player in Force and do (Actions)
        • Loop - Actions
          • Quest - Create a Required quest titled Quest with the description This is a quest., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
      • Custom script: call DestroyForce(udg_Force)
7LPtB9H.png
 
Status
Not open for further replies.
Top