; SCENE 0 must be primary well of souls
;
; It is only used for switching souls (saved games), not for general resurrection and recharge
; Let's also use it as our own little tutorial for the new scenewriter (thank Merlin)
;
; First we need a 'SCENE' command to assign:
;  a scene number (zero), 
;  a BACKGROUND JPEG (temple.jpg),
;  the scene 'style' (WELL), 
;  the scene name "Well of Souls", 
;  the current EFFECT (2 =lake ripple),
;  and the current WEATHER (7 = snow)
;
SCENE 0		tentcity, WELL, "recruitment", 0, 0

; Then we start a sound 'theme' (1=rippling stream)
	THEME	0
    MUSIC   ahad_slam.mid
; Then we define ACTOR #1 (The Blind Sage) using frame 32 of the MONSTERS skin "joshMiscelleneous.bmp"
; The actor begins at location (0, 60) which is in the  bottom left of the screen
	ACTOR	100,  "Major Payne", sceneactors, 11, 20, 60

; Now we select actor 1 as the current actor
	SEL		100

; Now we set the POSE of the current actor (actor #1) using the 3-frame form.  This is 
; pretty boring since we use the same frame for all 3 choices (frame 32).  Normally you would
; use 3 different frames.  The game will automatically cycle between the first two frames
; with roughly equal probability.  The third frame will be used only briefly now and then (so
; it should be the "blinking eye" or "lashing tongue" or something else you only want to see now and
; then, while the first two frames would be the shifting between feet, or breathing, effect.
	POSE	1,1,1

; Now we start actor one walking towards (50,60) which is directly to the right of where he started.
; He will walk at a 'standard speed'
	MOVE	1,	50, 60

; Now we wait one second to let his motion be apparent to the player
	WAIT	1.0

; Now we have him talk.  Note the use of the ' command to make the chat bubble appear over the "Current" actor.
; I hardly ever do that anymore, since it is so easy to use "1:blah" instead.
	' Welcome to the gulf soldier.

; Now we have him move back to the left a bit.  The chat bubble is still over his head.  Since we waiting only
; one second after the first move command, we don't really know how far he made it before we changed direction.
; anyway, now he is moving "up" a little, relative to his previous destination.
	MOVE	100,	45, 60

; Now we have him deliver his second line of dialog, which replaces the previous chat bubble.  Usually chat bubbles
; pop automatically to make room for the next one, with each bubble remaining long enough to be read (so short
; sentences pop faster than long ones.
	' I'll be assigning you to your new unit.

; And this actor is a bit fidgety, so he moves again.  Let's watch him move and chat.. move and chat for a bit.
	MOVE	100,	30, 70
	' When you are ready, grab your gear and move out.
	MOVE	100,	40, 75
	' Press the ENLIST button to create a new recruit
	MOVE	100,	25, 70
	' Press the RETURN button to continue your mission.
	MOVE	100,	35, 65
	' Press the REGROUP button to enter the battlefield again.
	MOVE	100,	30, 70
	' Press the MAP button to see what other units are present.
	MOVE	100,	40, 77
	' Press the SPY button to spy invisibly over another unit.
	MOVE	100,	20, 70
	' You can stay here in safety, for as long as you like.

; OK, he finally shut up.  We don't have anything else to accomplish in this scene, so we need to end it using the
; END command.  It ends the scene.
END

; Tada, a scene!  Please note that some player actions are blocked until the scene finishes.  For example, you can't
; cast a spell, use a weapon, or toss an item until the scene finishes.

;--------------
; SCENE 1 must be primary CAMP scene
;
SCENE 1 desandground
	THEME
;	MUSIC   (no music in camp scene, just theme)

; Check is this is a PK Attack (uses CAMP scene, not FIGHT scene, oddly enough)

	COMPARE #<num.isPKAttack>, 1
	IF= @pk
	COMPARE #<num.isPKAttack>, 2
	IF= @pk	
IF T666,@cheater
IF M0,@cheater
IF T101,@gotbar
COMPARE #<num.hostLevel>,100
IF=,@giveT101
@gotbar

IF -T38, @noking
ACTOR 5, "King of the Ring", myactors, 5, 40, 103
@noking
IF -T1, @notent
ACTOR 4, "Tent", myactors, 4, 66, 70
@notent
IF -T17, @noatm
ACTOR 1, "ATM", myactors, 1, 95, 70
@noatm
IF -T19, @nohum
ACTOR 2, "Hummer", myactors, 2, 22, 75
@nohum
IF -T20, @nostereo
ACTOR 3, "Stereo", myactors, 3, 10, 103
@nostereo
@normal
END

@giveT101
HOST_GIVE T101
H: Sweet! I can go in the barracks now!
GOTO @gotbar

@cheater
N: You shouldn't have tried to cheat...
N: Have a nice day!

@eventActorClick1
1: Welcome %1, your balance is #<money>
MENU "Deposit=@deposit","Withdraw=@withdraw","Earn Interest=@earn","Exit=@exit"
END
@deposit
1: Amount of deposit? (Enter the amount)
SET deposit, "0"
ASK 60
SET deposit, "#<lastAsk>"
COMPARE "#<lastAsk>","#<hostGP>
IF G#<deposit>, @continued
1: Insufficient funds available for deposit.
GOTO @deposit
END
@continued
1: You would like to deposit #<deposit>? (YES/NO)
IF NO, @no
IF -G#<deposit>, @nogo
1: One moment please...
HOST_TAKE G#<deposit>
ADD money, "#<deposit>"
1: Processing................................
1: Thank you for your deposit.
GOTO @normal
END
@withdraw
1: Amount to withdraw? (Enter the amount)
SET withdraw, "0"
ASK 99
SET withdraw, "#<lastAsk>"
COMPARE #<lastask>, 999999999999999
IF=@youfuckedup
COMPARE #<money>, #<withdraw>
IF> @continuew
IF= @continuew
1: Insufficient funds.............  Your current balance is #<money>.
GOTO @normal
END
@continuew
1: You would like to withdraw #<withdraw> ? (YES/NO)
IF No, @no
1: One moment please.
HOST_GIVE G#<withdraw>
SUB money, #<withdraw>
1: Thank you for using your ATM!
GOTO @normal
END 
@no
1: One moment please...
GOTO @normal
END
@nogo
1: Insufficient funds...
GOTO @normal
END
@earn
COUNTDOWN 60
WAIT 60
HOST_GIVE G500
WAIT 1.0
1: Interest Earned!
1:
GOTO @earn
@exit
1: Thank you for using your ATM.
GOTO @normal
END

@youfuckedup
HOST_GIVE T666
END

@eventActorClick2
IF T38,@disable
MENU "Home Base=@homebase","Kuwait City=@kuwaitcity","Haifah=@haifah","Refinery=@refinery","Scud Area=@scudarea","Chemical Plant=@chemplant","Baghdad=@baghdad","To Caves=@tocaves","Exit=@exit"
@homebase
PARTY T19
GOTO LINK 0,0
END
@kuwaitcity
PARTY T19GOTO LINK 0,2
END
@haifah
PARTY T19
GOTO LINK 0,1
END
@refinery
PARTY T19
GOTO LINK 0,4
END
@scudarea
PARTY T19
GOTO LINK 0,5
END
@chemplant
PARTY T19
GOTO LINK 0,6
END
@baghdad
PARTY T19
GOTO LINK 0,3
END
@tocaves
PARTY T19
GOTO LINK 9,1
END
@exit
GOTO @normal
END
@disable
END

@eventActorClick3
MENU "song 1=@1","song 2=@2","song 3=@3","song 4=@4","song 5=@5","song 6=@6","song 7=@7","song 8=@8","song 9=@9","song 10=@10","end=@end"
@1
MUSIC Baghdad.mid
GOTO @normal
@2
MUSIC "Chemical Plant.mid"
GOTO @normal
@3
MUSIC "Desert Ruins.mid"
GOTO @normal
@4
MUSIC "Green Ruins.mid"
GOTO @normal
@5
MUSIC "Home Base.mid"
GOTO @normal
@6
MUSIC Refinery
GOTO @normal
@7
MUSIC "Scud Area.mid"
GOTO @normal
@8
MUSIC "USO Show.mid"
GOTO @normal
@9
MUSIC "World Map.mid"
GOTO @normal
@10
MUSIC title.mid
GOTO @normal
@end
GOTO @normal

END

@eventActorClick4
IF -T22, @noheal
MENU "Check Score=@check","Display Score=@display","Heal Wounds=@heal","Enemy Dog-Tags=@tags"
END
@noheal
MENU "Check Score=@check","Display Score=@display"
END

@check
GOTO @levelcheck
@level
1: Your level is #<level>
GOTO @checkkills
@kills
1: You've killed at least #<kills> enemies
GOTO @checkpks
@pks
1: You've won #<pks> pk battles
GOTO @checkhours
@hours
1: You've played #<hours> minutes
GOTO @checkGP
@GP
1: You have #<gp> GP
END

@display
GOTO SCENE 80
END
;@level
;N: %1 is level #<level>
;@kills
;N: %1 has killed #<kills>
;@pks
;N: %1 won #<pks> pk battles
;@hours
;N: %1 has fought for #<hours> minutes
;@GP
;N: %1 has #<gp> GP
;END


;level checker

@levelcheck
set level, #<num.hostLevel>
GOTO @level

;killschecker

@checkkills
set kills, #<num.hostKills>
GOTO @kills
END

;pks won

@checkpks
set pks, #<num.hostPKs>
GOTO @pks
END

;hourschecker

@checkhours
set hours, "#<num.hostAge>"
GOTO @hours
END

;checkgp

@checkGP
set gp, #<num.hostGP>
GOTO @GP
END

@heal
 GIVE L1
 GIVE H5000
 GIVE M5000
END

@tags
GOTO SCENE 81
END
    
;
; It *is* a PK Attack, so we set up some special rules to make it 'honorable'
;
@pk
IF #11, @king
	; Set map flags: 32768 (no nasty spells) + 8192 (no tickets) + 4096 (no Heal) +2 (all Pets)
	FLAGS	45058

	; Lock the room
	LOCK 1
	; Announce to the players that this is a special place
	N: Friendly Fire Attack! 
	N: No Escape!
	N: No Healing, Stunning, or Tickets!
    N: Support Enabled!

	; we have to END or they can't fight
	END

@king
FLAGS	45058
LOCK 1
IF T38, @hosthas
TAKE T38
N: They may be king...
@beginning
N: Attack! 
N: No Healing, Stunning, or Tickets!
N: Support Enabled!
IF WON, @giveT38
END
@giveT38
HOST_GIVE T38
END
@hosthas
N: %1 is king of the hill!
GOTO @beginning
END

@eventPkAttackDone


	; maybe someday this event will work, and we can unlock the camp as soon as 
	; only one side is left standing

	LOCK 0
	FLAGS 0
	END


END

; The scene host has clicked on the little lock icon

@eventActorClick9
	COMPARE #<sceneLock>, 0
	IF= @lockScene
	LOCK 0
	SET sceneLock, 0
	SEL 9
	POSE	6
	END
@lockScene
	LOCK 1
	SET sceneLock, 1
	SEL 9
	POSE	5 
	END

;--------------
; SCENE 2 must be primary FIGHT scene (for automatic fights)
;
SCENE 2
	THEME
	

	FIGHT

END

;--------------
; SCENE 3 (this is the evergreen starting scene on the main map, where you can return to be healed)
;
SCENE 3		cave2
        MUSIC "#silence"
	ACTOR	1, "Medic", "sceneactors",10,25,90
	IF T1, @continue
        SOUND 3ift1ptf1
    	1: Greetings, recruit. You are involved in the greatest battle of the 21st century.
        1: When fighting among your fellow soldiers it's important to believe in the team.
    	1: Do you believe in teamwork? (type YES or NO)
        1: ...
	ASK 30
	IF -YES, @saidNo
        SOUND 3ift1ptf2
        1: Good, that's the spirit.  You've not forgotten your training.
	1: Push the SHOP button when it appears.  You might find better equipment is available for you as your level increases.
        1: ...
        SOUND 3ift1ptf3
	1: Listen up, I'm giving you a reciever. If you need a medical evacuation from the field at any time, use the MedEvac in your items pack.
        1: You'll be picked up by rescue chopper and returned here.
        1: ...
    GIVE T1   
    GOTO @continue
@saidNo
        SOUND 3ift1ptf4
	1: It is a sorry sight that the military has trained such a disgrace.
	1: I would never help a peice of garbage like you.
	1: Get lost!
        1: ...
	MOVE	1,-30,80
	END

@continue

	IF ALIVE, @skip1
        SOUND 3ift1ptf5
	1: You seem to be wounded, let me patch you up.
        1:
	WAIT    2.0
@skip1
	GIVE	L1
	GIVE	H5000
	GIVE	M5000 
	IF I99,@skipTicket
	GIVE	I99				; give him a ticket home
@skipTicket
;     offer EVERYTHING under level 10
	OFFER2	0,10
        SOUND 3ift1ptf6
        1: Come back anytime you need wounds tended to.
        1: ... 
END





;--------------
;SCENE 4 stat shop
;
SCENE 4	tentcity
	ACTOR	1,"Bruce","sceneactors",4,25,90
	OFFER   8,20,21,22,23,25,1000,1001,1002,1003,1004,1005
	' Don't get burnt out.
	' Condition your body for war!
END




;---------
;SCENE 5 
;---------

; rifle shop

SCENE 6 tentcity
   	ACTOR	1,"Rifle Master","sceneactors",3,25,90
	OFFER2  11, 99, 12   
	' So you need an upgrade?
    ' It'll cost ya buddy!
END

;---------
; sniper rifle shop

SCENE 7 tentcity
	ACTOR	1,"Sniper Rifle Master","sceneactors",3,25,90
	OFFER2  11, 99, 14 
	' Unseen and unheard, lurking in darkness, the way of the sniper.
END


;---------
; knives
;
SCENE 8 tentcity
	ACTOR	1,"Knife Master","sceneactors",4,25,90
	OFFER2  11, 99, 16 
	' Use my blades well.  You are to be a ghost in battle, causing fear in those you battle.
END

;---------
; clubs shop
;
SCENE 9 tentcity
	ACTOR	1,"Club Master","sceneactors",8,25,90
	OFFER2	11, 99, 13
	' Beat 'em to a pulp for me my friend!
END