General talk about editing, cheating, and deprotecting maps.
Moderator: Cheaters
JJ2197
Legendary Genius
Posts: 1311 Joined: August 8th, 2007, 8:10 am
Title: Legendary Genius²
Location: St. George Utah
Post
by JJ2197 » October 2nd, 2007, 1:22 am
What I am trying to do is make it display a message when a player trains a unit, and I want it to display a differnt message for if player 1 where to build it or player 2 etc...
Heres what I've got...
globals
Functions
Code: Select all
function utp1 takes nothing returns boolean
return ( GetOwningPlayer(GetTrainedUnit()) == Player(0) )
endfunction
function utp2 takes nothing returns boolean
return ( GetOwningPlayer(GetTrainedUnit()) == Player(1) )
endfunction
function isut takes nothing returns boolean
if ( not ( GetUnitTypeId(GetTrainedUnit()) == 'h00A' ) ) then
return false
endif
return true
endfunction
function wptu takes nothing returns nothing
if (utp1())then
call DisplayTextToForce( GetPlayersAll(), "Player 1" )
call DisableTrigger( GetTriggeringTrigger() )
endif
if (utp2())then
call DisplayTextToForce( GetPlayersAll(), "Player 2" )
call DisableTrigger( GetTriggeringTrigger() )
endif
endfunction
function hptu takes nothing returns nothing
set trig = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent(trig,GetTriggerPlayer(),EVENT_PLAYER_UNIT_TRAIN_FINISH,Condition( function isut ))
call TriggerAddAction(trig,function wptu)
endfunction
Function main
What am I doing wrong?
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate
trb92
Senior Member
Posts: 132 Joined: February 20th, 2007, 8:40 pm
Title: Random Noob
Location: Canada!!!
Post
by trb92 » October 2nd, 2007, 3:49 am
Code: Select all
call TriggerRegisterPlayerUnitEvent(trig,GetTriggerPlayer(),EVENT_PLAYER_UNIT_TRAIN_FINISH,Condition( function isut ))
Won't work, there isn't a triggering player at that part, you need to actually specify player(0), player (1), etc.
Easiest way is:
Code: Select all
function hptu takes nothing returns nothing
local integer i = 0
set trig = CreateTrigger( )
loop
exitwhen i>11
call TriggerRegisterPlayerUnitEvent(trig, Player(i),EVENT_PLAYER_UNIT_TRAIN_FINISH,Condition( function isut ))
set i = i + 1
endloop
call TriggerAddAction(trig,function wptu)
endfunction
If you knew a woman who was pregnant, who had 8 kids already,
three who were deaf, two who were blind, one mentally retarded, and she had syphilis; would you recommend that she have an abortion?
Answer:
JJ2197
Legendary Genius
Posts: 1311 Joined: August 8th, 2007, 8:10 am
Title: Legendary Genius²
Location: St. George Utah
Post
by JJ2197 » October 2nd, 2007, 7:14 am
Okay... now how would I change condition wptu?
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate
Xantan
Honorary wc3edit.net Traitor
Posts: 2507 Joined: February 1st, 2007, 4:11 pm
Location: NEVADA
Post
by Xantan » October 2nd, 2007, 3:36 pm
To triggering player
GhettoChild
Old Wrinkly Member
Posts: 272 Joined: January 27th, 2007, 4:46 pm
Title: OxyContin
Location: Denver, Colorado
Post
by GhettoChild » October 2nd, 2007, 5:46 pm
That JASS is coded worse than Enron's mainframe or something lol. I'll help you improve it once I'm done playing here.
You know why the Yankees always win, Frank?
'Cause they have Mickey Mantle?
No, it's 'cause the other teams can't stop staring at those damn pinstripes.
weirdone2
Forum Staff
Posts: 926 Joined: June 3rd, 2007, 8:03 pm
Post
by weirdone2 » October 2nd, 2007, 7:13 pm
So let me get this you want to make a msg appear when some1 trains a unit?
HINDYhat
Senior Member
Posts: 101 Joined: June 1st, 2007, 9:05 pm
Post
by HINDYhat » October 2nd, 2007, 9:03 pm
Code: Select all
function isut takes nothing returns boolean
return GetUnitTypeId(GetTrainedUnit()) == 'h00A'
endfunction
function wptu takes nothing returns nothing
local integer i=0
loop
exitwhen i>11
call DisplayTextToPlayer(Player(i),0,0,"Player "+I2S(GetPlayerId(GetOwningPlayer(GetTrainedUnit()))+1))
set i=i+1
endloop
call DisableTrigger( GetTriggeringTrigger() )
endfunction
function hptu takes nothing returns nothing
local integer i=0
set trig = CreateTrigger( )
loop
exitwhen i>11
call TriggerRegisterPlayerUnitEvent(trig,Player(0),EVENT_PLAYER_UNIT_TRAIN_FINISH,Condition( function isut ))
set i=i+1
endloop
call TriggerAddAction(trig,function wptu)
endfunction
That should work.
Please indent your script next time
JJ2197
Legendary Genius
Posts: 1311 Joined: August 8th, 2007, 8:10 am
Title: Legendary Genius²
Location: St. George Utah
Post
by JJ2197 » October 2nd, 2007, 9:05 pm
Sorry... I just hate indents >.<
they annoy me...
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate
HINDYhat
Senior Member
Posts: 101 Joined: June 1st, 2007, 9:05 pm
Post
by HINDYhat » October 2nd, 2007, 9:09 pm
Auto-indent with JassCraft.
JJ2197
Legendary Genius
Posts: 1311 Joined: August 8th, 2007, 8:10 am
Title: Legendary Genius²
Location: St. George Utah
Post
by JJ2197 » October 2nd, 2007, 9:16 pm
Anyways it looks like what you did is backwards... like you got it only set for it to look if only player 1 has done it rather anyone...
Also it didn't seem to work... I have trigger trig = null in the globals.... that's supposed to be like that right?
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate