Staredit Network > Forums > Modding Assistance > Topic: Armed Civilian
Armed Civilian
Apr 12 2008, 10:00 pm
By: Pandut  

Apr 12 2008, 10:00 pm Pandut Post #1

I'm just a fish

I'm currently making a mod, and i want to add in the armed civilian to act out as an Officer unit. I've tried multiple times of Iscripting the civilian to have a weapon using the armed civ GRP but all i got were crashes. So if anyone could, tell, PM, or give me the Iscript so the armed civ will work correctly.

Thank you.



None.

Apr 12 2008, 10:40 pm Hercanic Post #2

STF mod creator, Modcrafters.com admin, CampaignCreations.org staff

Dear Pandut:
Well, what did you write for the Iscript code? The crashes are most likely caused by either a missing animation, or a nonexisting frame call. With attacks, you have three seperate animations for both ground and air. They are the initial attack, continued attack, and back to idle from attack. When, precisely, does it crash?




Apr 12 2008, 11:32 pm Pandut Post #3

I'm just a fish

After some re-reading of the text i found the crashing problem, i spelt CivilianGndAttkp instead of CivilianGndAttkRpt.
Anyhoo, The armed civ wont attack, it will go to its target but wont fire (Yes, i assigned it a weapon)

This is the script i used:
# ----------------------------------------------------------------------------- #
# This is a decompile of the iscript.bin file 'data\scripts\iscript.bin'
# created on: Sat Apr 12 17:51:54 2008
# ----------------------------------------------------------------------------- #

# ----------------------------------------------------------------------------- #
# This header is used by images.dat entries:
# 221 Civilian (neutral\civilian.grp)
.headerstart
IsId 67
Type 12
Init CivilianInit
Death CivilianDeath
GndAttkInit CivilianGndAttkInit
AirAttkInit [NONE]
Unused1 [NONE]
GndAttkRpt CivilianGndAttkRpt
AirAttkRpt [NONE]
CastSpell [NONE]
GndAttkToIdle CivilianGndAttkToIdle
AirAttkToIdle [NONE]
Unused2 [NONE]
Walking CivilianWalking
WalkingToIdle CivilianWalkingToIdle
SpecialState1 [NONE]
.headerend
# ----------------------------------------------------------------------------- #

CivilianInit:
imgul 222 0 0 # CivilianShad (neutral\nciShad.grp)
goto CivilianGndAttkInit

CivilianWalkingToIdle:
playfram 0x77 # frame set 7

CivilianLocal01:
waitrand 63 75
randcondjmp 128 CivilianLocal00
goto CivilianLocal01

CivilianLocal00:
turnrand 3
goto CivilianWalkingToIdle

CivilianDeath:
playsndbtwn 276 277 # Terran\MARINE\TMaDth00.WAV, Terran\MARINE\TMaDth01.WAV
imgol 242 0 0 # Unknown242 (terran\marine.grp)
wait 1
end

CivilianGndAttkInit:
playfram 0x00 # frame set 0
wait 1
playfram 0x11 # frame set 1
wait 1
playfram 0x22 # frame set 2

CivilianGndAttkToIdle:
playfram 0x11 # frame set 1
wait 1
playfram 0x00 # frame set 0
wait 1
goto CivilianWalkingToIdle

CivilianGndAttkRpt:
wait 1
nobrkcodestart
playsnd 10 # Misc\Explo1.wav
attackwith 1
playfram 0x33 # frame set 8
wait 1
playfram 0x22 # frame set 9
wait 1
playfram 0x33 # frame set 8
wait 1
playfram 0x22 # frame set 9
wait 1
playfram 0x33 # frame set 8
wait 1
playfram 0x22 # frame set 9
wait 1
nobrkcodeend
gotorepeatattk
ignorerest

CivilianWalking:
move 4
wait 1
playfram 0x00 # frame set 0
move 4
wait 1
playfram 0x11 # frame set 1
move 4
wait 1
playfram 0x22 # frame set 2
move 4
wait 1
playfram 0x33 # frame set 3
move 4
wait 1
playfram 0x44 # frame set 4
move 4
wait 1
playfram 0x55 # frame set 5
move 4
wait 1
playfram 0x66 # frame set 6
move 4
wait 1
playfram 0x77 # frame set 7
goto CivilianWalking


Keep in mind that i'm a noob Iscripter before you respond, ive only edited unit weapon Iscripts so far so this is kind of a big step fpr me.



None.

Apr 13 2008, 4:03 am Hercanic Post #4

STF mod creator, Modcrafters.com admin, CampaignCreations.org staff

Dear Pnadut:
Go to the AI tab in Units.dat. Use the Marine's AI as an example.




Apr 13 2008, 2:59 pm Pandut Post #5

I'm just a fish

Ah i see. So now the armed civ will face its target but still wont attack...



None.

Apr 14 2008, 11:04 pm Laser Dude Post #6



OK, first off: half your comments are wrong. Fix them, or delete them. Faulty comments can throw even a good coder off.

Second off, have you followed your script to see what it should do? Because when I follow it, I just see it jump to the idle section (i.e. endless waiting) and never use the attack. When you're writing your script, especially if it doesn't work, you should follow it to see where it actually goes...

Take a look at your attack section without any spaces (to get my point across):

Code
CivilianGndAttkInit:
playfram 0x00 # frame set 0
wait 1
playfram 0x11 # frame set 1
wait 1
playfram 0x22 # frame set 2
playfram 0x11 # frame set 1
wait 1
playfram 0x00 # frame set 0
wait 1
goto CivilianWalkingToIdle


