User Tools

Site Tools


cw4:4rpl_tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
cw4:4rpl_tools [2024/01/18 15:08] – [Automated Tower Grid Building] Kallicw4:4rpl_tools [2024/03/16 19:53] (current) – [Automated Tower Grid Building] Added a statement for clarity of how to use it. LiteralNoob
Line 582: Line 582:
  
 $rmb:1 # right click button $rmb:1 # right click button
-$index:0 
  
-Once 
- @MakeSoundList 
-endOnce 
  
-if (GetMappedKey("Custom1" false)) +if(<-inputDelay gt0) <-inputDelay 1 - ->inputDelay endif 
- Mod(<-Index 1 +, <-soundCount) ->index+ 
 +if (GetMappedKey("Custom1" false) <-inputDelay eq0 &&) 
 + 2 ->inputDelay 
 + Mod(<-index 1 +, <-soundCount) ->index
  <-soundList[<-index] ->soundName  <-soundList[<-index] ->soundName
  TraceAll ("This is sound #" <-index ", " DQ <-soundName DQ)  TraceAll ("This is sound #" <-index ", " DQ <-soundName DQ)
 endIf endIf
  
-if (GetMappedKey("Custom2" false)) +if(GetMappedKey("Custom2" false) <-inputDelay eq0 &&) 
- Mod2(<-Index 1 -, <-soundCount) ->index+ 2 ->inputDelay 
 + Mod2(<-index 1 -, <-soundCount) ->index
  <-soundList[<-index] ->soundName  <-soundList[<-index] ->soundName
  TraceAll ("This is sound #" <-index ", " DQ <-soundName DQ)  TraceAll ("This is sound #" <-index ", " DQ <-soundName DQ)
Line 601: Line 601:
  
 if (GetMouseButtonDown(<-rmb true )) if (GetMouseButtonDown(<-rmb true ))
- PlaySoundAtPosition(<-soundName 8 GetCameraPosition) + PlaySoundAtPosition(<-soundName 8 GetCameraPosition V3(0 0.1 0) +)
 endif endif
- + 
 +:Once 
 + -1 ->index #So we start at 0, not 1. 
 + @MakeSoundList 
 :MakeSoundList :MakeSoundList
- +
  "ADAMessage"    "ADAMessage"  
  "ADAMessagesClose"    "ADAMessagesClose"  
Line 633: Line 637:
  "Explosion"    "Explosion"  
  "Explosion_1"    "Explosion_1"  
- "Explosion_10"   
- "Explosion_11"   
- "Explosion_12"   
  "Explosion_2"    "Explosion_2"  
  "Explosion_3"    "Explosion_3"  
Line 643: Line 644:
  "Explosion_8"    "Explosion_8"  
  "Explosion_9"    "Explosion_9"  
 + "Explosion_10"  
 + "Explosion_11"  
 + "Explosion_12"  
  "HoverOpen"    "HoverOpen"  
  "InfoCacheCollected"    "InfoCacheCollected"  
Line 715: Line 719:
  "Warning2"    "Warning2"  
  List ->soundList  List ->soundList
- +
  "AlarmClock"   "AlarmClock" 
  "GreenarRefinery"    "GreenarRefinery"  
Line 724: Line 728:
  "SoundLoop_alarm0"    "SoundLoop_alarm0"  
  "SoundLoop_alarm1"    "SoundLoop_alarm1"  
- "SoundLoop_alarm10"   
- "SoundLoop_alarm11"   
- "SoundLoop_alarm12"   
- "SoundLoop_alarm13"   
- "SoundLoop_alarm14"   
- "SoundLoop_alarm15"   
  "SoundLoop_alarm2"    "SoundLoop_alarm2"  
  "SoundLoop_alarm3"    "SoundLoop_alarm3"  
Line 738: Line 736:
  "SoundLoop_alarm8"    "SoundLoop_alarm8"  
  "SoundLoop_alarm9"    "SoundLoop_alarm9"  
 + "SoundLoop_alarm10"  
 + "SoundLoop_alarm11"  
 + "SoundLoop_alarm12"  
 + "SoundLoop_alarm13"  
 + "SoundLoop_alarm14"  
 + "SoundLoop_alarm15"  
  "SoundLoop_ambience0"    "SoundLoop_ambience0"  
- "SoundLoop_ambience1"   + "SoundLoop_ambience1"   
- "SoundLoop_ambience10"  +
  "SoundLoop_ambience2"    "SoundLoop_ambience2"  
  "SoundLoop_ambience3"    "SoundLoop_ambience3"  
Line 749: Line 752:
  "SoundLoop_ambience8"    "SoundLoop_ambience8"  
  "SoundLoop_ambience9"    "SoundLoop_ambience9"  
 + "SoundLoop_ambience10"  
  "SoundLoop_gun0"    "SoundLoop_gun0"  
  "SoundLoop_gun1"    "SoundLoop_gun1"  
Line 754: Line 758:
  "SoundLoop_gun3"    "SoundLoop_gun3"  
  "SoundLoop_hum0"    "SoundLoop_hum0"  
- "SoundLoop_hum1"  + "SoundLoop_hum1"  
 + "SoundLoop_hum2"   
 + "SoundLoop_hum3"   
 + "SoundLoop_hum4"   
 + "SoundLoop_hum5"   
 + "SoundLoop_hum6"   
 + "SoundLoop_hum7"   
 + "SoundLoop_hum8"   
 + "SoundLoop_hum9"   
  "SoundLoop_hum10"    "SoundLoop_hum10"  
  "SoundLoop_hum11"    "SoundLoop_hum11"  
Line 764: Line 776:
  "SoundLoop_hum17"   "SoundLoop_hum17" 
  "SoundLoop_hum18"    "SoundLoop_hum18"  
- "SoundLoop_hum2"   
- "SoundLoop_hum3"   
- "SoundLoop_hum4"   
- "SoundLoop_hum5"   
- "SoundLoop_hum6"   
- "SoundLoop_hum7"   
- "SoundLoop_hum8"   
- "SoundLoop_hum9"   
  "SoundLoop_machine0"    "SoundLoop_machine0"  
  "SoundLoop_machine1"    "SoundLoop_machine1"  
- "SoundLoop_machine10"   
- "SoundLoop_machine11"   
- "SoundLoop_machine12"   
  "SoundLoop_machine2"    "SoundLoop_machine2"  
  "SoundLoop_machine3"    "SoundLoop_machine3"  
Line 785: Line 786:
  "SoundLoop_machine8"   "SoundLoop_machine8" 
  "SoundLoop_machine9"    "SoundLoop_machine9"  
 + "SoundLoop_machine10"  
 + "SoundLoop_machine11"  
 + "SoundLoop_machine12"  
  "SoundLoop_misc0"    "SoundLoop_misc0"  
  "SoundLoop_misc1"    "SoundLoop_misc1"  
Line 797: Line 801:
  "ambient"   "ambient" 
  List ->loopSoundList  List ->loopSoundList
- +
  GetListCount(<-soundList) ->soundCount  GetListCount(<-soundList) ->soundCount
