• 🏆 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!

Prevent playing "Single Player" mode, but allow solo LAN play.

Status
Not open for further replies.

EdgeOfChaos

E

EdgeOfChaos

So, this code is very simple and I did not invent it, but it seems that not many RPG makers know how to do it, so here it is.

JASS:
  call Cheat("greedisgood 1000000")
    call TriggerSleepAction(0.01)
    if ( GetPlayerState(GetLocalPlayer(), PLAYER_STATE_RESOURCE_GOLD ) == 1000000 ) then
        call CustomDefeatBJ( GetLocalPlayer(), "No Single-Player-Mode!" )
    endif

And a short tutorial for GUI-ers:

1. Make a new Trigger
2. Add Melee Initialization event
3. Go to Edit -> Convert to Custom Text
4. You'll see a function like this, at the very top of the code.
JASS:
function Trig__TRIGGERNAME__Actions takes nothing returns nothing
endfunction
5. Copy paste the above code between the 2 lines, like so.
JASS:
function Trig_TRIGGERNAME_Actions takes nothing returns nothing
    call Cheat("greedisgood 1000000")
    call TriggerSleepAction(0.01)
    if ( GetPlayerState(GetLocalPlayer(), PLAYER_STATE_RESOURCE_GOLD ) == 1000000 ) then
        call CustomDefeatBJ( GetLocalPlayer(), "No Single-Player-Mode!" )
    endif
endfunction
And you're done.
Obviously this assumes that you don't start out any player with 1 million gold.
 

Attachments

  • Prevent SP Demo.w3x
    16.7 KB · Views: 68
Level 12
Joined
Feb 22, 2010
Messages
1,115
You are doing extra work anyway, you can just use this:


  • Events
    • Map initialization
  • Conditions
  • Actions
    • Custom script: call Cheat("SomebodySetUpUsTheBomb")
 

EdgeOfChaos

E

EdgeOfChaos

Haha, that's a great way of doing it actually. Both of those are better, thanks!
 
Status
Not open for further replies.
Top