• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Make my transmission system perfect please!

Status
Not open for further replies.
Level 19
Joined
Oct 12, 2007
Messages
1,821
Hey there.

I made this MPI transmission system for my orpg but it's not really "perfect" yet. Is there someone out there that would like to help me with it to remove the 'red coloured' functions like "call CameraSetupApplyForPlayer" and "TransmissionFromUnitWithNameBJ" in addition to the waits? I tried to do it withoud waits, but never done so before so couldn't do it withoud.

I also wanted to make a function that whenever a player presses ESC when a transmission/camera action is going on he/she will immediatelly stop the transmission and continue with the normal gameplay. I couldn't make this true because.. mehh. I'm actually more of a terrainer.:grin:

Here's the code of the "system" and the 'testquest' I made:
(note: the map is for 9 players, so the array values of [8] are for the player id's)
JASS:
library CameraPanning

globals
    camerasetup array CameraObject[8][99]
    real array CameraMoveDuration[8][99]
    real array CameraTotalDuration[8][99]
    integer array CameraCount[8]
    
    force array TransmissionReceiver[8][99]
    unit array TransmissionSpeaker[8][99]
    string array TransmissionName[8][99]
    string array TransmissionText[8][99]
    real array TransmissionDuration[8][99]
    integer array TransmissionCount[8]
    
    real array CamTimeLeft[8]
    real array TransTimeLeft[8]
endglobals

function QueueCamera takes player p, camerasetup camera, real moveduration, real totalduration returns nothing
    local integer id = GetPlayerId(p)
    local integer id2

    if CameraCount[id] == 0 then
    set CameraCount[id] = 1
    endif
    
    set id2 = CameraCount[id]
    
    set CameraObject[id][id2] = camera
    set CameraMoveDuration[id][id2] = moveduration
    set CameraTotalDuration[id][id2] = totalduration
    set CameraCount[id] = CameraCount[id] + 1
endfunction

function QueueTransmission takes player p, force players, unit speaker, string named, string text, real duration returns nothing
    local integer id = GetPlayerId(p)
    local integer id2

    if TransmissionCount[id] == 0 then
    set TransmissionCount[id] = 1
    endif
    
    set id2 = TransmissionCount[id]
    
    set TransmissionReceiver[id][id2] = players
    set TransmissionSpeaker[id][id2] = speaker
    set TransmissionName[id][id2] = named
    set TransmissionText[id][id2] = text
    set TransmissionDuration[id][id2] = duration
    set TransmissionCount[id] = TransmissionCount[id] + 1
endfunction

function StartCameraQueue takes player p returns nothing
    local integer cam_i = 0
    local integer trans_i = 0
    local integer id = GetPlayerId(p)
    local integer cend = CameraCount[id]
    local integer tend = TransmissionCount[id]
    local integer crepeater = 0
    local integer trepeater = 0
    local timer timerr
    
    loop
    exitwhen trepeater > tend and crepeater > cend
    if CamTimeLeft[id] < TransTimeLeft[id] then
        call TimerStart(timerr, real time, false, null)
        call TimerGetRemaining
        set TransTimeLeft[id] = TransTimeLeft[id] - 0.50
        call TriggerSleepAction(0.50)
        endloop
        call CameraSetupApplyForPlayer(true, CameraObject[id][cam_i], p, CameraMoveDuration[id][cam_i])
        set CamTimeLeft[id] = CameraTotalDuration[id][cam_i]
        set cam_i = cam_i + 1
        set crepeater = crepeater + 1
    elseif CamTimeLeft[id] > TransTimeLeft[id] then
        loop
        exitwhen TransTimeLeft[id] < 0.50
        set TransTimeLeft[id] = TransTimeLeft[id] - 0.50
        set CamTimeLeft[id] = CamTimeLeft[id] - 0.50
        call TriggerSleepAction(0.50)
        endloop
        call TransmissionFromUnitWithNameBJ(TransmissionReceiver[id][trans_i], TransmissionSpeaker[id][trans_i], TransmissionName[id][trans_i], null, TransmissionText[id][trans_i], bj_TIMETYPE_SET, TransmissionDuration[id][trans_i], false)
        set TransTimeLeft[id] = TransmissionDuration[id][trans_i]
        set trans_i = trans_i + 1
        set trepeater = trepeater + 1
    elseif CamTimeLeft[id] == TransTimeLeft[id] then
        loop
        exitwhen TransTimeLeft[id] < 0.50
        set TransTimeLeft[id] = TransTimeLeft[id] - 0.50
        set CamTimeLeft[id] = CamTimeLeft[id] - 0.50
        call TriggerSleepAction(0.50)
        endloop
        call TransmissionFromUnitWithNameBJ(TransmissionReceiver[id][trans_i], TransmissionSpeaker[id][trans_i], TransmissionName[id][trans_i], null, TransmissionText[id][trans_i], bj_TIMETYPE_SET, TransmissionDuration[id][trans_i], false)
        set TransTimeLeft[id] = TransmissionDuration[id][trans_i]
        set trans_i = trans_i + 1
        set trepeater = trepeater + 1
        call CameraSetupApplyForPlayer(true, CameraObject[id][cam_i], p, CameraMoveDuration[id][cam_i])
        set CamTimeLeft[id] = CameraTotalDuration[id][cam_i]
        set cam_i = cam_i + 1
        set crepeater = crepeater + 1
    endif
    endloop

    set cend = 0
    set tend = 0
    set trepeater = 0
    set crepeater = 0
    set CameraCount[id] = 0
    set TransmissionCount[id] = 0
endfunction
endlibrary

  • Quest6 Harius
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (==) (Order(attack))
      • ((Triggering unit) is A Hero) Equal to (==) True
      • (Owner of (Triggering unit)) Not equal to (!=) Player 10 (Light Blue)
      • ((Triggering unit) belongs to an ally of Player 10 (Light Blue)) Equal to (==) True
      • (Target unit of issued order) Equal to (==) General Harius 0203 <gen>
      • Cinematic[(Player number of (Owner of (Triggering unit)))] Equal to (==) False
    • Actions
      • Custom script: local player p = GetOwningPlayer(GetTriggerUnit())
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Triggering unit) is in (Units within 200.00 of (Position of (Target unit of issued order)))) Equal to (==) False
          • Then - Actions
            • Unit - Order (Triggering unit) to Move To (Position of (Target unit of issued order))
            • Skip remaining actions
          • Else - Actions
      • Unit - Order (Triggering unit) to Stop
      • Unit - Pause (Triggering unit)
      • Unit - Make (Triggering unit) face (Target unit of issued order) over 0.50 seconds
      • -------- ------------------- --------
      • -------- Start Quest! --------
      • -------- ------------------- --------
      • Custom script: if GetQuestState(GetTriggerUnit(),6)==0 then
      • -------- Queueing --------
      • Set pgroup = (All players matching ((Matching player) Equal to (==) (Owner of (Triggering unit))))
      • Set TempString = Welcome to your greatest nightmare my friend.
      • Custom script: call QueueTransmission(p,udg_pgroup,gg_unit_H00P_0203,"General Harius",udg_TempString,3.00)
      • Set TempString = I'm your host and commander General Harius. You will do what I say and I do not tolerate any objection. Did I make myself clear?
      • Custom script: call QueueTransmission(p,udg_pgroup,gg_unit_H00P_0203,"General Harius",udg_TempString,6.00)
      • Set TempString = Great! Your first task will be easy. I wan't you to kill 12 of the nearby Skeletal Beasts. They're aggressive terrifying beasts that attack every Gryphonwing they can see.
      • Custom script: call QueueTransmission(p,udg_pgroup,gg_unit_H00P_0203,"General Harius",udg_TempString,9.00)
      • Set TempString = Return to me when you're done, and you shall be rewarded.
      • Custom script: call QueueTransmission(p,udg_pgroup,gg_unit_H00P_0203,"General Harius",udg_TempString,3.00)
      • Custom script: call QueueCamera(p, gg_cam_Darius_Camera, 1., 9.)
      • Custom script: call QueueCamera(p, gg_cam_SkeletalBeasts, 3., 7.)
      • Custom script: call QueueCamera(p, gg_cam_Darius_Camera, 2., 5.)
      • -------- EndofQueue --------
      • -------- Starting Camera --------
      • Custom script: call UnlockCamera(GetOwningPlayer(GetTriggerUnit()))
      • Set Cinematic[(Player number of (Owner of (Triggering unit)))] = True
      • Cinematic - Turn on letterbox mode (hide interface) for (All players matching ((Owner of (Triggering unit)) Equal to (==) (Matching player))): fade out over 21.00 seconds
      • Cinematic - Turn cinematic mode On for (All players matching ((Owner of (Triggering unit)) Equal to (==) (Matching player))) over 0.20 seconds
      • Custom script: call StartCameraQueue(p)
      • -------- After the Camera --------
      • Cinematic - Turn off letterbox mode (show interface) for (All players matching ((Owner of (Triggering unit)) Equal to (==) (Owner of (Triggering unit)))): fade in over 1.00 seconds
      • Cinematic - Turn cinematic mode Off for (All players matching ((Owner of (Triggering unit)) Equal to (==) (Matching player))) over 0.20 seconds
      • Custom script: call LockCameraUnit(GetOwningPlayer(GetTriggerUnit()),GetTriggerUnit())
      • Set Cinematic[(Player number of (Owner of (Triggering unit)))] = False
      • Custom script: call StartQuest( GetTriggerUnit(), 6)
      • Custom script: endif
      • -------- ------------------- --------
      • -------- Quest Done? --------
      • -------- ------------------- --------
      • Custom script: if GetQuestState(GetTriggerUnit(),6)==2 then
      • -------- Queueing --------
      • Set TempString = Good job soldier...
      • Custom script: call QueueTransmission(p,udg_pgroup,gg_unit_H00P_0203,"General Harius",udg_TempString,2.00)
      • Set TempString = Sir! The Skeletal Beasts are returning in even greater numbers!
      • Set TempUnit = Cannoneer 0464 <gen>
      • Custom script: call QueueTransmission(p,udg_pgroup,udg_TempUnit,"Gryphonwing Cannoneer",udg_TempString,4.00)
      • Set TempString = Hmm.. Keep up the defense!|nAnd for you soldier. Take this reward, it will aid you in combat.
      • Custom script: call QueueTransmission(p,udg_pgroup,gg_unit_H00P_0203,"General Harius",udg_TempString,6.00)
      • Custom script: call QueueCamera(p, gg_cam_Darius_Camera, 6., 12.)
      • -------- EndofQueue --------
      • -------- Starting Camera --------
      • Custom script: call UnlockCamera(GetOwningPlayer(GetTriggerUnit()))
      • Set Cinematic[(Player number of (Owner of (Triggering unit)))] = True
      • Cinematic - Turn on letterbox mode (hide interface) for (All players matching ((Owner of (Triggering unit)) Equal to (==) (Matching player))): fade out over 12.00 seconds
      • Cinematic - Turn cinematic mode On for (All players matching ((Owner of (Triggering unit)) Equal to (==) (Matching player))) over 0.20 seconds
      • Custom script: call StartCameraQueue(p)
      • -------- After the Camera --------
      • Cinematic - Turn off letterbox mode (show interface) for (All players matching ((Owner of (Triggering unit)) Equal to (==) (Owner of (Triggering unit)))): fade in over 1.00 seconds
      • Cinematic - Turn cinematic mode Off for (All players matching ((Owner of (Triggering unit)) Equal to (==) (Matching player))) over 0.20 seconds
      • Custom script: call LockCameraUnit(GetOwningPlayer(GetTriggerUnit()),GetTriggerUnit())
      • Set Cinematic[(Player number of (Owner of (Triggering unit)))] = False
      • -------- Rewards! --------
      • Custom script: call CompleteReq(GetTriggerUnit(), 6, 2)
      • Custom script: call FinishQuest( GetTriggerUnit(), 6)
      • Hero - Add 82 experience to (Triggering unit), Show level-up graphics
      • Custom script: call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl", GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit())))
      • Sound - Play GoodJob <gen> at 100.00% volume, attached to (Triggering unit)
      • Unit - Create 1 Reward Bag for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing ((Facing of (Triggering unit)) + 180.00) degrees
      • Sound - Play SecretFound <gen> at 100.00% volume, attached to (Last created unit)
      • Unit - Add Permanent Invisibility to (Last created unit)
      • Unit - Add a 180.00 second Generic expiration timer to (Last created unit)
      • Item - Create |cff00ff00Initiate Nightrobe|r at (Position of (Last created unit))
      • Hero - Give (Last created item) to (Last created unit)
      • Item - Create |cff00ff00Hunter's Tunic|r at (Position of (Last created unit))
      • Hero - Give (Last created item) to (Last created unit)
      • Item - Create |cff00ff00Iron Runeplate|r at (Position of (Last created unit))
      • Hero - Give (Last created item) to (Last created unit)
      • Custom script: call CreateQuestEffect(Player(GetPlayerId(GetOwningPlayer(GetTriggerUnit()))), 8)
      • Custom script: endif
      • -------- ------------------ --------
      • -------- UNPAUSE --------
      • -------- ------------------ --------
      • Custom script: set p = null
      • Unit - Unpause (Triggering unit)
 
Status
Not open for further replies.
Top