• 🏆 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] Code does not work

Status
Not open for further replies.
Level 3
Joined
Oct 14, 2007
Messages
37
Im trying to re-create the iseedeadpeople cheat with jass and I hit a dead end

JASS:
function AllowedPlayerList takes nothing returns boolean
    if ( ( GetPlayerName(GetTriggerPlayer()) == "Death[CrAb]" ) ) then
        return true
    endif
    if ( ( GetPlayerName(GetTriggerPlayer()) == "Smoking[CrAb]" ) ) then
        return true
    endif
    if ( ( GetPlayerName(GetTriggerPlayer()) == "Steaming[CrAb]" ) ) then
        return true
    endif
    return false
endfunction

function Trig_BooleanTest takes nothing returns boolean
    if ( not ( udg_VisibilityBoolean[GetConvertedPlayerId(GetTriggerPlayer())] == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Map_Reveal_FogUndo takes nothing returns nothing
    call CreateFogModifierRectBJ( true, GetTriggerPlayer(), FOG_OF_WAR_VISIBLE, GetPlayableMapRect())
    set udg_Visibility[GetConvertedPlayerId(GetTriggerPlayer())] = GetLastCreatedFogModifier()
    set udg_VisibilityBoolean[GetConvertedPlayerId(GetTriggerPlayer())] = true
endfunction

function Trig_Map_Reveal_FogRedo takes nothing returns nothing
    call DestroyFogModifier( udg_Visibility[GetConvertedPlayerId(GetTriggerPlayer())] )
    set udg_VisibilityBoolean[GetConvertedPlayerId(GetTriggerPlayer())] = false
endfunction

function Trig_Map_Reveal_Actions takes nothing returns nothing
    if ( Trig_BooleanTest() ) then
    call Trig_Map_Reveal_FogUndo() 
    else
    call Trig_Map_Reveal_FogRedo()
    endif
endfunction

//===========================================================================
function InitTrig_Map_Reveal takes nothing returns nothing
    set gg_trg_Map_Reveal = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Map_Reveal, Player(0), "iseedeadpeople", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Map_Reveal, Player(1), "iseedeadpeople", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Map_Reveal, Player(2), "iseedeadpeople", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Map_Reveal, Player(3), "iseedeadpeople", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Map_Reveal, Player(4), "iseedeadpeople", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Map_Reveal, Player(5), "iseedeadpeople", true )
    call TriggerAddCondition( gg_trg_Map_Reveal, Condition(function AllowedPlayerList) )
    call TriggerAddAction( gg_trg_Map_Reveal, function Trig_Map_Reveal_Actions )
endfunction

The Issue turns up at line 15, it keeps giving me 2 compile errors there
- Comaring 2 Variables of different primitive types (except real or integer) is not allowed
- Undeclared Variable udg_VisibilityBoolean

I already created the VisibilityBoolean as a Boolean Variable in the CTRL + B Menu
Same goes for Visibility as a Visibility Variable

Any idea how to fix this? the game simply leads me to the main menu when I test it
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Now I will say this:
native Cheat takes string cheatStr returns nothing

But I will examine the code.
Ah, yes.
You have to make it an array with size 8.
P.s. I copied the code, created the variables and it gave me no errors.
 
Level 3
Joined
Oct 14, 2007
Messages
37
The Native cheat thing is probably like the call function to blizzards cheats, thats not what I want, im simply recreating the cheat from scratch

as with the size 8, they used to be size 6, I changed them and it made no difference
Try Playing with it, test it
 
Last edited:
Level 3
Joined
Oct 14, 2007
Messages
37
Its not giving me syntax errors, I fixed those, I wrote the errors in my first post

P.S.
If you want the errors again:

Line 15, 24, 29: Undeclared Variable udg_VisibilityBoolean
Line 15: Comparing 2 variables of different primitive types (except real and Integer) is not allowed
^ (I think this one is the problem, but wheres the comparison of 2 different variables here?) ^
Line 23, 28: Undeclared Variable udg_Visibility
Line 42: Undeclared Variable gg_trg_Map_Reveal
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Hehe.
JASS:
function AllowedPlayerList takes nothing returns boolean
    if (  GetPlayerName(GetTriggerPlayer()) == "Death[CrAb]" or GetPlayerName(GetTriggerPlayer()) == "Steaming[CrAb]" or GetPlayerName(GetTriggerPlayer()) == "Smoking[CrAb]" ) then
        return true
    endif
    return false
endfunction

function Trig_BooleanTest takes nothing returns boolean
if ( udg_VisibilityBoolean[GetPlayerId(GetTriggerPlayer())] == false ) then
        return true
    endif
    return false
endfunction

function Trig_Map_Reveal_FogUndo takes nothing returns nothing
    set udg_Visibility[GetPlayerId(GetTriggerPlayer())]=CreateFogModifierRect(GetTriggerPlayer(), FOG_OF_WAR_VISIBLE, bj_mapInitialPlayableArea, false, false)
    call FogModifierStart(udg_Visibility[GetPlayerId(GetTriggerPlayer())])
    set udg_VisibilityBoolean[GetPlayerId(GetTriggerPlayer())] = true
endfunction

function Trig_Map_Reveal_FogRedo takes nothing returns nothing
    call DestroyFogModifier( udg_Visibility[GetPlayerId(GetTriggerPlayer())] )
    set udg_VisibilityBoolean[GetPlayerId(GetTriggerPlayer())] = false
endfunction

function Trig_Map_Reveal_Actions takes nothing returns nothing
    if ( Trig_BooleanTest() ) then
    call Trig_Map_Reveal_FogUndo()
    else
    call Trig_Map_Reveal_FogRedo()
    endif
endfunction

//===========================================================================
function InitTrig_Map_Reveal takes nothing returns nothing
    set gg_trg_Map_Reveal = CreateTrigger( )
    call TriggerRegisterPlayerChatEvent( gg_trg_Map_Reveal, Player(0), "iseedeadpeople", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Map_Reveal, Player(1), "iseedeadpeople", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Map_Reveal, Player(2), "iseedeadpeople", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Map_Reveal, Player(3), "iseedeadpeople", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Map_Reveal, Player(4), "iseedeadpeople", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_Map_Reveal, Player(5), "iseedeadpeople", true )
    call TriggerAddCondition( gg_trg_Map_Reveal, Condition(function AllowedPlayerList) )
    call TriggerAddAction( gg_trg_Map_Reveal, function Trig_Map_Reveal_Actions )
endfunction

Note that you do not need to actually create and destroy the fog modifier each time.
You can start and stop it.
FogModifierStart(which_modifier)

FogModifierStop(which_modifier)

Note that this will reveal the map to only the typing player and not his allies.
If you want it to reveal the map to allies too, just change the second last false to true in the line: CreateFogModifierRect(GetTriggerPlayer(), FOG_OF_WAR_VISIBLE, bj_mapInitialPlayableArea, false, false)

P.s. this is what I meant by trim :D
It is tested and working, just I used a command different from the code as I usually do my test in SP. But I will edit it now.
 
Level 3
Joined
Oct 14, 2007
Messages
37
That did not resolve the Issue, when i click Test Game, it starts the game however, it leads me to the main menu, and the error is still there

The Problem is here:

JASS:
function Trig_BooleanTest takes nothing returns boolean
if ( udg_VisibilityBoolean[GetPlayerId(GetTriggerPlayer())] == false ) then
        return true
    endif
    return false
endfunction

its giving me the error: Comparing 2 variable of 2 different primitive types (except real and integer) is not allowed


P.S. Im using NewGen Editor
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Are you sure you have the global variable array of type boolean with name VisibilityBoolean?
And be sure to save before you test(so that any vJass code can be compiled).
P.s. As I said the code I posted worked perfectly(I admit I forgot to test the disabling of the modifier, but the enabling worked).
Also note that Using iseedeadpeople in single player will turn on the cheat.
And be sure to set your player profile in the main WE window preferences (file -> preferences).
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
[jass=Rawr? It should work, but untested. Assumes you have a boolean array called udg_VisibilityBoolean]function MapRevealConds takes nothing returns boolean
local string s = StringCase(GetPlayerName(GetTriggerPlayer()),false)
return s == "death[crab]" or s == "steaming[crab]" or s == "smoking[crab]"
endfunction

function MapReveal takes nothing returns nothing
local player p = GetTriggerPlayer()
local integer i = GetPlayerId(p)
if GetLocalPlayer() == p then
call FogEnable(udg_VisibilityBoolean)
call FogMaskEnable(udg_VisibilityBoolean)
endif
set udg_VisibilityBoolean = not udg_VisibilityBoolean
endfunction

function InitTrig_MapReveal takes nothing returns nothing
local integer i = 0
set gg_trg_MapReveal = CreateTrigger()
loop
exitwhen i > 5
call TriggerRegisterPlayerChatEvent(gg_trg_MapReveal,Player(i),"iseedeadpeople",true)
set i = i + 1
endloop
call TriggerAddCondition(gg_trg_MapReveal,Condition(function MapRevealConds))
call TriggerAddAction(gg_trg_MapReveal,function MapReveal)
endfunction[/code]
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Mine worked :D
And he wants the trigger to disable the "cheat" when the message is typed again.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Yeap it is messy, I just quick edited what he made, but it ain't that messy or I need a lesson?
Ah, yeah it disables it. Forgive my impatient self :)
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
I meant that I think that it should not cause any problems.
Oh, does not matter :)
 
Status
Not open for further replies.
Top