Custom Commands for maps
Posted: February 26th, 2020, 4:43 am
Lets say for example with dark deeds how there's a 1 in 10 chance at random you will be the evil one. How would i enter a command automatically making me the one it chooses?
apologies for wrong post, though I have no idea what you said about resolving it I need something more detailedclanhinata wrote:This question should in this not Tech Support
Also for your question resolve its
Get the conditional => Add new command => If ... else => done
I understand the concept but i dont know what to type or where to put the command at. I have attached the the file if you wanted a better understanding. I appreciate all the help.nuzamacuxe wrote:I would need the map to make a good example for you, but what clanhinata said is right.
Code: Select all
function ChatEvent takes trigger Trig, string Text, boolean Bool, code Act returns trigger
local integer index=0
loop
call TriggerRegisterPlayerChatEvent(Trig,Player(index),Text,Bool)
set index=index+1
exitwhen index==bj_MAX_PLAYER_SLOTS
endloop
if Act!=null then
call TriggerAddAction(Trig,Act)
endif
return Trig
endfunction
function CC_Commands takes nothing returns nothing
local integer PID = GetPlayerId( GetTriggerPlayer( ) )
local string Text = SubString( GetEventPlayerChatString(), 1, StringLength(GetEventPlayerChatString()) )
if Text == "wevil" then
set fz[ PID ]= 100
set f6[ PID ]= true
call DisplayTimedTextToPlayer( Player( PID ), 0, 0, 10, "You will be The Evil One." )
endif
endfunction
function CC_Init takes nothing returns nothing
call ChatEvent( CreateTrigger( ), "-", false, function CC_Commands )
endfunction
Thank you! how would a pick command work for this? say pick pitlord for example?nuzamacuxe wrote:Just compare both war3map.j. What I did was simply increase your chance of being The Evil One to 100 as soon as you type the command "-wevil". That way you will be always the choosen one.
The evil hero isn't the same way.Code: Select all
function ChatEvent takes trigger Trig, string Text, boolean Bool, code Act returns trigger local integer index=0 loop call TriggerRegisterPlayerChatEvent(Trig,Player(index),Text,Bool) set index=index+1 exitwhen index==bj_MAX_PLAYER_SLOTS endloop if Act!=null then call TriggerAddAction(Trig,Act) endif return Trig endfunction function CC_Commands takes nothing returns nothing local integer PID = GetPlayerId( GetTriggerPlayer( ) ) local string Text = SubString( GetEventPlayerChatString(), 1, StringLength(GetEventPlayerChatString()) ) if Text == "wevil" then set fz[ PID ]= 100 set f6[ PID ]= true call DisplayTimedTextToPlayer( Player( PID ), 0, 0, 10, "You will be The Evil One." ) endif endfunction function CC_Init takes nothing returns nothing call ChatEvent( CreateTrigger( ), "-", false, function CC_Commands ) endfunction
also where did you place this for future reference?Auregon wrote:Thank you! how would a pick command work for this? say pick pitlord for example?nuzamacuxe wrote:Just compare both war3map.j. What I did was simply increase your chance of being The Evil One to 100 as soon as you type the command "-wevil". That way you will be always the choosen one.
The evil hero isn't the same way.Code: Select all
function ChatEvent takes trigger Trig, string Text, boolean Bool, code Act returns trigger local integer index=0 loop call TriggerRegisterPlayerChatEvent(Trig,Player(index),Text,Bool) set index=index+1 exitwhen index==bj_MAX_PLAYER_SLOTS endloop if Act!=null then call TriggerAddAction(Trig,Act) endif return Trig endfunction function CC_Commands takes nothing returns nothing local integer PID = GetPlayerId( GetTriggerPlayer( ) ) local string Text = SubString( GetEventPlayerChatString(), 1, StringLength(GetEventPlayerChatString()) ) if Text == "wevil" then set fz[ PID ]= 100 set f6[ PID ]= true call DisplayTimedTextToPlayer( Player( PID ), 0, 0, 10, "You will be The Evil One." ) endif endfunction function CC_Init takes nothing returns nothing call ChatEvent( CreateTrigger( ), "-", false, function CC_Commands ) endfunction