• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] How to make it so quests are only visible to a certain player?

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

How do I make it so a quest is only visible in the F9 log to the player who unlocked/started it?

I'm looking at the API for making quests but there's nothing that takes a Player or pid as an argument...
 
When you create the quest, just disable it globally:
JASS:
local quest q = CreateQuest()
call QuestSetEnabled(q, false)

You can locally enable it:
JASS:
if GetLocalPlayer() == Player(0) then
    call QuestSetEnabled(q, true) // enables only for player(0), a.k.a. Player 1 (Red)
endif
For whichever players you want. You'll also probably want to set a boolean, depending on the player you enable the quest for:
JASS:
if GetLocalPlayer() == Player(0) then
    call QuestSetEnabled(q, true)
endif
set qenabled[0] = true // the index will be the player ID
That way, you can just check qenabled[GetPlayerId(p)] when you need to check if a player "has" a quest. If you use IsQuestEnabled, it may return different values for different players and you'll run into some strange errors.

For more info on GetLocalPlayer(), see:
http://www.thehelper.net/threads/jass-getlocalplayer.77369/
 
Status
Not open for further replies.
Top