Jump to content

[HELP} Need help with simple scripting


AlexScorpion

Recommended Posts

damn .. my menu gets completely messed up when i multiple conditions on more than one button

 

scn AlexSquadRadioScript 

int ibutton 
Short toMany


Begin OnEquip 
       showmessage 1SquadSummonMenu 

end 


Begin GameMode 
set ToMany to 0

       set iButton to GetButtonPressed  


        
                
       if iButton == -1   ;noone knows what it means 
               return 
endif

   if iButton == 0  ;cancel the menu 
               playsound WPNAlienBlasterFire2D 
endif

    if iButton == 1  &&   AlexSquadToManySummoned > 2  ;checking if there are more than 2 troops present
  showmessage AlexToManyTroopsPresent 



else 
            set AlexSquadDismis to 0            ;summon the squad 
           placeatme AlexSquadVertibird 1 
         set AlexSquadToManySummoned to 3 
          
endif

  
     if iButton == 2 && AlexSquadToManySummoned < 0        ;checking if there are any troops present
      showmessage AlexThereIsNobododytoDismissmessage

      else
         set AlexSquadDismis to 1             ;Dismiss the squad
         PlaceAtMe AlexSquadVertibird 1 


             
         
endif 
end

Link to comment
Share on other sites

oh ... that lol

 

i always use [ codebox ] lalala [/codebox ] "without spaces"

 

 

you can also press reply on any of my posts with code in it and you'll see how it's done

Edited by AlexScorpion
Link to comment
Share on other sites

ug oh .. it seems that i'm having problems with a multilevel menu

 

it's one main menu ... with two small sub menus ..looks like this

 

cancel

summon

dismiss

go silent

go loud

follow

wait

==========

 

commands WAIT open a submenu and command FOLLOW opens a submenu

 

scn AlexSquadRadioScript  
 
short ibutton 
short messageup 
int iButton0
int iButton1
int iButton2
int iMenuLevel
int iAlternateMessage 


     Begin OnEquip  
       showmessage AlexSquadSummonMenu  
        
end  
 
 
Begin GameMode  

        if iMenuLevel == 0


               set iButton0 to GetButtonPressed 
 
               if iButton == -1        ;Wait until button was pressed 
                       return 
               endif 
               
                
               if iButton0 == 0 ;cancel the menu  
                       playsound WPNAlienBlasterFire2D  
                     

               elseif iButton0 == 1     ;summon the squad  
                      
                               set AlexSquadDismis to 0 
                               placeatme AlexSquadVertibird 1 
                               set AlexSquadToManySummoned to 3 
                    

               elseif iButton0 == 2     ;Dismiss the squad 
                      
                               set AlexSquadDismis to 1             ;Dismiss the squad 
                               PlaceAtMe AlexSquadVertibird 1  
                    

           elseif iButton0 == 3  ;Tell your squad to use silent weapons
           set AlexSquadweaponchange to 1

           
               
          elseif iButton0 == 4 ;tell your squad to use primary weapons
           set AlexSquadweaponchange to 0

          elseif iButton0 == 5 ;
         
          ShowMessage AlexWaitOptions
          
         set iMenuLevel to 1 
         set iButton1 to GetButtonPressed 
          

             if iButton1 == -1 ; No button has been pressed yet 
            return 
endif

         
        
        if iButton1 == 0
       playsound WPNAlienBlasterFire2D  

           elseif iButton1 == 1
          set AlexSquadholdposition to 1

          elseif iButton1 == 2
          set AlexSquadWaitRelax to 1
endif

          elseif iButton0 == 6 ;
         ShowMessage AlexFollowOptions
      

       set iMenuLevel to 2 
      set iButton2 to GetButtonPressed 


         if iButton2 == -1 ; No button has been pressed yet 
         return 
endif

if iButton2 == 0
playsound WPNAlienBlasterFire2D  

elseif iButton2 == 1
set AlexSquadFollowClose to 1

elseif iButton2 == 2
set AlexSquadFollowLong to 1



endif
endif  
endif 
end

 

after i go into either one of those sub menus .. all buttons stop functioning

 

thanks

 

Alex

Link to comment
Share on other sites

so it seems that i have cheered a bit too early ... the squad seems responding with no problems to the vanilla markers .. but the custom ones placed with the command place on do not seem to work

 

... i have set up an activater with a code

 

scn AlexSquadAssaultStealthToScript



Float Timer
short doOnce

Begin OnLoad
    
if doOnce == 0
         Set timer to 30
         PlaceAtMe AlexSquadMarker 1
       
         set AlexSquadAssaultStealthToMarker to 1
         ShowMessage AlexMoveInStealthIsWorking
	set doOnce to 1
endif

End

Begin GameMode

if timer > 0
	set timer to timer - getsecondspassed
       

else
          set AlexSquadAssaultStealthToMarker to 0
          
	disable
	MarkForDelete
endif

End

which activates a varriable in another script and another script adds a scriptpackage in which MYmarker is specified as a reference

works fine with the vanilla markers .. has anyone any idea how i can force the npc move to the newly spawned marker ??

 

thanks

Alex

Link to comment
Share on other sites

What's AlexSquadMarker? If that's the package destination marker, you really should have it as a persistent reference and be using MoveTo. creating multiple destination markers is just useless due to the package only tracking the one its told to.

 

There should only be one persistent marker (per package, placed in the GECK) which the package points to. When ever you need it to update the position, just call "moveto AlexSquadMarker" and then either add the package (or evp if they already have it, ie, position update).

 

Using placeatme on a marker is going to cause a heap of problems if you don't have something to clean the markers up, and you're going to need to update the package to point to the new dynamic reference of the marker every time a new one is placed. ie, don't use it.

 

All that said, AI isn't a strong point for me

Edited by Skevitj
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...