Also, why does your init script go into your attack script? If that's unintentional, fix it. If it's intentional, then comment it so that people who help you know what you're thinking.

And here's a hint: if you want to know what your iscript is doing, use reasonable header names that suit that block of code. The decompiler just uses names like local00 because it has no clue what the script is trying to do. Names like civilianidle and civilianrandturn do a far better job then local00 and local01.



None.

Apr 15 2008, 9:45 pm Pandut Post #7

I'm just a fish

Thanx Laser :D The armed civ will now attack its target but its using the wrong animation. I need it to fire the gun its holding, not its hand :><:
Anyhoo, this is my current working Script

Code
# ----------------------------------------------------------------------------- #
# This is a decompile of the iscript.bin file 'data\scripts\iscript.bin'
# created on: Tue Apr 15 15:39:34 2008
# ----------------------------------------------------------------------------- #

# ----------------------------------------------------------------------------- #
# This header is used by images.dat entries:
# 221 Civilian (neutral\civilian.grp)
.headerstart
IsId               67
Type               12
Init               CivilianInit
Death               CivilianDeath
GndAttkInit         CivilianGndAttkInit
AirAttkInit         [NONE]
Unused1             [NONE]
GndAttkRpt         CivilianGndAttkRpt
AirAttkRpt         [NONE]
CastSpell           [NONE]
GndAttkToIdle       CivilianGndAttkToIdle
AirAttkToIdle       [NONE]
Unused2             [NONE]
Walking             CivilianWalking
WalkingToIdle       CivilianWalkingToIdle
SpecialState1       [NONE]
.headerend
# ----------------------------------------------------------------------------- #

CivilianInit:
    imgul               222 0 0     # CivilianShad (neutral\nciShad.grp)
CivilianWalkingToIdle:
    playfram           0x77     # frame set 7
CivilianLocal01:
    waitrand           63 75
    randcondjmp         128 CivilianLocal00
    goto               CivilianLocal01

CivilianLocal00:
    turnrand           3
    goto               CivilianWalkingToIdle

CivilianDeath:
    playsndbtwn         276 277     # Terran\MARINE\TMaDth00.WAV, Terran\MARINE\TMaDth01.WAV
    imgol               242 0 0     # Unknown242 (terran\marine.grp)
    wait               1
    end                

CivilianWalking:
    move               4
    wait               1
    playfram           0x00     # frame set 0
    move               4
    wait               1
    playfram           0x11     # frame set 1
    move               4
    wait               1
    playfram           0x22     # frame set 2
    move               4
    wait               1
    playfram           0x33     # frame set 3
    move               4
    wait               1
    playfram           0x44     # frame set 4
    move               4
    wait               1
    playfram           0x55     # frame set 5
    move               4
    wait               1
    playfram           0x66     # frame set 6
    move               4
    wait               1
    playfram           0x77     # frame set 7
    goto               CivilianWalking

CivilianGndAttkInit:
       playfram 0x00 # frame set 0
       wait 1
       playfram 0x11 # frame set 1
       wait 1
       playfram 0x22 # frame set 2
       playfram 0x11 # frame set 1
       wait 1
       playfram 0x00 # frame set 0
       wait 1
       goto CivilianGndAttkRpt

CivilianGndAttkRpt:
    wait               1
    nobrkcodestart    
    playsnd             10     # Misc\Explo1.wav
    attackwith         1
    playfram           0x55     # frame set 18
    wait               1
    playfram           0x44     # frame set 17
    wait               1
    nobrkcodeend      
    gotorepeatattk    
    ignorerest

CivilianGndAttkToIdle:
    playfram           0x11     # frame set 17
    wait               1
    playfram           0x00     # frame set 0
    wait               1
    goto               CivilianLocal00


Im obviously using the wrong frame set, its a little confusing to me...



None.

Apr 16 2008, 5:13 am Laser Dude Post #8



Your incorrect comments are throwing you off, this is a section of your code:

Code
   playfram           0x55     # frame set 18
   wait               1
   playfram           0x44     # frame set 17


frame 0x55 is not frame set 18! I think you're forgetting that anything after a pound (#) is a comment, and is ignored (this is so you can write things to help yourself out). Changing which frame the comment says has no effect on the code itself. There's 17 frames per frame set, so you need to take your frame set number, and multiply it by 17. Also, it may be easier to read in hex notation, in which there are 0x11 frames per frame, and you should multiply 0x11 by the frame number.

Also, having two frames play immediately after each other with no wait between is completely pointless, as seen in your init attack section:

Code
      playfram 0x22 # frame set 2
      playfram 0x11 # frame set 1




None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[06:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[06:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[06:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[06:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
[06:48 pm]
Vrael -- Perhaps that utilizes cutting-edge technology and eco-friendly cleaning products?
[06:47 pm]
Vrael -- Do you know anyone with a deep understanding of the unique characteristics of your carpets, ensuring they receive the specialized care they deserve?
[06:45 pm]
NudeRaider -- Vrael
Vrael shouted: I've also recently becoming interested in Carpet Cleaning, but I'd like to find someone with a reputation for unparalleled quality and attention to detail.
beats me, but I'd make sure to pick the epitome of excellence and nothing less.
[06:41 pm]
Vrael -- It seems like I may need Introductions to multiple companies for the Topics that I care deeply about, even as early as Today, 6:03 am.
[06:38 pm]
Vrael -- I need a go-to solution and someone who understands that Carpets are more than just decorative elements in my home.
Please log in to shout.


Members Online: Roy