- TraceAllSp ("List of " <-soundCount "sounds available"+ TraceAllSp("List of " <-soundCount "sounds available"
- TraceAllSp ("There are also " GetListCOunt(<-loopSoundList) "looping sounds that cannot be played in this module"+ TraceAllSp("There are also " GetListCOunt(<-loopSoundList) "looping sounds that cannot be played in this module"
- TraceAllSP ("Press and hold user key 1/2 to scroll through the sound list." ) + TraceAllSP("Press and hold KeyPad 1 / 2 to scroll through the sound list."
- TraceAllSp ("Left-click mouse to listen to it.")+ TraceAllSp("Left-click mouse to listen to it.")
 </code> </code>
  
Line 812: Line 816:
  
 A few notes. A few notes.
- +  * The script will attempt to unpause the game, since looping sounds only play when not paused due to being attached to a unit.
-  * The Greenar Refinery sound is spatial and you have to be in freeview and right upon the unit in location (1,1) to hear it. +
-  * The script will attempt to unpause the game, since looping sounds only play when not paused.+
   * Remember to unmute game music.   * Remember to unmute game music.
  
Line 824: Line 826:
  
 $rmb:1 # right click button $rmb:1 # right click button
-$index:0 
  
-Once +if(<-inputDelay gt0<-inputDelay 1 - ->inputDelay endif 
- @MakeSoundList +
- CreateUnitOnTerrain("infocache" 1 1 1) ->unitUID +
- false ->soundOn +
- Getpause ->pause +
-endOnce+
 SetUnitPosition(<-unitUID GetCameraPosition V3(0 1.5 0) +) SetUnitPosition(<-unitUID GetCameraPosition V3(0 1.5 0) +)
  
-if (GetMappedKey("Custom1" false)) +if(GetMappedKey("Custom1" false) <-inputDelay eq0 &&) 
- Mod(<-Index 1 +, <-soundCount) ->index+ 2 ->inputDelay 
 + Mod(<-index 1 +, <-soundCount) ->index
  <-loopSoundList[<-index] ->soundName  <-loopSoundList[<-index] ->soundName
- TraceAll ("This is sound #" <-index ", " DQ <-soundName DQ)+ TraceAll("This is sound #" <-index ", " DQ <-soundName DQ)
 endIf endIf
  
-if (GetMappedKey("Custom2" false)) +if(GetMappedKey("Custom2" false) <-inputDelay eq0 &&) 
- Mod2(<-Index 1 -, <-soundCount) ->index+ 2 ->inputDelay 
 + Mod2(<-index 1 -, <-soundCount) ->index
  <-loopSoundList[<-index] ->soundName  <-loopSoundList[<-index] ->soundName
- TraceAll ("This is sound #" <-index ", " DQ <-soundName DQ)+ TraceAll("This is sound #" <-index ", " DQ <-soundName DQ)
 endIf endIf
  
-if (GetMouseButtonDown(<-rmb true )) +if(GetMouseButtonDown(<-rmb true)) 
- If (<-soundOn)+ If(<-soundOn)
  StopSoundLoop(<-unitUID)  StopSoundLoop(<-unitUID)
  Not(<-soundOn) ->soundOn  Not(<-soundOn) ->soundOn
  SetPause(<-pause)  SetPause(<-pause)
- TraceAllSp ("Stopping " <-soundName " from playing")+ TraceAllSp("Stopping " <-soundName " from playing")
  else  else
- TraceAllSp ("Can you hear " <-soundName " playing?")+ TraceAllSp("Can you hear " <-soundName " playing?")
  SetPause (false)  SetPause (false)
  PlaySoundLoop(<-soundName 5 <-unitUID)   PlaySoundLoop(<-soundName 5 <-unitUID)
  Not(<-soundOn) ->soundOn  Not(<-soundOn) ->soundOn
  endif  endif
-  
 endif endif
  
Line 864: Line 862:
  TraceAllSp("Goodbye!")  TraceAllSp("Goodbye!")
  DestroyUnit(<-unitUID true true true)  DestroyUnit(<-unitUID true true true)
 + if(<-soundOn) SetPause(true) endif
 +
 +:Once
 + -1 ->index #So we start at 0, not 1.
 + @MakeSoundList
 + CreateUnitOnTerrain("infocache" 1 1 1) ->unitUID
 + false ->soundOn
 + Getpause ->pause
  
-  
 :MakeSoundList :MakeSoundList
- +
  "ADAMessage"    "ADAMessage"  
  "ADAMessagesClose"    "ADAMessagesClose"  
Line 895: Line 900:
  "Explosion"    "Explosion"  
  "Explosion_1"    "Explosion_1"  
- "Explosion_10"   
- "Explosion_11"   
- "Explosion_12"   
  "Explosion_2"    "Explosion_2"  
  "Explosion_3"    "Explosion_3"  
Line 905: Line 907:
  "Explosion_8"    "Explosion_8"  
  "Explosion_9"    "Explosion_9"  
 + "Explosion_10"  
 + "Explosion_11"  
 + "Explosion_12"  
  "HoverOpen"    "HoverOpen"  
  "InfoCacheCollected"    "InfoCacheCollected"  
Line 915: Line 920:
  "MissionObjectiveFail"    "MissionObjectiveFail"  
  "MissionObjectiveRequiredComplete"    "MissionObjectiveRequiredComplete"  
- "MissionScan"     + "MissionScan"    "InhibitorFiring"   
- "InhibitorFiring"   +
  "MissionSpaceInitiateJump"    "MissionSpaceInitiateJump"  
  "MissionSpacePanelClose"    "MissionSpacePanelClose"  
Line 964: Line 968:
  "SporePrelaunch"    "SporePrelaunch"  
  "SprayerFire"    "SprayerFire"  
- "Stun"     + "Stun"    "CannonFire"  
- "CannonFire"  +
  "SurviveBaseOffline"    "SurviveBaseOffline"  
  "SurviveBaseWarn"    "SurviveBaseWarn"  
  "ThorGun"    "ThorGun"  
- "TotemExplosion"    + "TotemExplosion"   "UnitHoverLand"  
- "UnitHoverLand"  +
  "UnitBuild"    "UnitBuild"  
  "UnitExplosion"    "UnitExplosion"  
Line 989: Line 991:
  "SoundLoop_alarm0"    "SoundLoop_alarm0"  
  "SoundLoop_alarm1"    "SoundLoop_alarm1"  
- "SoundLoop_alarm10"   
- "SoundLoop_alarm11"   
- "SoundLoop_alarm12"   
- "SoundLoop_alarm13"   
- "SoundLoop_alarm14"   
- "SoundLoop_alarm15"   
  "SoundLoop_alarm2"    "SoundLoop_alarm2"  
  "SoundLoop_alarm3"    "SoundLoop_alarm3"  
Line 1003: Line 999:
  "SoundLoop_alarm8"    "SoundLoop_alarm8"  
  "SoundLoop_alarm9"    "SoundLoop_alarm9"  
 + "SoundLoop_alarm10"  
 + "SoundLoop_alarm11"  
 + "SoundLoop_alarm12"  
 + "SoundLoop_alarm13"  
 + "SoundLoop_alarm14"  
 + "SoundLoop_alarm15"  
  "SoundLoop_ambience0"    "SoundLoop_ambience0"  
- "SoundLoop_ambience1"   + "SoundLoop_ambience1"   
- "SoundLoop_ambience10"  +
  "SoundLoop_ambience2"    "SoundLoop_ambience2"  
  "SoundLoop_ambience3"    "SoundLoop_ambience3"  
Line 1014: Line 1015:
  "SoundLoop_ambience8"    "SoundLoop_ambience8"  
  "SoundLoop_ambience9"    "SoundLoop_ambience9"  
 + "SoundLoop_ambience10"  
  "SoundLoop_gun0"    "SoundLoop_gun0"  
  "SoundLoop_gun1"    "SoundLoop_gun1"  
Line 1019: Line 1021:
  "SoundLoop_gun3"    "SoundLoop_gun3"  
  "SoundLoop_hum0"    "SoundLoop_hum0"  
- "SoundLoop_hum1"  + "SoundLoop_hum1"  
 + "SoundLoop_hum2"   
 + "SoundLoop_hum3"   
 + "SoundLoop_hum4"   
 + "SoundLoop_hum5"   
 + "SoundLoop_hum6"   
 + "SoundLoop_hum7"   
 + "SoundLoop_hum8"   
 + "SoundLoop_hum9"   
  "SoundLoop_hum10"    "SoundLoop_hum10"  
  "SoundLoop_hum11"    "SoundLoop_hum11"  
Line 1029: Line 1039:
  "SoundLoop_hum17"   "SoundLoop_hum17" 
  "SoundLoop_hum18"    "SoundLoop_hum18"  
- "SoundLoop_hum2"   
- "SoundLoop_hum3"   
- "SoundLoop_hum4"   
- "SoundLoop_hum5"   
- "SoundLoop_hum6"   
- "SoundLoop_hum7"   
- "SoundLoop_hum8"   
- "SoundLoop_hum9"   
  "SoundLoop_machine0"    "SoundLoop_machine0"  
  "SoundLoop_machine1"    "SoundLoop_machine1"  
- "SoundLoop_machine10"   
- "SoundLoop_machine11"   
- "SoundLoop_machine12"   
  "SoundLoop_machine2"    "SoundLoop_machine2"  
  "SoundLoop_machine3"    "SoundLoop_machine3"  
Line 1050: Line 1049:
  "SoundLoop_machine8"   "SoundLoop_machine8" 
  "SoundLoop_machine9"    "SoundLoop_machine9"  
 + "SoundLoop_machine10"  
 + "SoundLoop_machine11"  
 + "SoundLoop_machine12"  
  "SoundLoop_misc0"    "SoundLoop_misc0"  
  "SoundLoop_misc1"    "SoundLoop_misc1"  
Line 1062: Line 1064:
  "ambient"   "ambient" 
  List ->loopSoundList  List ->loopSoundList
- +
  GetListCount(<-loopSoundList) ->soundCount  GetListCount(<-loopSoundList) ->soundCount
- TraceAllSp ("List of " <-soundCount "looping sounds available"+ TraceAllSp("List of " <-soundCount "looping sounds available"
- TraceAllSP ("Press and hold user key 1/2 to scroll through the sound list." ) + TraceAllSP("Press and hold KeyPad 1 / 2 to scroll through the sound list."
- TraceAllSp ("Move mouse out of edit box. Left-click mouse to listen to a sound. " ) + TraceAllSp("Move mouse out of edit box. Left-click mouse to listen to a sound. ") 
- TraceAllSP ("Left-click to turn off again."+ TraceAllSP("Left-click to turn off again."
- TraceAllSp ("Remember to mute music!")+ TraceAllSp("Remember to mute music!")
 </code> </code>
  
Line 2335: Line 2337:
 ===== Automated Tower Grid Building ===== ===== Automated Tower Grid Building =====
  
-The below script originally existed as a map script that builds out the tower grid for/alongside the player. I've adapted it for console usage in the editor, by blocking out specicific code and instantly constructing all towers.+The below script originally existed as a map script that builds out the tower grid for/alongside the player. I've adapted it for console usage in the editor, by blocking out specicific code and instantly constructing all towers that it places.
  
-If you have a large map with varied terrain and you want to want wire it up fast, then this script is worth a try.+If you have a large map with varied terrain and you want to want to wire it up fast, then this script is worth a try.
  
 New towers will be constructed if they can connect to: existing riftlab, m-rift, pylons, energy pods and towers. New towers will be constructed if they can connect to: existing riftlab, m-rift, pylons, energy pods and towers.
 +
 +To run the console script, simply let it run continuously.
  
 <hidden click here for source code> <hidden click here for source code>
Line 2346: Line 2350:
 # AutoTowerGrid # AutoTowerGrid
 # by Kalli # by Kalli
 +# Script is to run continuously in the console!
  
 $pacMode:0 # Makes all units built by the pilot unselectable and undeletable by the player $pacMode:0 # Makes all units built by the pilot unselectable and undeletable by the player
Line 2909: Line 2914:
  endif  endif
  endif  endif
- 
- 
 </code> </code>
  
 </hidden> </hidden>
 +
 +----
 +
 +===== Faster vanilla unit placement : Snapping Tool =====
 +
 +The snapping tool makes use of a unit for highlighting the nearest buildable cell, so it's a cpack instead of a script : [[https://knucklecracker.com/wiki/doku.php?id=cw4:cpack:docs:e58ef3f2-1468-42fa-ac84-c3561ddd9452|Kalli - SnappingTool]]
  
 ---- ----
cw4/4rpl_tools.1705608496.txt.gz · Last modified: 2024/01/18 15:08 by Kalli