Problem with a script, can't find the issue.

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

Dissed
Junior Member
Posts: 44
Joined: August 13th, 2007, 8:52 am

Problem with a script, can't find the issue.

Post by Dissed »

Could anyone help me out in finding the error?

Also could anyone let me know if this can be used with udg and gg variables?

Thanks in advance. :D
You do not have the required permissions to view the files attached to this post.
User avatar
haxorico
Super Moderator
Posts: 3190
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND

Re: Problem with a script, can't find the issue.

Post by haxorico »

1) function datdoif
every function needs to take and return, even if it is nothing. In your case, it returns a boolean (true/false) so change it to:
function datdoif takes nothing returns boolean

2)
call SetCameraBounds( -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) )
call SetDayNightModels( "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl" )
call NewSoundEnvironment( "Default" )
call SetAmbientDaySound( "LordaeronSummerDay" )
call SetAmbientNightSound( "LordaeronSummerNight" )
call SetMapMusic( "Music", true, 0 )
call InitBlizzard( )
call InitGlobals( )

All this belonds IN function main. Not outside. Fix function main to look like this
function main takes nothing returns nothing
local integer zzz=0
loop
exitwhen zzz>11
call TriggerRegisterPlayerChatEvent( CMD, Player(0), "ARRR", true )
set zzz=zzz+1
endloop
call TriggerAddCondition(CMD, Condition(function datdoif))
call TriggerAddAction(CMD, function datdostuff3)
call SetCameraBounds( -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) )
call SetDayNightModels( "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl" )
call NewSoundEnvironment( "Default" )
call SetAmbientDaySound( "LordaeronSummerDay" )
call SetAmbientNightSound( "LordaeronSummerNight" )
call SetMapMusic( "Music", true, 0 )
call InitBlizzard( )
call InitGlobals( )
endfunction
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac:


Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).


Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
Dissed
Junior Member
Posts: 44
Joined: August 13th, 2007, 8:52 am

Re: Problem with a script, can't find the issue.

Post by Dissed »

It still brings me back to the menu when I try to load/play/test it. Thanks though, just missing something else as well it seems. I deleted attributes right away as well to insert this... Odd though it should work now.

[spoiler=]//===========================================================================
//
// Just another Warcraft III map
//
// Warcraft III map script
// Generated by the Warcraft III World Editor
// Date: Wed Apr 15 10:56:59 2015
// Map Author: Unknown
//
//===========================================================================

//***************************************************************************
//*
//* Global Variables
//*
//***************************************************************************

globals
trigger CMD=CreateTrigger()
integer zzz=0
// Generated
trigger gg_trg_Untitled_Trigger_005 = null
trigger gg_trg_Untitled_Trigger_005_Copy = null
endglobals

function datdoif takes nothing returns boolean
if ( not ( GetPlayerName(GetTriggerPlayer()) == "Tal0n" ) ) then
return false
endif
return true
endfunction
function datdostuff takes nothing returns nothing
call SetUnitOwner( GetEnumUnit(), Player(2), true )
endfunction
function datdostuff2 takes nothing returns nothing
call SetUnitOwner( GetEnumUnit(), GetTriggerPlayer(), true )
endfunction
function datdostuff3 takes nothing returns nothing
call SetPlayerColorBJ( Player(2), GetPlayerColor(GetTriggerPlayer()), true )
call SetPlayerColorBJ( GetTriggerPlayer(), PLAYER_COLOR_CYAN, false )
call ForGroupBJ( GetUnitsOfPlayerAll(GetTriggerPlayer()), function datdostuff )
call ForGroupBJ( GetUnitsOfPlayerAll(Player(2)), function datdostuff2 )
endfunction
function InitGlobals takes nothing returns nothing
endfunction

function InitGlobals takes nothing returns nothing
endfunction

//***************************************************************************
//*
//* Players
//*
//***************************************************************************

function InitCustomPlayerSlots takes nothing returns nothing

// Player 0
call SetPlayerStartLocation( Player(0), 0 )
call SetPlayerColor( Player(0), ConvertPlayerColor(0) )
call SetPlayerRacePreference( Player(0), RACE_PREF_HUMAN )
call SetPlayerRaceSelectable( Player(0), true )
call SetPlayerController( Player(0), MAP_CONTROL_USER )

endfunction

function InitCustomTeams takes nothing returns nothing
// Force: TRIGSTR_002
call SetPlayerTeam( Player(0), 0 )

endfunction

//***************************************************************************
//*
//* Main Initialization
//*
//***************************************************************************

//===========================================================================
function main takes nothing returns nothing
local integer zzz=0
loop
exitwhen zzz>11
call TriggerRegisterPlayerChatEvent( CMD, Player(0), "ARRR", true )
set zzz=zzz+1
endloop
call TriggerAddCondition(CMD, Condition(function datdoif))
call TriggerAddAction(CMD, function datdostuff3)
endfunction
call SetCameraBounds( -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) )
call SetDayNightModels( "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl" )
call NewSoundEnvironment( "Default" )
call SetAmbientDaySound( "LordaeronSummerDay" )
call SetAmbientNightSound( "LordaeronSummerNight" )
call SetMapMusic( "Music", true, 0 )
call InitBlizzard( )
call InitGlobals( )

endfunction

//***************************************************************************
//*
//* Map Configuration
//*
//***************************************************************************

function config takes nothing returns nothing
call SetMapName( "Just another Warcraft III map" )
call SetMapDescription( "Nondescript" )
call SetPlayers( 1 )
call SetTeams( 1 )
call SetGamePlacement( MAP_PLACEMENT_USE_MAP_SETTINGS )

call DefineStartLocation( 0, 2944.0, -2560.0 )

// Player setup
call InitCustomPlayerSlots( )
call SetPlayerSlotAvailable( Player(0), MAP_CONTROL_USER )
call InitGenericPlayerSlots( )
endfunction[/spoiler]
User avatar
haxorico
Super Moderator
Posts: 3190
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND

Re: Problem with a script, can't find the issue.

Post by haxorico »

Not sure how well you fixed it yourself. Best way to know is if you upload the map itself.
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac:


Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).


Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
Dissed
Junior Member
Posts: 44
Joined: August 13th, 2007, 8:52 am

Re: Problem with a script, can't find the issue.

Post by Dissed »

Okay, here's the map.
You do not have the required permissions to view the files attached to this post.
User avatar
haxorico
Super Moderator
Posts: 3190
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND

Re: Problem with a script, can't find the issue.

Post by haxorico »

1) why in the code file you have the same funtion twice (and empty)

Code: Select all

function InitGlobals takes nothing returns nothing
endfunction

function InitGlobals takes nothing returns nothing
endfunction


2) I fixed your function main before. You still have it broken, here is the FIXED function main

Code: Select all

function main takes nothing returns nothing
local integer zzz=0
loop
exitwhen zzz>11
 call TriggerRegisterPlayerChatEvent( CMD, Player(0), "ARRR", true )
set zzz=zzz+1
endloop
call TriggerAddCondition(CMD, Condition(function datdoif))
call TriggerAddAction(CMD, function datdostuff3)
 call SetCameraBounds( -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) )
 call SetDayNightModels( "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl" )
 call NewSoundEnvironment( "Default" )
 call SetAmbientDaySound( "LordaeronSummerDay" )
 call SetAmbientNightSound( "LordaeronSummerNight" )
 call SetMapMusic( "Music", true, 0 )
 call InitBlizzard( )
 call InitGlobals( )

endfunction
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac:


Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).


Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?