• 🏆 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!

Jass function... probably

Status
Not open for further replies.
Level 13
Joined
Sep 13, 2010
Messages
550
I am really thinking on a jass function like GetTriggerPlayer which makes an instance for a trigger which will not be cleared up until the trigger not finishes. You know maybe how do this function work. So my question is how to make sthing like these but with other types and is it possible?
 
Isn't that point of JASS xD

native GetTriggerPlayer takes nothing returns player

This is how the function is found in the common.j file (or Blizzard.j ; I'm not so sure :p)

You can create your own function:

JASS:
function Blekh takes nothing returns integer
    <your code here>
endfunction

This is a function

You call it like this: call Blekh()

Could you please clarify your question?
I don't understand exactly what you want.
 
Level 13
Joined
Sep 13, 2010
Messages
550
I know that. I really think about something else. DRAWINGTIME^^:
attachment.php

Roughly this is it. The main thing is that I have a quest system NOT WITH quest type so they are indexed from 1-999. And ie a player abandons a quest then an user defined trigger run. It's MPI so much likely wants to use sthing like GetQuestTriggerPlayer( ) and GetTriggerPlayer( ) will return nothing because trigger is just executed, not with events. But if waits and it calls it again it MUST have the same Player like the previous one. For only one player it is quite all right but not for more triggers running in the same time. Well the easiest is to use locals but there are not as good jassers.
 

Attachments

  • SthingLikeThis.JPG
    SthingLikeThis.JPG
    60.8 KB · Views: 146
You should make the function takes a player.

function GetQuestTriggerPlayer takes player p returns nothing

Btw, that picture confused me ALOT

And btw, you can use GetTriggeringTrigger to specify the current trigger
just incase you didn't know :p


------------------------------------------------------------------------------------------
I seriously dunno what you want, so here's some general info you should know:

When you wanna do something for one player ONLY:

Use:
JASS:
if GetLocalPlayer() == Player(0) then
    bla bla bla
endif

The above if/then/endif block can be used to do some very special shit.
You can use it to create a different multiboard for each player.

In this case, you can create a new multiboard that only Player 1 can see.

Here's some more general info.

Btw, if you want to register an event for all players, just use a loop like this:

JASS:
local integer i = 0

loop
    exitwhen i > 11
    call TriggerRegisterEventBlablabla(Player(i), eventblablabla)
    set i = i + 1
endloop
 
Level 13
Joined
Sep 13, 2010
Messages
550
I was testing it pretty much but what if that trigger is running in 3 times so it is running in 3 thread? All will get the same as the 3rd one( btw I will not draw again... ). I think I have the right way... I will create one new trigger and add to database attached the good value. So the trigger will just run only once coz adding the action and kill with call DestroyTrigger( GetTriggeringTrigger( ) ) . The only disappoint is the action of trigger... I cant get the original's action. :S If you found a better way just tell me. I am really interested in that.

EDIT: As I said it is not as easy due not event call. Cannot called be event. You better to know that I know almost anything of jass except vJass and Zinc etc. Do not give me tutorial ^^. I have ExecuteOnAbandon( trigger Trig , integer QID) and DenyExecuteOnAbandon( trigger Trig , integer QID) so there needs that getquesttrigger one..
 
Warcraft III is Single-threaded actually :)

For each trigger, you can register a value in an array.
Each trigger will have its own value. When you want to know
what trigger executed, you could call a function GetLastExecutedTriggerId which is not native, but you could make it return an integer like this:

JASS:
function GetLastExecutedTriggerId takes nothing returns integer
    return TrigId
endfunction

Whenever a trigger runs, it sets TrigId to it's corresponding value.
You should also create a trigger array.
Trigger #1 would have a value of 1
Trigger #2 would have a value of 2

To know what trigger had just executed, it would be this:

Trigger[GetLastExecutedTriggerId()]

Or, so it doesn't look like a BJ ;P:

Trigger[TrigId]
 
Level 13
Joined
Sep 13, 2010
Messages
550
Well yeah that is an other option, but as I said non-system triggers for quest are defined by other users and here's the problem if they not put that in. Much easier if they save GetTrigger thing to a local variable coz the value at the point of trigger execution is OK coz the one threaded thing
Do not give me tutorial ^^
= I know that :). Your one like GetTriggerExecCount() except that your id lasts forever... Well I think I will use ExecuteOnAbandon( code Trig , integer QID) that would make things easier. And user still have trigger so can add Wait and other Trigger related function.... Btw thanks for trying help me and +Rep.

Anyway I really look for a better solution! + Rep if someone can do that I really want! ^^
 
Status
Not open for further replies.
Top